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

Q:

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?

A:

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

https://groups.google.com/d/msg/pdfnet-sdk/lhM9u-FwSZ0/4onXcbvwiLgJ

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:

http://www.pdftron.com/pdfnet/samplecode.html#PDFDC

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:

http://www.pdftron.com/pdfnet/samplecode.html#PDFPrint

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