[C++] Generate a PDF by drawing on a PDF HDC (Device Contrext)


I’m looking for a SDK to create PDF files in C++.

We want to export reports (screenshots, tables, etc.) without opening a printer dialog. What we expect from the library is to just create a document and a page, configuring the output quality (e.g. DPI), fetch a HDC for the page and then print to it using our own default printing routines as we do it when printing on a printer. Does your PDFNet offer an interface to support this use case? Is it possible to get a demo version to evaluate the resulting PDF files?


There are multiple ways to create a PDF with PDFNet. Some of the approaches are covered in the following article:


Based on your requirements it seems that you would prefer to create a PDF DC (Device Context) so that you can reuse the print logic in your application. In this case you may want to take a look at PDFDC and PDFDCEX as shown in PDFDC sample:


PDFDCEX uses new XPS print path, whereas PDFDC is based on Windows legacy EMF format.

Once you create a PDF you can also print-it to a physical printer as shown in PDFPrint sample:


Is it possible to get a demo version to evaluate the resulting PDF files?

Yes, PDFDC and Convert sample are included as part of the SDK which you can download from http://www.pdftron.com/pdfnet/downloads.html