Print PDF

Hey friends,

I would greatly appreciate some help with my question. I am really stumped why my code below does not print. I am using C++ 6.0 and all I want to do is print a PDF (with PrintSilentPages supplied by Acrobat SDK) that I have stored on my computer. The code compiles fine and seems like it should work but nothing prints. I have researched this extensively without success.

Additional information:

I am on a Windows 7 64-bit machine (don't believe this matters)
I am using Adobe Acrobat SDK X
Have Adobe Reader X 10.1.4 installed

I am able to get this to work by using a Shell Command but for my scenario I need to do this through the SDK.

I have also tried this with Acrobat 9 SDK.

I am hoping there is someone with experience with this or some expert that can help me out.

Thank you in advance for reading my post!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

     COleException e;

     CAcroAVDoc * pAcroAvDoc = new CAcroAVDoc();
     pAcroAvDoc->CreateDispatch(TEXT("AcroExch.AVDoc"), &e);

     CString strPathName = "C:\\Artawork\\PDF\\";
     CString strFileName = "ExamplePDF.pdf";

     pAcroAvDoc->Open(strPathName, strFileName);

     pAcroAvDoc->PrintPagesSilent(0, 2, 1, 1, 1);

     pAcroAvDoc->Close(1);
Last edited on
I thought this looked interesting - so I downloaded the SDK, built the simple
sample that came with the SDK, compiled ok but failed miserably at runtime.

Further investigation came up with this statement -

It is not sufficient to install just an ActiveX control or DLL to enable OLE Automation. You must have the full Acrobat product installed to use OLE automation.

EDIT - More Info
On the Adobe site, to buy the full product would cost me £119 british pounds

(if you are in USA they are charging $116 dollars U.S)
So they are overcharing me because I live in the UK !!!!!!!!!!!!!!!!!!!!!!!

You can try before you buy the product - I'm going to give that a try.

I downloaded the full version for trial
and the following worked nicely for me.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    //The first two lines are the same as yours
    CAcroAVDoc * pAcroAvDoc = new CAcroAVDoc();
    pAcroAvDoc->CreateDispatch(TEXT("AcroExch.AVDoc"), &e);



    //This next line must be the full path of the pdf file
    CString strPathName = TEXT("c:/Users/andy/simple.pdf");
    
    //This next line is an (optional) title for  the window
    //in which the file is opened
    CString strFileName = TEXT("");

    //Open the file
    pAcroAvDoc->Open(strPathName, strFileName);

    //Print any required pages
    //NOTE: I downloaded the latest SDK so the
    //third parameter must be 2 or 3 for the postscript level.
    pAcroAvDoc->PrintPagesSilent(0,0,2,1,0);

    //Close the document
    pAcroAvDoc->Close(1);
Last edited on
Thanks for the research and the information! It is greatly appreciated. I will have to find another way to print PDFs as we cannot require our customers to install the full version of Acrobat.

Thanks!
Topic archived. No new replies allowed.