ASP.NET PDF Processing SDK Component

ASP.NET PDF Processing SDK Component

Platform : Windows 10, Windows 8, Vista, Windows 7, XP

This SDK for ASP.NET and Desktop Windows Developer to add PDF Editing features in your Web Application or Desktop Application.

Popular Solution Go   Back

ASP.NET - How to merge PDF files on ASP.NET 2010

Step 1: To install the ASP.NET PDF Processing SDK Component, begin by launching the setup file (http://www.viscomsoft.com/demo/pdfprocessing.exe). Select the desired installation folder for the ASP.NET PDF Processing SDK Component and continue with the installation on your development computer.

Step 2: Started visual studio 2010, the next step is create a new project, select ASP.NET Empty Web Application. Click OK.


Step 3:  In Solution Explorer, selected References, right click the mouse, select Add Reference... , select Browse, select PDFProcessingWrapper.dll from C:\Program Files (x86)\ASP.NET PDF Processing SDK Component\bin folder, then click OK.



Step 4:  Select WebApplication1 in Solution Explorer, right click the mouse, select Add - New Items... , select Web Form, enter the Default.aspx name. Then click Add.


Step 5:  Select WebApplication1 in Solution Explorer, right click the mouse, select Add - New Folder, rename the folder to output and Add - New Folder again. named uploads, add two pdf files into uploads folder, named test1.pdf, test2.pdf.




Step 6:  Open Default.aspx.cs, add the following import statements to the top of the page.
using System.Web.Services;
using PDFProcessingWrapper;


Step 7:  Add MergePDFFiles function and Create an instance of ASP.NET PDF Processing SDK Component and then call Merge method.
[WebMethod]
public static string MergePDFFiles(string strInputPDFFile1, string strInputPDFFile2)
{
var myUniqueFileName = string.Format(@"{0}.pdf", Guid.NewGuid());

PDFProcessing obj = new PDFProcessing();

string stroutpath = HttpContext.Current.Server.MapPath("~/output/" myUniqueFileName);

string strinputpath1 = HttpContext.Current.Server.MapPath("~/uploads/" strInputPDFFile1);
string strinputpath2 = HttpContext.Current.Server.MapPath("~/uploads/" strInputPDFFile2);

bool bResult = obj.Merge(strinputpath1, strinputpath2, stroutpath);

if (bResult)
return "Merged PDF files Successful";
else
return "Merged PDF files Failed";
}


Step 8:  add the following code in Page Load event,it will merge two pdf files into one pdf file.
protected void Page_Load(object sender, EventArgs e)
{
 string strResult = MergePDFFiles("test1.pdf","test2.pdf");
 Response.Write(strResult).
}

Step 9. Press F5 run the project, it will output the pdf in output folder.

Download the ASP.NET 2010 Merge Sample