Free Support Forum -

Combine multiple files into single PDF file

I have a licensed version of GroupDocs.Total so if there is another product (like GroupDocs.Conversion) that can do this please let me know. I am using the GroupDocs.Viewer to allow viewing of documents in HTML form within my custom CRM application. User can view any single document and download the original or PDF version of the document. This all works well. I am now implementing a way for users to view multiple documents at once which the code uses the HTMLHandler to get the HTML pages for each document within the list and combines them into a List of HTMLInfo which I return to the client. The user can then view multiple documents within a single viewer. Now I want to provide the ability to download a single PDF file of all of the documents combined. I am not sure how to combine all of the documents into a single PDF file stream that I could return to the client. I am using MVC controllers to return the File ActionResult. I can get the combined HTML representation as I outlined above but cannot figure out a way to get a single PDF file of all of the documents. If I could just convert the HTMLInfo List that I currently have that would work but I cannot find a method to do that. Any help would be appreciated.


Thanks for using GroupDocs.Viewer.

In case you can get the combined Html representation of all the documents into a single Html file then you can also get the PDF representation of that combined Html file using GetPdfFile method. You will use the Html file as the source file in GetPdfFile method.

You can also use Aspose.Pdf that is a product offered by our sister company. It allows you to concatenate the multiple PDF documents into a single document. For details, please visit this article. Hope it helps.

I don’t have save the HTML as a file rather I return it to the client as a List of HTMLInfo and my client renders each page from that. So I am guessing that there is no way to merge PDF files in memory using GroupDocs?


Thanks for your response.

In that case, Aspose.Pdf will be the best choice for you and you will be able to concatenate all the PDF documents into a single file.