These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Print Pdf-Files from C++ applikation

Bernhard
Registered: Nov 22 2007
Posts: 2

Hi,
i try to print something directly from a C++ applikation (VS6.0, Microsoft XP).
I tried to use the Adobe Printer, but that doesn`t work (Acrobat Reader can`t open the file).
I wrote the following code:
 
////////////////////////////////////////////////////////////////
DOCINFO dci1; // write file
T_LONG dret;
CDC dcPrint;
// DocInfo for Spooler/
 
//Real printer------------------------------------------------
// dci1.lpszDocName = "C:\\Hallo";
// dci1.lpszOutput = NULL; //"OutputFile1";
 
//Adobe--------------------------------------------------------- dci1.lpszDocName = "";
dci1.lpszOutput = "D:\\Test.pdf"; //"OutputFile1";

dci1.lpszDatatype = NULL;
////////////////////////////////////////////////////////////////
Using the real printer works.
 
Is it possible to create a PDF-File in an other way? Can I use special DLLs? Can you tell me where I got the needet information, please?
 
Thank you,
Bernhard

My Product Information:
Reader 7.0.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
To print a PDF file from your program you have to engage an application that can do this, i.e. Reader or Acrobat Pro. There are 2 simple methods.

1. Force the system to execute Acrobat/Reader from the command line with the proper command line options for printing. On windows use "ShellExecute()". Of course, for this you have to detect and locate either Reader or Acrobat first.

2. Use the Acrobat IAC interface to do the printing. This is be far the best option. You'll find the documentation here.

[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script