Add PJL command into PDF file with PHP code -
How to insert a PJL command in PGL without converting PDF to PostScript?
* STARTPJL @PJL SET STAPLE = LEFTTOP * ENDPJL Then I send it to the printer via FTP or LPR.
I am using Zend_Pdf to create PDF documents.
** I tried unsuccessfully of this code
$ a = "& Lt; ESC & gt;% -12345X @ PJL & LT; CR & gt; & lt; Left & gt;"; $ A. = "@PJL SET OUTBIN = OUTBIN101 & lt; CR> "; $ A. = "@ PJL Setstool = Lttop & lt; CR> "; $ A. = "@ PJL Enter Language = PDF CR> "; $ A. = File_get_contents ("/ www / zendsvr / htdocs / gda / public / pdf / test.pdf"); $ A. = "& Lt; Esc & gt;% - 12345X"; $ Myfile = fopen ("/ www / zendsvr / htdocs / gda / public / pdf / t.pdf", "w"); FILIT ($ myfile, $ a); Fclose ($ myFile);
The document is printed properly, but can not change the driver, no suggestions?
I'm not going to explain how to achieve the following points with PHP. When working with PJL in relation to PDF-based print job from PJL, these important points are to be familiar with these things. You have to 'translate' yourself into this generic information 'PHP' ....
You insert PJL Command PDF but you can command Prednien PJL to PDF Print Job.
In addition, to do this you send it to a printer via FTP or LPR. This is only meaningful if you send the first file to it.
Next, your example PJL code is not valid for most purposes. The standard way to include PJL lines in the PDF print job file is:
& lt; ESC & gt;% - 12345X @ PJL & LT; CR & gt; & Lt; LF & gt; @ PJL set staple = lefttop & lt; CR & gt; & Lt; LF & gt; @ PJL [... more PJL commands if required ...] PGL Enter language = PDF < CR & gt; & Lt; LF & gt; [...] All the bytes of PDF file starts with 'PDF PDF-1'. ...] [... all bytes of PDF file ............................] [...] All of the bytes pdf File ............................ [...] all the bytes of PDF file ending with '%% EOF' Is .......] & lt; ESC & gt;% - 12345X
Explanation:
- Here
& lt ; ESC & gt; The escape character indicates (in 27 decimal, 1B in hex) -
& lt; CR & gt; Carriage return character ( 13 in DC; 0D in hex) This is optional within PJL . -
line feed charaxter ( 10 in DC, 0A in hex ).
is
-
ESC & gt;% - 12345X 'Universal Exit Language' indicates the command (UEL). This is required in PJL, it defines the beginning and closing of a PJL-based data stream. Finally, please note:
-
Not all printers and all LPR print services are PDF-based Are able to deal with print jobs. In addition, all printers and not LPR print services are able to honor all PJL commands that are ready to print job files.
Comments
Post a Comment