Jump to content


Photo
- - - - -

Printing a PDF file to a specific tray


4 replies to this topic

#1 mikelandl

mikelandl

    Expert

  • Members
  • PipPipPipPip
  • 101 posts

Posted 22 October 2013 - 06:56 PM

Currently when we print forms from our software (i.e. invoice, purchase order, etc.) we call an LR which has PCL escape sequences to specify a macro (form that is stored on the printer) and tray ID to print to. The problem is with most printers when you turn off the printer the memory gets cleared which means the form macros need to be reloaded onto the printer.
We've started converting some of our forms to PDF which removes the form macro issue. The new problem is that with PDFs you cannot specify a tray ID to print to, which is a big problem. We've tried using Ghostscript to convert from PDF to PCL and it does but the resulting file size is huge in comparison (26KB PDF file vs 382KB PCL file). I believe Ghostscript essential converts each page of the PDF into a tiff file and embeds them in the PCL file.
Does anybody here print PDF files from Linux to multi-tray printers? Any help would be appreciated.
Thanks.

#2 Ross Bevin

Ross Bevin

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 226 posts
  • Gender:Male
  • Location:Manzanillo, Colima, Mexico

Posted 22 October 2013 - 07:56 PM

We run in a Windows environment and can do what you are asking. So what I'm about to say may be of no help in your Linux environment but I will mention it anyway; it's always good to have this information out there in this forum.

We use a product from VeryPDF called PDF Print Command Line. You call it and pass it the path of the PDF file together with switches that determine such things as printer name, duplex, colour/b&w, portrait/landscape, etc. It does have a switch to select a specific printer tray but we haven't used it yet; we will be shortly. Currently we only use this utility when we print PDF invoices and packing slips that we have just created using the PDF SSO. It works like a charm but I don't believe they have a Linux version. There may be another product out there that does what it does but under Linux.

Currently when our users select a report to print to a printer, we have a global update that is called from the report function (logic in) that writes the printer escape sequences to the beginning of the print stream. This has worked well for the past 10 years but I do have problems with newer printers that don't conform to HP. Now with the PDF SSO and VeryPDF I can replace this solution with something far simpler. When a user wants to print to a printer I will instead set @RPTOPT to output to a text file. I have a simple function that reads the text file and uses the PDF SSO to output the text to a PDF file. I then use VeryPDF to send that PDF file to the desired printer. VeryPDF Print Command Line has all the switches I need to control the output similar to the escape sequences I use now, but with more control.

If you can find a Linux look a like for VeryPDF then I would recommend that would be the path to go.

#3 mikelandl

mikelandl

    Expert

  • Members
  • PipPipPipPip
  • 101 posts

Posted 23 October 2013 - 03:09 PM

We run in a Windows environment and can do what you are asking. So what I'm about to say may be of no help in your Linux environment but I will mention it anyway; it's always good to have this information out there in this forum.

We use a product from VeryPDF called PDF Print Command Line. You call it and pass it the path of the PDF file together with switches that determine such things as printer name, duplex, colour/b&w, portrait/landscape, etc. It does have a switch to select a specific printer tray but we haven't used it yet; we will be shortly. Currently we only use this utility when we print PDF invoices and packing slips that we have just created using the PDF SSO. It works like a charm but I don't believe they have a Linux version. There may be another product out there that does what it does but under Linux.

Currently when our users select a report to print to a printer, we have a global update that is called from the report function (logic in) that writes the printer escape sequences to the beginning of the print stream. This has worked well for the past 10 years but I do have problems with newer printers that don't conform to HP. Now with the PDF SSO and VeryPDF I can replace this solution with something far simpler. When a user wants to print to a printer I will instead set @RPTOPT to output to a text file. I have a simple function that reads the text file and uses the PDF SSO to output the text to a PDF file. I then use VeryPDF to send that PDF file to the desired printer. VeryPDF Print Command Line has all the switches I need to control the output similar to the escape sequences I use now, but with more control.

If you can find a Linux look a like for VeryPDF then I would recommend that would be the path to go.


Hi Ross,

Thanks for the suggestions.


I’m happy to report I have found asolution. Have only tested it on one printer so far but I’m optimistic.
Have you ever heard of PJL (Printer JobLanguage)? It was created by HP as an extension to PCL. You can control trayIDs, duplex printing, etc. AND you can insert files into the PJL job! Here iswhat we have tried so far:



[ESC]%-12345X@PJL

@PJL JOB NAME = “invoice.pdf” DISPLAY = “Printinginvoice.pdf”

@PJL SET MEDIASOURCE = TRAY2

@PJL ENTER LANGUAGE = PDF

<<INSERT PDF FILE HERE>>

[ESC]%-12345

@PJL RESET

@PJL EOJ NAME = “invoice.pdf”

[ESC]%-12345X



[ESC] should be replaced with the ASCIIcharacter for escape (hex 1b).




One way you could do it is to have 3 files (begin.pjl which contains the first 4 lines,file.pdf which is the PDF file, and end.pjl which contains the last 4 lines)and issue the following: cat begin.pjl file.pdf end.pjl > outputfile

You could then send outputfile to theprinter using lp and Bob’s your uncle.



#4 Ross Bevin

Ross Bevin

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 226 posts
  • Gender:Male
  • Location:Manzanillo, Colima, Mexico

Posted 23 October 2013 - 05:52 PM

Hi Mike,

Glad to hear you have found a solution. Yes I have heard of PJL but have never used it. Good to see we have good options out there to handle printing better. It sure is a lot easier now that we have good PDF creation solutions available, especially in a Windows environment. I got a real shock when we moved from SCO Unix 11 years ago. Printing and printer control was so much more easier under Unix in those days.

Regards

Ross

#5 mikelandl

mikelandl

    Expert

  • Members
  • PipPipPipPip
  • 101 posts

Posted 23 October 2013 - 06:40 PM

Hi Mike,

Glad to hear you have found a solution. Yes I have heard of PJL but have never used it. Good to see we have good options out there to handle printing better. It sure is a lot easier now that we have good PDF creation solutions available, especially in a Windows environment. I got a real shock when we moved from SCO Unix 11 years ago. Printing and printer control was so much more easier under Unix in those days.

Regards

Ross


Agreed. PDF gives us much better presentation abilities and delivery options (i.e. email, save to disk, etc) but it does introduce other issues (i.e. printing) which it seems like we've managed to overcome. Will have to test it on more printer models to know for sure.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users