Skip to content

Instantly share code, notes, and snippets.

@jamesmorgan
Created March 15, 2012 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmorgan/2045900 to your computer and use it in GitHub Desktop.
Save jamesmorgan/2045900 to your computer and use it in GitHub Desktop.
How to manually print through Adobe Reader on Windows
public class AdobeReaderPrinting {
public static void main(final String[] args) {
final File file = new File("src/test/resources/tests/Sample_Printing.pdf");
final Runtime r = Runtime.getRuntime();
Process p = null;
try {
// Information about command line printing flags can be foud at http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Acrobat10_SDK_HTMLHelp&file=DevFAQ_UnderstandingSDK.22.31.html
final String printing =
"C:\\Program Files (x86)\\Adobe\\Reader 10.0\\Reader\\AcroRd32.exe /s /h /t " + file.getCanonicalPath()
+ " \"\\\\My_Remote_Or_Locally_Installed_Printer\"";
p = r.exec(printing);
}
catch (final Exception e) {
System.out.println("Exception thrown: " + e.getMessage());
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment