Copy link to clipboard
Copied
I'm working on a project that requires to print several pages in only 1 sheet, it is required to print 10 pages per row and 14 pages per column so in fact 140 pages per sheet.
It can be easily done by hand with ctrl+p->multiple pages->custom->10x14 but the amount of documents are just too much to handle them by hand and I need to do it automatically.
I'm using VBA to merge all the pdf documents in a single pdf but cannot find a way to print them the way I have explained.I have achieve a workaround by using sendkeys method but it requires to leave the computer doing its job for hours without doing nothing else (if you accidentally click on a screen it will make all the process goes to waste)
Is there any othre solution to print multiple pages in an automatic way?
Thank you
Copy link to clipboard
Copied
Hi,
If you look at the JavaScript reference - Acrobat JS API
there is a printparams object that allows you to control the printing, inside that object there is pageHandling which has an nUp setting which I think might be able to do what you want.
This could be run from Action Wizard to make life easier.
Copy link to clipboard
Copied
Thank you Barlae for your guidance, the acrobat JS API is so usefull
I use action wizard with sendkeys method, it was quite usefull but I guess to do directly will be easier to automatize
However I'm not a programmer and I'm used to get stuck at the first stone in my way.
This is what I have edited from another instructions which allows to add a watermark to the pdf (another thing it is required) I hoped that it works fine then I realize that even if it works I don't know how to command to print the merged sheets on a file
Sub printmerged()
Dim acroApp As Acrobat.acroApp
Dim AVDoc As Acrobat.AcroAVDoc
Dim myDocument As Acrobat.AcroPDDoc
Dim jso As Object
Dim strPath As String
Dim strFileName As String
Dim intPages As Integer
Dim i As Integer
Set acroApp = CreateObject("AcroExch.App")
Set myDocument = CreateObject("AcroExch.PDDOc")
strPath = "C:\"
strFileName = "1.pdf"
'Open file and load JSObject
Set myDocument = CreateObject("AcroExch.PDDOc")
myDocument.Open (strPath & strFileName)
Set jso = myDocument.GetJSObject
jso.printparams _
nUpNumPagesH:=10, _
nUpNumPagesV:=14
Print myDocument
'Clean up
Set jso = Nothing
Call acroApp.CloseAllDocs
Set myDocument = Nothing
Call acroApp.Exit
Set acroApp = Nothing
End Sub
Copy link to clipboard
Copied
Hi,
I don't have a windows machine to work on so can't really help with the actual code, but I can guide you to that you need to get the printParams object, like this sample, and then you set the options, and then you will need to call the print from the JSO otherwise it wont use the printparams object. Like the sample from the docs.
pp = this.getPrintParams();
pp.pageHandling = pp.constants.handling.nUp;
pp.nUpPageOrders = pp.constants.nUpPageOrders.Horizontal; pp.nUpNumPagesH = 2;
pp.nUpNumPagesV = 2;
pp.nUpPageBorder=true;
this.print(pp);
This is what you need to replicate, but it will have to be done inside the JSO object.
Copy link to clipboard
Copied
I'm not sure what is going on but I cannot reply properly because it says that I am post flooding 😐
Copy link to clipboard
Copied
Now it get stuck in the printing window with no other action. In fact at a certain point excel pops a window message telling that it is waiting for the pdf file to complete an OLE action. If I cancel it shows me an error window on Excel VBA telling that there is an execution time error on the 'ExecuteThisJavascript' 'IFields' object method