Created attachment 86849 [details] [review] glib: Add poppler_documents_save_pages() Attached is a patch which implements function poppler_documents_save_pages(). This function can be useful in situation when an application needs to save selected pages from a document or merge / split documents. Its first parameter "documents" is array of PopplerDocument. Second parameter "pages" is array of arrays of integers. Every 1st level array of "pages" corresponds to a PopplerDocument on the same position in "documents". Every second level array is terminated by -1. Number of documents is specified in the third parameter "n_documents". Fourth parameter is an uri to which the result will be saved. Last parameter is return location for error. The code is based on the "pdfunite" utility. Regards Marek
Any chance you can share the code instead of copying it by moving it up to somewhere in poppler/* ?
(In reply to comment #1) > Any chance you can share the code instead of copying it by moving it up to > somewhere in poppler/* ? Sure, I'll look for a place where it fits well.
Comment on attachment 86849 [details] [review] glib: Add poppler_documents_save_pages() This looks very complex API to me. I haven't looked at the patch in detail, but I would go with something more like: poppler_document_writer_new (); poppler_document_writer_add_page (writer, page, &error); poppler_document_writer_add_page (writer, page, &error); .... poppler_document_writer_write (writer, uri, &error); Or something similar.
Created attachment 87030 [details] [review] Add PDFBuilder class I've created a new class PDFBuilder for the creation of PDFs. It has two methods addPage() and saveAs(). The first one adds a "Page" to an internal list and the saveAs() saves all such pages to the given filename.
This is quite similar to the PDFWritter class in bug #71213, maybe we could use a common code in the core, and use it both, for printing and for saving specific pages.
Looking at the PDFBuilder class the main difference is it allows pages from different documents. It should be easy to add this functionality to PDFWriter.
(In reply to comment #5) > This is quite similar to the PDFWritter class in bug #71213, maybe we could > use a common code in the core, and use it both, for printing and for saving > specific pages. I'll try to look at this next week. Thank you Marek
So should this be discarded in favour of https://bugs.freedesktop.org/show_bug.cgi?id=71213 ?
(In reply to comment #8) > So should this be discarded in favour of > https://bugs.freedesktop.org/show_bug.cgi?id=71213 ? Yes, you are right. I'm closing this as duplicate of the #71213. Regards Marek *** This bug has been marked as a duplicate of bug 71213 ***
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.