How to set printer scaling settings to 100% or not fit to page


I am trying to set the scale factor to 100% or fit to page unchecked in the pdf print settings.
I cannot use PDFViewer printer settings as we are not printing through this program.
This a PDF report which is hosted on the web server, so wouldnot have access to printers locally.

Tried to embed javascript in the document but did not work
JavascriptAction jsAction=new JavascriptAction(“this.print({bUI:true,bSilent:false,bShrinkToFit:false});”);

Please let me know how to do this.

P.S. Appreciate if you can get back soon as I have to resolve it .



We have tested your scenario in our environment, and it is working fine. This is the output PDF: JavaScript-Added.pdf (1.6 KB). If this does not help, then please send us your source PDF and code. We will investigate your scenario in our environment, and share our findings with you.


Please try setting the action on before printing. I think in your example it is on load of the page.

JavascriptAction jsAction=new JavascriptAction(“this.print({bUI:true,bSilent:false,bShrinkToFit:false});”);



Thank you for elaborating it further.

We have tried to set the action before printing the PDF file and have noticed that it is not working as expected. Therefore, a ticket with ID PDFJAVA-37832 has been logged in our issue management system for further investigations. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.