English | 日本
BCL Technologies
View shopping cart
BCL easyPDF SDK

Program PDF in C# for Your Web Applications

Easily Add PDF Functionalities to your ASP.NET Web Server Applications

A few lines of C# or VB.NET code are all it takes to get started to convert a document to PDF in your ASP.NET application:

...
Type type = Type.GetTypeFromProgID("easyPDF.Loader.6");
Loader oLoader = (Loader)Activator.CreateInstance(type);

Printer oPrinter = (Printer)oLoader.LoadObject("easyPDF.Printer.6");

PrintJob oPrintJob = oPrinter.PrintJob;
oPrintJob.PrintOut(Server.MapPath(@".\input.doc"), Server.MapPath(@".\output.pdf"));
...
     

Comprehensive PDF Features

BCL easyPDF SDK comes with all the PDF features that you may need in developing enterprise ASP and ASP.NET web server applications:

  • CREATING PDF
  • PROCESSING PDF
  • RASTERIZING PDF
  • PDF FORM

Creating PDF in ASP.NET Server Application

Code Snippet

...
Type type = Type.GetTypeFromProgID("easyPDF.Loader.6");
Loader oLoader = (Loader)Activator.CreateInstance(type);

Printer oPrinter = (Printer)oLoader.LoadObject("easyPDF.Printer.6");

PrintJob oPrintJob = oPrinter.PrintJob;
oPrintJob.PrintOut(Server.MapPath(@".\input.doc"), Server.MapPath(@".\output.pdf"));
...
                  

Preparing Your Server

  • Step 1: Loader Setup
    The Loader Object is a helper object to enable easyPDF SDK on the server-side environment. It eliminates many of the server-side configurations that you would otherwise have to deal with.
  • Step 2: Microsoft Office Setup [watch the video]
    This example shows how to make Microsoft Word ready for server use. All you need to do here is to make sure that there are no pop-up dialogs from Office products during PDF conversion.
  • Step 3: COM Security Setup [watch the video]
    To make the easyPDF SDK objects run properly on the server-side environment.


Processing and Manipulating PDF in ASP.NET (Merging PDFs, Splitting PDF, Extracting Text from PDF, etc)

  • Read the PDFProcessor Object Specification
    This object lets you do post-processing of existing PDF files (such as merging multiple PDF files into one, splitting one PDF file into two, and encrypting/decrypting a PDF file)

Code Snippet for Merging PDF Files

...
Type type = Type.GetTypeFromProgID("easyPDF.Loader.6");
Loader oLoader = (Loader)Activator.CreateInstance(type);

PDFProcessor oProcessor = (PDFProcessor)oLoader.LoadObject("easyPDF.PDFProcessor.6");

// merge two files using Merge
oProcessor.Merge(Server.MapPath(@".\input1.pdf"), Server.MapPath(@".\input2.pdf"), Server.MapPath(@".\merged.pdf"));

// merge more than two files using MergeBatch
string[] inputFiles = new string[] 
{ 
	Server.MapPath(@".\input1.pdf"),
	Server.MapPath(@".\input2.pdf"),
	Server.MapPath(@".\input3.pdf") 
};
oProcessor.MergeBatch(inputFiles, Server.MapPath(@".\merged.pdf"));
...
                  

 

Code Snippet for Splitting PDF

...
Type type = Type.GetTypeFromProgID("easyPDF.Loader.6");
Loader oLoader = (Loader)Activator.CreateInstance(type);

PDFProcessor oProcessor = (PDFProcessor)oLoader.LoadObject("easyPDF.PDFProcessor.6");

// split the document at page 3
oProcessor.Split(Server.MapPath(@".\input.pdf"), Server.MapPath(@".\part1.pdf"), Server.MapPath(@".\part2.pdf"), 3);
...
                  

 

Code Snippet for Extracting Text from PDF

...
Type type = Type.GetTypeFromProgID("easyPDF.Loader.6");
Loader oLoader = (Loader)Activator.CreateInstance(type);

PDFProcessor oProcessor = (PDFProcessor)oLoader.LoadObject("easyPDF.PDFProcessor.6");

// extract text from pages 1 through 4 to a physical file using ExtractText
oProcessor.ExtractText(Server.MapPath(@".\input.pdf"), Server.MapPath(@".\extracted.txt"), null, 0, 3, null, null);

// extract text from a bounding box on page 1 to a string variable using ExtractText2
string text = oProcessor.ExtractText2(Server.MapPath(@".\input.pdf"), 0, 0, 0, 300, 300, null);
...
                  

 

Rasterizing PDF in ASP.NET

Code Snippet

...
Type type = Type.GetTypeFromProgID("easyPDF.Loader.6");
Loader oLoader = (Loader)Activator.CreateInstance(type);
 
PDFConverter oConverter = (PDFConverter)oLoader.LoadObject("easyPDF.PDFConverter.6");
 
PDF2Image oPDF2Image = oConverter.PDF2Image;
oPDF2Image.Convert(Server.MapPath(@".\input.pdf"), Server.MapPath(@".\output.jpg"), null, null, null);
...
                  

Processing PDF Form Fields in ASP.NET

Code Snippet

Download the input.pdf form (line 27 below)

// this example takes the first two fields in a PDF template
// which are Name and Address, and populates them with 
// values of "BCL Technologies" and "Santa Clara, CA"
 
Type type = Type.GetTypeFromProgID("easyPDF.Loader.6");
Loader oLoader = (Loader)Activator.CreateInstance(type);
 
PDFDocument oDocument = (PDFDocument)oLoader.LoadObject("easyPDF.PDFDocument.6");
 
oDocument.Open(Server.MapPath(@".\input.pdf"));
 
// get all form fields from the PDF
 
FormFields oFormFields = oDocument.FormFields;

// get the first form field
FormField oFormField = oFormFields[0];
 
TextField oTextField;
 
if (oFormField.Type == docFormFieldType.DOC_FRMTYPE_TEXT && oFormField.Name == "Name")
    {
        // set Name to "BCL Technologies"
        oTextField = (TextField)oFormField;
        oTextField.Value = "BCL Technologies";
    }

// get the second form field
oFormField = oFormFields[1];

if (oFormField.Type == docFormFieldType.DOC_FRMTYPE_TEXT && oFormField.Name == "Address")
    {
        // set Address to "Santa Clara, CA"
        oTextField = (TextField)oFormField;
        oTextField.Value = "Santa Clara, CA";
    }
oDocument.SaveAs(Server.MapPath(@".\output.pdf"));
                  
 

 

Request Pricing

Download Free Trial
The Free Trial is a fully functional
software, with 30-day expiration.

QuickStart Video
Watch a QuickStart Video on how to use easyPDF SDK in ASP and ASP.NET Web Server Environment.

PDF Features

Documentation

Testimonials from Our ASP.NET Customers

  • “easyPDF SDK setup was very straightforward, unlike our experience with other products. We wrote just a few lines of code to start using it.” Read the case study
  • “We evaluated many PDF tools and drivers. We even wrote our own. Except for BCL’s easyPDF SDK, all had limitations we couldn’t live with. Some only converted from MS Office and not very well. Others could not do annotation or text stamping on PDF documents. None were as easy to use and as easy to integrate.” Read the case study

Who uses easyPDF SDK?

ARTC MS Wireless Northrop Grumman Taxworks
-
Developer Tools | Desktop Products | Services | Success Stories | Free Downloads | Purchase | Support Site Map
© 1993 - , BCL Technologies. All other trademarks are the property of their respective owners. Terms & Privacy Statement