Send file (PDF) to printer

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

Send file (PDF) to printer

Post by Snickers » Mon Nov 18, 2024 9:25 pm

I've searched the forums, but I've been unable to find the answer.
How can I print a pdf file using code only?

My script checks email, downloads attachments, renames the attachment, and if it is from a specific city, it prints the email attachment (pdf); however, I can't get it to send the pdf to the printer.

I've tried a few things, but they haven't worked.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1386
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Send file (PDF) to printer

Post by Dorian (MJT support) » Wed Nov 20, 2024 10:17 pm

My research suggests you can do this with Powershell, and for this solution you need Acrobat Reader to be installed. I tested this and it successfully printed to my default printer.

Code: Select all

Let>PDFFile=D:\MJT\IN\10036659565.pdf

LabelToVar>pscode7,ps

let>RP_WINDOWMODE=0
Run>powershell.exe %ps%

/*
pscode7:
Start-Process \"C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe\" -ArgumentList "/n", "/t", \"%PDFFile%\"
*/
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts