Does anyone have code samples of how to merge multiple files generated on the run time to a single PDF? I know how to create new PDF document in my c# project(objects of class PdfDocument). What should be noted here is that I want to combine pdf documents with out reading by file. There must be a way to solve this problem, but I don't know how. Is there someone who got any solution? Any help is appreciated!
This article on XsPDF.com is what you looking for, check out: Combine PDF documents into one in C#.
Answers
I met the similar issue in my project. Problem is solved quickly with the help of XsPDF basic library.
This is something that I figured out, and wanted to share with you. The way to solve this issue is based on what requirement for your merged PDF file, whether to keep the original format or interactive features. Let me explain.
If you design to combine PDF documents into one big PDF file which keeps the original format of the PDF pages, like content format, interactive annotation, etc., you may choose a solution that has the class of PDF copy effect. It allows the pages transferred in their original format. And we recommend you to use XsPDF .NET PDF basic library. It provides the method to save the newly created PDF to a memory stream. And then, you can read from that memory stream in Import mode.
Instead, you only need to merge the created documents into a new PDF document without considering its original format or interactive features, you can chose to use a PDF writer class. It can help you govern the general format of PDF. Please do note, the interactive features like forms and annotations will be lost when you use PdfWriter to merge source PDF documents.
