Print from PDF and change Paper Size
Copy link to clipboard
Copied
Dears,
I have the challenge that I need to print an PDF in Format A5. Want to do this with VBA.
The AVDoc /PDDoc matter can bee out of scope here, not finally decided who I will feed the PDF in.
The Challenge is:
Print PDF on Standard Printer, Format A5. The default Format is A4.
I am already searched here and the whole SDK, from this I was able to Build up something. But this is not workung fine and my main Issue is not fixed here.
Dim AcroApp As Acrobat.CAcroApp
Dim PdDoc As Acrobat.CAcroPDDoc
Set AcroApp = CreateObject("AcroExch.App")
Set PdDoc = CreateObject("AcroExch.PDDoc")
Dim AcroPDDoc As Acrobat.AcroPDDoc
Dim JSObject As Object
Dim pp As Object
Dim fv As Object
If PdDoc.Open("C:\Users\ND01132\Downloads\Loadlist (6).pdf") = True Then
Set JSObject = PdDoc.GetJSObject
Set pp = JSObject.getPrintParams
pp.Interactive = AcroPrintParams.Constants.interactionLevel.Silent
pp.firstPage = 0
pp.lastPage = 1
pp.pageHandling = 1
Set fv = pp.Constants.flagValues
pp.flags = fv.setPageSize()
JSObject.Print (pp)
End If
For the Line pp.Interactive = AcroPrintParams.Constants.interactionLevel.Silent I always get the Runtime Error 424 - Object Required. Not Sure how to fix This.
Next Point is fv.setPageSize() How can I change the Papersize to A5 ?
Happy to hear some Tips !
Regards
Yannick
Copy link to clipboard
Copied
The printParams are the correct thing to use. You are using Adobe Acrobat Pro and not simply Acrobat Reader, correct?
Copy link to clipboard
Copied
Dear,
thats sounds good at all.
Yes, Acrobat Pro
Copy link to clipboard
Copied
You can't specify a pagesize there. Use the property pageHandling.

