Skip to main content
Participant
Jan 24, 2018 1:36 PM UTC
Question

Print from PDF and change Paper Size

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

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Bernd Alheit
Community Expert
Community Expert
Jan 26, 2018 10:15 AM UTC

You can't specify a pagesize there. Use the property pageHandling.

Translate
lrosenth
Adobe Employee
Adobe Employee
Jan 24, 2018 7:43 PM UTC

The printParams are the correct thing to use. You are using Adobe Acrobat Pro and not simply Acrobat Reader, correct?

Translate
Participant
Jan 25, 2018 7:14 AM UTC

Dear,

thats sounds good at all.

Yes, Acrobat Pro

Translate