33

I have some PDF's which, when I double-click to open, automatically bring up the Print dialog box in Adobe Reader X. I'm on Windows XP. I think this is because of some code within the PDF itself. Is there some way I can disable such automatic printing from Adobe Reader?

10 Answers 10

27

If it's happening only with some specific files then it's probably because:

You can tie Acrobat JavaScript code to a specific PDF document, a page, field, or button within that document, or a field or button within the PDF file, and even to a user action

You can disable javascript in Adobe Reader:

  • Open Edit -> Preferences
  • Click on Javascript on the left-hand pane
  • Uncheck Enable Acrobat Javascript on the right-hand pane
2
  • Added the instructions for deleting the script from the PDF file, from user218924's answer as edited by @Kazark. This makes one answer tell the whole story. May 31, 2019 at 21:46
  • I was able to apply this solution with Foxit. I opened the file, canceled the printing, turned off the Javascript in the preferences, saved the file, and then when I opened the file again the problem was solved. The fix stuck even when I turned javascript back on again. Oct 1, 2019 at 23:01
25

Open in Adobe Acrobat. Goto tools > Javascript > choose "Document Javascripts". Then a dialog box pops up. There will be this.print() code with a corresponding script name (0 in my case). Just press delete botton in the dialog box and save.

5
  • 6
    Can you do this with Adobe Reader, or do you need the full Acrobat version?
    – wisbucky
    Jan 25, 2014 at 22:41
  • 4
    This should be the accepted answer as it explains where the actual cause is and how to remove it. The accepted answer suggests modifying Acrobat preferences to disable that feature, which is not a solution, just a workaround. May 18, 2017 at 20:42
  • In Adobe Acrobat 8 Professional the path is a bit different: Advanced > Document Processing > Document JavaScripts... > Press Delete in the pop-up dialog. Jul 27, 2018 at 6:38
  • This answer is incomplete, in that you have to turn off Enable Acrobat Javascript as @Sim K's answer says, in order to get past the print dialogue. (My document's script called this.print(); followed immediately by this.close().) I am going to add this answer's instructions to the accepted answer, to have one answer which gives the whole story. May 31, 2019 at 21:39
  • Not possible in free Adobe Reader DC, for anyone else wondering. Jan 27 at 16:18
4

Hi a very simple method will be to just open the pdf file with Notepad or Notepad++ & then just find & Comment this line

/JS (this.print\({bUI:true,bSilent:false,bShrinkToFit:true}\);)

like this

//JS (this.print\({bUI:true,bSilent:false,bShrinkToFit:true}\);)

then just save the document & you are Done, Enjoy your PDF like you Want it.

1
  • I found it necessary to use a hex editor instead of a text editor (I used HxD). Jan 27 at 16:42
1

Try to re-create (or re-print) the PDF file using PDFCreator.

1

These didn't work for me, however, using Tool > Protection > Remove Hidden Information and selecting the item with Javascript to remove did work.

1

The easiest way to solve this is to simply print the file to another PDF file, and name it something slightly different than the original. That will remove the printing prompt from automatically opening.

0

Open the Document Properties in Adobe Acrobat (Ctrl+D) and make sure that no toolbars or window controls are hidden in the tab Initial View.

0

With a PDF this same problem had been happening to for me, I was able to make the necessary alterations without Acrobat. I opened the the PDF in a text editor. As noted by Kazark there was a line with "this.print()". I simply deleted the line, and that fixed the problem.

0

If you have Adobe Acrobat Pro here is the solution tested under XI version.

  1. Open the target document and cancel Print dialog

  2. Go to Tools => JavaScript => Set Document Actions => Edit All

  3. Search for this line: this.print({bUI:true,bSilent:false,bShrinkToFit:true});

  4. Comment the line: //this.print({bUI:true,bSilent:false,bShrinkToFit:true});

  5. Click OK, click OK again, save the document. Voila!

0

You can open the pdf with notepad, look for the lines that look something like:

<<
/Type /Action
/S /JavaScript
/JS (this.print\({bUI:true,bSilent:false,bShrinkToFit:true}\);)
>>

and delete the 3 lines:

/Type /Action
/S /JavaScript
/JS (this.print\({bUI:true,bSilent:false,bShrinkToFit:true}\);)
3
  • 1
    In order for this to work, you will probably need to "uncompress" the PDF document. I use the free PDFtk toolkit for this, with the command: pdftk %inputfilename% output %newfilename% uncompress
    – Cahit
    Mar 15, 2023 at 17:48
  • After uncompressing the pdf file, you can then edit it in a text editor, and when done, use the same pdftk tool to compress it back to binary form. (This flow is also super helpful when you need to remove watermarks, etc.)
    – Cahit
    Mar 15, 2023 at 17:55
  • I found it necessary to use a hex editor (I used HxD). This also appears to only work for some PDFs, possibly due to compression as @Cahit mentioned. I found that pdftk unfortunately strips a lot of metadata (though this includes the JavaScript funnily enough). Jan 27 at 16:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .