搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

printing PDF document directly to a specific printer using Firefox internal PDF viewer (PDF Javascript statements)

  • 1 回覆
  • 1 有這個問題
  • 9 次檢視
  • 最近回覆由 cor-el

more options

Hi, I need printing a PDF document directly to a specific printer bypassing the printing dialog. In order to do it I enclosed some JavaScript code within the PDF document (see below).

This is working when using the Adobe Reader Firefox plugin (which has been dismissed in the lastest versions of FireFox).

I tried to use the embedded Firefox PDF viewer and everything is working fine except for the printer selection. In other words the printing dialog box does not appear (I had to change some configuration in about:config) but the PDF gets always printed to the default printer, thus ignoring the JavaScript statement below "pp.printerName").

Any hint to solve my issue ?

Thanks, Alberto



%PDF-1.4 %âãÏÓ 1 0 obj <</S/JavaScript/JS(var pp = this.getPrintParams\(\);)>> endobj 2 0 obj <</S/JavaScript/JS(pp.NumCopies = 1;)>> endobj 3 0 obj <</S/JavaScript/JS(pp.interactive = 2;)>> endobj 4 0 obj <</S/JavaScript/JS(pp.pageHandling = 3;)>> endobj 5 0 obj <</S/JavaScript/JS(pp.printerName = 'SAMPLEPRINTER';)>> endobj 6 0 obj <</S/JavaScript/JS(this.print\(pp\);)>> endobj 7 0 obj <</Names[(0000000000000000) 1 0 R(0000000000000001) 2 0 R(0000000000000002) 3 0 R(0000000000000003) 4 0 R(0000000000000004) 5 0 R(0000000000000005) 6 0 R]>> endobj 8 0 obj <</Type/Metadata/Subtype/XML/Length 2952>>stream <x:xmpmeta xmlns:x="adobe:ns:meta/">

  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
     <rdf:RDF rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
        <dc:format>application/pdf</dc:format>

... ... ...

Hi, I need printing a PDF document directly to a specific printer bypassing the printing dialog. In order to do it I enclosed some JavaScript code within the PDF document (see below). This is working when using the Adobe Reader Firefox plugin (which has been dismissed in the lastest versions of FireFox). I tried to use the embedded Firefox PDF viewer and everything is working fine except for the printer selection. In other words the printing dialog box does not appear (I had to change some configuration in about:config) but the PDF gets always printed to the default printer, thus ignoring the JavaScript statement below "pp.printerName"). Any hint to solve my issue ? Thanks, Alberto ---------------------------------------------------- %PDF-1.4 %âãÏÓ 1 0 obj <</S/JavaScript/JS(var pp = this.getPrintParams\(\);)>> endobj 2 0 obj <</S/JavaScript/JS(pp.NumCopies = 1;)>> endobj 3 0 obj <</S/JavaScript/JS(pp.interactive = 2;)>> endobj 4 0 obj <</S/JavaScript/JS(pp.pageHandling = 3;)>> endobj 5 0 obj <</S/JavaScript/JS(pp.printerName = 'SAMPLEPRINTER';)>> endobj 6 0 obj <</S/JavaScript/JS(this.print\(pp\);)>> endobj 7 0 obj <</Names[(0000000000000000) 1 0 R(0000000000000001) 2 0 R(0000000000000002) 3 0 R(0000000000000003) 4 0 R(0000000000000004) 5 0 R(0000000000000005) 6 0 R]>> endobj 8 0 obj <</Type/Metadata/Subtype/XML/Length 2952>>stream <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:RDF rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/"> <dc:format>application/pdf</dc:format> ... ... ...

所有回覆 (1)

more options