Skip to main content
jroes637
Participant
July 7, 2016
Answered

How Can I Print Attachments Within a PDF file from Command Line?

  • July 7, 2016
  • 2 replies
  • 2740 views

For my organization, we have a lot of .pdf files, each of which contain multiple .pdf files within them as attachments (i.e. one single .pdf file that contains other .pdf files within it). I know I can print a .pdf file with the following command via command prompt.

"C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Acrobat.exe" /n /t "filetoprint.pdf" "\\printerserver\printername"

While this will print the .pdf in question, it does not print any attachments within the file "filetoprint.pdf". I've scoured google and these forums, yet I haven't seem to found a switch or anything that would enable me to do this. Does anyone have any suggestions? It needs to be done by command line. I would appreciate any help! Thanks!

~Justin

This topic has been closed for replies.
Correct answer jroes637

After a lot more research, I found the answer. To start with, rather than using a .bat file, I used the Action wizard to set up a script. I then set the script to process all the files within a given folder. I changed the folder to the one that would contain all the .pdf files (including the attachments) that I wanted to process. I then wrote the following javascript::

var d = this.dataObjects;

var pp = this.getPrintParams();

pp.interactive = pp.constants.interactionLevel.silent;

pp.printerName = "\\\\printerserver\\printer";

this.print(pp);

var oDoc;

for (var i = 0; i < d.length; i++)
{

oDoc = this.openDataObject(d.name);

oDoc.print(pp);

}

Yeah, it's not from command line like I originally wanted, but it will still work for what I need to do. It looks like you can trigger an action from a VBA Macro or something, though at this point I think that's more trouble than it is worth. Anyways, hope this helps out anyone else who is having the same problem!

2 replies

Participant
October 26, 2017

I've created a form users can attach files to. Reviewers would like to print form with all attachments with one click. Will your Action Wizard solution work for just one document at a time? I'm a novice and was not clear on what to do after finding how to access the Action Wizard. Can you explain starting steps in more detail?

jroes637
jroes637AuthorCorrect answer
Participant
July 11, 2016

After a lot more research, I found the answer. To start with, rather than using a .bat file, I used the Action wizard to set up a script. I then set the script to process all the files within a given folder. I changed the folder to the one that would contain all the .pdf files (including the attachments) that I wanted to process. I then wrote the following javascript::

var d = this.dataObjects;

var pp = this.getPrintParams();

pp.interactive = pp.constants.interactionLevel.silent;

pp.printerName = "\\\\printerserver\\printer";

this.print(pp);

var oDoc;

for (var i = 0; i < d.length; i++)
{

oDoc = this.openDataObject(d.name);

oDoc.print(pp);

}

Yeah, it's not from command line like I originally wanted, but it will still work for what I need to do. It looks like you can trigger an action from a VBA Macro or something, though at this point I think that's more trouble than it is worth. Anyways, hope this helps out anyone else who is having the same problem!