开发者

Fast dot-matrix printing with PHP

My client has old foxpro based application in Windows and wanted to make it web based with PHP/MySQL. The only problem is the printing of their various reports/receipts. That foxpro based application facilitating fast printing on dot-matrix printers using some mode etc. (sorry I'm not sure here).

So if there's a webform created by php and we want to print, it goes to pr开发者_如何学Pythoninter and starts printing each line (repeating on each line multiple times to make it bold and slow). This is default behavior for other apps as well, whether its word/excel etc. but few old apps like DOS based text file when you print, it will again print very fast (printing a line only once, therefore though making it rough but fast).

Any insight how to achieve this using PHP? any pointers will be helpful.


Use Firefox ,and JSPrintSetup add-on at this Link for a silent printing.

Sample code which demonstrate using of JSPrintSetup to setup print margins and call unattended print method (without print dialog).

// set portrait orientation
jsPrintSetup.setOption('orientation', jsPrintSetup.kPortraitOrientation);
// set top margins in millimeters
jsPrintSetup.setOption('marginTop', 0);
jsPrintSetup.setOption('marginBottom', 0);
jsPrintSetup.setOption('marginLeft', 0);
jsPrintSetup.setOption(' marginRight', 0);
// set empty page header
jsPrintSetup.setOption('headerStrLeft', '');
jsPrintSetup.setOption('headerStrCenter', '');
jsPrintSetup.setOption('headerStrRight', '');
// set empty page footer
jsPrintSetup.setOption('footerStrLeft', '');
jsPrintSetup.setOption('footerStrCenter', '');
jsPrintSetup.setOption('footerStrRight', '');
// Suppress print dialog
jsPrintSetup.setSilentPrint(true);
// Do Print
jsPrintSetup.print();
// Restore print dialog
jsPrintSetup.setSilentPrint(false);


To elaborate on what Pekka is digging at. If you are running PHP as a local language, and not over the web, you can access the local system directly and at a low enough level to print the way you want WITH the programs that print those DOS text files.

But I suspect you mean over the web, in which case the answer is a solid no.


EPSON ESC/P control codes Selecting an EPSON ESC/P printer in your software allows you to use advanced fonts and graphics. General operation:

ESC @, ESC U Paper feeding:

FF, LF, ESC 0, ESC 1, ESC 2, ESC 3, ESC A, CR Page format:

ESC (C, ESC C, ESC C 0, ESC Q, ESC l, ESC (c, ESC N, ESC O, ESC (U Print position motion:

ESC $, ESC \, ESC D, HT, ESC B, VT, ESC J Font selection:

ESC k, ESC x, ESC y, ESC P, ESC M, ESC g, ESC p, ESC 4, ESC 5, ESC E, ESC F, ESC ! Font enhancement:

ESC W, DC4, SO, DC2, SI, ESC w, ESC G, ESC H, ESC T, ESC S, ESC - Spacing:

ESC Space Character handling:

ESC t, ESC (t, ESC R, ESC %, ESC &, ESC :, ESC I, ESC 6, ESC 7 Bit image:

ESC K, ESC L, ESC Y, ESC Z, ESC *, ESC ^ Bar code:

ESC (B

IBM PPDS emulation control codes This printer emulates the IBM Proprinter using the commands below. For detailed information, see the IBM PPDS reference manual. General operation:

NUL, DC3, ESC j, BEL, CAN, DC1, ESC Q, ESC [ K, ESC U Paper feeding:

FF, LF, ESC 5, ESC A, ESC 0, ESC 1, ESC 2, ESC 3, CR, ESC ] Page format:

ESC C, ESC C0, ESC X, ESC N, ESC O, ESC 4 Print position motion:

ESC d, ESC R, ESC D, HT, ESC B, VT, ESC J Font selection:

DC2, ESC P, ESC :, ESC E, ESC F, ESC I, ESC [d, ESC [I Font enhancement:

DC4, SO, ESC SO, ESC W, ESC [ @, SI, ESC SI, ESC G, ESC H, ESC T, ESC S, ESC -, ESC _ Spacing:

BS, SP Character handling:

ESC 6, ESC 7, ESC [ T, ESC ^, ESC ¥ Bit image:

ESC K, ESC L, ESC Y, ESC Z Bar code:

ESC [f, ESC [p Download:

ESC =

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜