|
I would like to share a small trick
I've found in order to assure PDF are printed correctly. The PDFs I generate fail to print
when the "rotate and center" option is unchecked or the page size is
fitted by Acrobat Reader. When I desire to print, my Web
server generates the following PDF that will print automatically with the right
settings when opened. The trick is
to add this snippet: if (mustPrint) { writer.addJavaScript( "if (typeof app.viewerVersion !='undefined'
&& app.viewerVersion >= 6.0) {"+ // Version >= 6 "var pp=this.getPrintParams();"+ "var co=pp.constants;"+ "pp.flags=0;"+ "pp.interactive=co.interactionLevel.automatic;"+ /*1: Undocumented value, it means never adjusting
the paper size*/ "pp.pageHandling=1;"+ "this.print(pp);"+ "} else {"+ // Version < 6 "this.print({bUI:false});"+ "}" ); } -------- David |
