English | 日本
BCL Technologies
Shopping CartContact Us
BCL easyPDF SDK

Create PDF in Your C++ Applications

Quickly and easily build PDF features into your C++ applications

Developers can use easyPDF SDK to quickly and easily build PDF features into their C++ applications that give businesses the means to effectively deliver existing business documents to partners, customers and employees.

A few lines of code are all it takes to convert a document to PDF in your C++ application:

...
EasyPDFPrinter::IPrinterPtr oPrinter;
oPrinter.CreateInstance("easyPDF.Printer.7");
 
EasyPDFPrinter::IPrintJobPtr oPrintJob = oPrinter->GetPrintJob();
oPrintJob->PrintOut("C:\\input.doc", "C:\\output.pdf");
... 

Comprehensive PDF Features

BCL easyPDF SDK comes with all the PDF features that you may need in developing C++ applications:

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

Creating PDF

C++ Code Snippet

EasyPDFPrinter::IPrinterPtr oPrinter;
oPrinter.CreateInstance("easyPDF.Printer.7");
 
EasyPDFPrinter::IPrintJobPtr oPrintJob = oPrinter->GetPrintJob();
oPrintJob->PrintOut("C:\\input.doc", "C:\\output.pdf");

C++ Sample Projects

 

Processing PDF (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)

C++ Sample Projects

C++ Code Snippet for Merging PDF Files

EasyPDFProcessor::IPDFProcessorPtr oProcessor;
oProcessor.CreateInstance("easyPDF.PDFProcessor.7");
 
// merge two files using Merge
oProcessor->Merge("C:\\input1.pdf", "C:\\input2.pdf", "C:\\merged.pdf");
 
// merge more than two files using MergeBatch  
SAFEARRAYBOUND bound;
bound.lLbound = 0;
bound.cElements = 3;
 
SAFEARRAY *inputFiles = SafeArrayCreate(VT_VARIANT, 1, &bound);
 
std::string filesToMerge[] = { "C:\\input1.pdf", "C:\\input2.pdf", "C:\\input3.pdf" };
int numFiles = sizeof(filesToMerge) / sizeof(std::string);
 
_variant_t var;
_variant_t inputArray;
char *file;
_bstr_t str;
long ix;
 
var.vt = VT_BSTR;
 
for (int i = 0; i < numFiles; i++)
    {
    ix = i;
    file = const_cast<char *>(filesToMerge[i].c_str());
    str = file;
    var.bstrVal = str;
    SafeArrayPutElement(inputFiles, &ix, &var);
    }
 
inputArray.vt = VT_ARRAY|VT_VARIANT;
inputArray.parray = inputFiles;
oProcessor->MergeBatch(inputArray, "C:\\merged.pdf");

 

Code Snippet for Splitting PDF

EasyPDFProcessor::IPDFProcessorPtr oProcessor;
oProcessor.CreateInstance("easyPDF.PDFProcessor.7");
 
// split the document at page 3
oProcessor->Split("C:\\input.pdf", "C:\\part1.pdf", "C:\\part2.pdf", 3);
                  

 

Code Snippet for Extracting Text from PDF

EasyPDFProcessor::IPDFProcessorPtr oProcessor;
oProcessor.CreateInstance("easyPDF.PDFProcessor.7");
 
// extract text from pages 1 through 4 to a physical file using ExtractText
oProcessor->ExtractText("C:\\input.pdf", "C:\\extracted.txt", NULL, 0, 3, NULL, NULL);
 
// extract text from a bounding box on page 1 to a string variable using ExtractText2
std::string text = oProcessor->ExtractText2("C:\\input.pdf", 0, 0, 0, 300, 300, NULL);
                  

 

Rasterizing PDF

C++ Code Snippet

EasyPDFConverter::IPDFConverterPtr oConverter;
oConverter.CreateInstance("easyPDF.PDFConverter.7");
 
EasyPDFConverter::IPDF2ImagePtr oPDF2Image = oConverter->GetPDF2Image();
oPDF2Image->Convert("C:\\input.pdf", "C:\\output.jpg", NULL, NULL, NULL);
                  

C++ Sample Projects

 

Processing PDF Form Fields

C++ Code Snippet

Download the input.pdf form (highlighted 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"
 
EasyPDFDocument::IPDFDocumentPtr oDocument;
oDocument.CreateInstance("easyPDF.PDFDocument.7");
 
oDocument->Open("C:\\input.pdf");
 
// get all form fields from the PDF
EasyPDFDocument::IFormFieldsPtr oFormFields = oDocument->FormFields;
 
// get the first form field
EasyPDFDocument::IFormFieldPtr oFormField = oFormFields->Item[0];
 
EasyPDFDocument::ITextFieldPtr oTextField;
 
if (oFormField->Type == EasyPDFDocument::DOC_FRMTYPE_TEXT && oFormField->Name == _bstr_t("Name"))
	{
	// set Name to "BCL Technologies"
	oTextField = oFormField;
	oTextField->Value = "BCL Technologies";
	}
 
// get the second form field
oFormField = oFormFields->Item[1];
 
if (oFormField->Type == EasyPDFDocument::DOC_FRMTYPE_TEXT && oFormField->Name == _bstr_t("Address"))
	{
	// set Address to "Santa Clara, CA"
	oTextField = oFormField;
	oTextField->Value = "Santa Clara, CA";
	}
	oDocument->SaveAs("C:\\output.pdf");
                  

C++ Sample Projects

 

 

 

Download Free Trial

Request Pricing

Comprehensive PDF Features
C++ Sample Projects

Download C++ Sample Projects

screenshot

Documentation
Testimonials from Our Customers
  • We use easyPDF SDK technology for PDF conversion and it works very well. We knew BCL is a solid company. We have also looked at several competitors and tried to use their products, but we like easy PDF SDK the best. When we talked to BCL Technologies’ design engineering team, we knew they had the knowledge and confidence to solve our problems.” 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
-
 
BCL
© 1993 - , BCL Technologies.
All other trademarks are the property of their respective owners.