For example, you could add restrictions, like allowing the merging of PDFs only for documents up to a specific number of pages, or not allowing merging of more than a handful of PDFs at once. Therefore, it’s essential to be aware of this and handle memory accordingly. Merging documents is usually a memory-intensive task, since it requires loading parts of a document or even an entire document into memory. We use dispatch semaphores to wait for pages from one document being imported into the final document to finish before we can import the pages from the next source document in the queue. These are needed because the Document Editor API for importing pages is asynchronous. Notice the use of dispatch semaphores in the snippet above. And most importantly, annotations will be persisted in the merged document as well: PSPDFKit also automatically handles merging rotated pages without the user having to manually adjust anything. In this way, metadata, bookmarks, and other document-based information will be preserved in the new document. With this approach, you can merge entire PDF files directly into a new document without having to draw every single page of each PDF separately. Using PSPDFKitĪnother option would be to use PSPDFKit’s Document Editor component. But if you are dealing with PDFs that are highly customized and edited to include a lot of extra information, this approach might not fit your needs. So if you have a simple and straightforward use case, this could work for you. Finally, you would need to manually adjust the rotation for rotated pages. And since it draws page by page from the different documents into the new document and doesn’t append each document as a whole to the final document, all document-based information like bookmarks, the outline, the metadata, and page labels get lost as well. This means any drawings or highlights that were added to the individual documents before merging them won’t be in the final document. For one, it loses all existing annotations in the documents, which could be considered the largest dealbreaker. However, this approach has a few downsides.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |