p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Basics (http://p2p.wrox.com/forumdisplay.php?f=136)
-   -   Merge PDF Documents (http://p2p.wrox.com/showthread.php?t=50557)

Gyto November 21st, 2006 06:49 AM

Merge PDF Documents
 
Hi there,

Does anyone know a way to merge 2 or more PDF documents into a single PDF file using ASP.NET?? This may potentially be used on a number of systems, so I would prefer it if I could achieve this in the ASP.NET code itself (so I don't have to install software or components on each machine the let me do it...)

Thanks!!

winnovative June 6th, 2007 04:26 PM

PDF Merge and Split libraries from http://www.winnovative-software.com or http://www.dotnet-reporting.com are very reliable. The PDF merge tool allows you to merge PDF, HTML, texts and images.


winnovative July 10th, 2007 04:19 PM

You can build your own PDF merge utility using the PDF Merge and split libraries for .NET from from http://www.dotnet-reporting.com or http://www.winnovative-software.com .
You can use it to merge PDF files, html files, text files and images,
set the page orientation, compression level and page size.

All this can be accomplished with only a few lines of code:

Code:

PdfDocumentOptions pdfDocumentOptions = new PdfDocumentOptions();
pdfDocumentOptions.PdfCompressionLevel = PDFCompressionLevel.Normal;
pdfDocumentOptions.PdfPageSize = PdfPageSize.A4; pdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Portrait;
PDFMerge pdfMerge = new PDFMerge(pdfDocumentOptions);
pdfMerge.AppendPDFFile(pdfFilePath);
pdfMerge.AppendImageFile(imageFilePath);
pdfMerge.AppendTextFile(textFilePath);
pdfMerge.AppendEmptyPage();
pdfMerge.AppendHTMLFile(htmlFilePath);
pdfMerge.SaveMergedPDFToFile(outFile);

You can find the full code sample on the PDF Merge Code Sample page

Regards,
Florin

marrisa August 19th, 2013 02:33 AM

Please directly use the following code to achieve PDF merging :

using RasterEdge.Imaging.Basic;
using RasterEdge.Imaging.Basic.Core;
using RasterEdge.Imaging.Basic.Codec;
using RasterEdge.Imaging.PDF;


namespace RE__Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public static string FolderName = "c:/";

private void button1_Click(object sender, EventArgs e)
{
string fileName1 = FolderName + "Sample1.pdf";
string fileName2 = FolderName + "Sample2.pdf";
string fileNameMerged = FolderName + "Merged.pdf";

REDocument doc1 = REFile.OpenDocumentFile(fileName1, new PDFDecoder());//use PDFDecoder open one pdf file

REDocument doc2 = REFile.OpenDocumentFile(fileName2, new PDFDecoder());//use PDFDecoder open another pdf file

BaseDocument docMerged = doc1.MergeDocument(doc2);//merge two pdf

REFile.SaveDocumentFile((REDocument)docMerged, fileNameMerged, new PDFEncoder());//save new pdf

}


All times are GMT -4. The time now is 01:12 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.