LEADTOOLS Support
Document
Document SDK FAQ
How can I combine multiple documents into a single PDF?
#1
Posted
:
Thursday, April 6, 2017 1:10:39 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
Multiple input documents can be consolidated into a single PDF by using a LEADTOOLS virtual document. This can be useful when needing to assemble input documents from multiple sources and formats. Once these virtual documents are created, they exist in memory opposed to needing to be generated as a temporary file on disk. This alleviates the overhead of monitoring the temporary file and discarding it when no longer necessary.
Once assembled, the virtual documents can either be written to a file on disk using the Document Writer, displayed in a viewer, or both. This code snippet shows how to create a virtual document and add several pages to it.
Code:
using (LEADDocument document = DocumentFactory.Create(createOptions))
{
document.Name = "Virtual";
LoadDocumentOptions loadOptions = new LoadDocumentOptions();
loadOptions.Cache = cache;
LEADDocument childDocument = DocumentFactory.LoadFromFile(Path.Combine(ImagesPath.Path, "Leadtools.pdf"), loadOptions);
document.Pages.Add(childDocument.Pages[0]);
document.Pages.Add(childDocument.Pages[1]);
}
For more information on this feature and more in-depth example code, see our documentation page on DocumentFactory.Create()
https://www.leadtools.com/help/sdk/dh/dox/documentfactory-create(createdocumentoptions).htmlIn addition, we have an online demo which showcases this new functionality.
https://demo.leadtools.com/JavaScript/DocumentComposerThis provides a drag-and-drop UI where images and documents are loaded from multiple sources. The individual pages from each of these can be dragged into the virtual document, rearranged as necessary, then saved to disk as a new file. Here are a few screenshots of the demo in action.
Edited by moderator Wednesday, December 27, 2023 3:47:33 PM(UTC)
| Reason: Updated links
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Document
Document SDK FAQ
How can I combine multiple documents into a single PDF?
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.