Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 21st, 2006, 06:49 AM
Registered User
 
Join Date: Oct 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!!
 
Old June 6th, 2007, 04:26 PM
Registered User
 
Join Date: Jun 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old July 10th, 2007, 04:19 PM
Registered User
 
Join Date: Jun 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old August 19th, 2013, 02:33 AM
Registered User
 
Join Date: Jun 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

}





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to merge two xml documents together? NewToXSL Pro VB.NET 2002/2003 2 August 22nd, 2008 05:28 AM
merge reporting services with pdf k2sarah Reporting Services 0 January 7th, 2007 09:43 PM
comparision of two documents anuradhad Access VBA 0 July 22nd, 2004 12:26 AM
merge 2 xml documents Beulah VS.NET 2002/2003 0 November 20th, 2003 09:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.