How to print protected PDF files that does not allow printing?

One easy workaround on PDFs that does not allow printing is to use a macro to save a screenshot of each page into an image file. Then, you can easily insert the word files in the right order (each taking a separate page) and print them out with very decent quality.

To automatically save each page of a PDF into a seperate image file, you can use a Windows automation tool called AutoHotKey. AutoHotKey allows you to script automatic key strokes (keyboard and mouse), manipulate the clipboard and much more. (Download and install AutoHotKey here.)

Here’s the steps to automatically and easily save screenshots of an entire PDF:

  1. Download and install AutoHotKey
  2. Paste script into AutoHotKey
  3. Reload AutoHotKey so it loads the script into the program
  4. Open the PDF, start on the first page you want to start printing
  5. Replace line 4 “Loop 20” with the number of pages to be copied. So, it will end up as “Loop [# of pages]{“
  6. Make sure the path you are saving to (Line 6) is valid and actually exists.
  7. Press Cntrl+Alt+z to run the script. (This is what Line 1 means)
  8. After all the images are saved, make sure that no pages are missed.
  9. Open Word, insert all the images in the correct order, with each image occupying page.
  10. Save. The file is now printable.

Below is the AutoHotKey script that will start saving each page of the PDF:

^!z::
Page := 1

Loop 20{
  SaveClip := ClipBoard
  FileNameAndPathName := A_Scriptdir . "Pdf" . Page . ".jpg"
  Send, {AltDown}+{PrintScreen}
  Sleep, 300
  Send, {AltUp}
  Run, mspaint
  Sleep, 500
  WinActivate, Untitled - Paint
  Sleep, 300
  WinWaitActive, Untitled - Paint
  Send, ^v
  Sleep, 300
  Send, {AltDown}f{AltUp}a
  Sleep, 400
  Send, %FileNameAndPathName%
  Sleep, 300
  Send, {Enter}
  Sleep, 300
  Send, y
  Sleep, 300
  Send, {AltDown}f{AltUp}xn
  Sleep, 600
  SendInput, {PgDn}
  Sleep, 700
  Page := Page + 1
  Sleep, 500
}

return

Notes:

  • If a PDF file takes too long to load the next page, AutoHotKey will not capture it. So make sure the PDF does not have any pages that takes too long to load. The script currently allows 0.7 seconds for loading the next page. If it takes longer, adjust the “Sleep, 700” to a higher number. Note that the seconds is in milliseconds. So, 700 = 0.7 seconds
    • More to this point, you can quickly scroll through all the pages so that your computer can pre-load all pages ahead of time or know the problem pages.
  • AutoHotKey takes over the keyboard and mouse. So while you run it, you cannot be using your computer.
  • It is recommended that you spend some time on the AutoHotKey syntax to familiarize in case of any bugs or changes.
  • This is tested only on Windows XP, may need modifications on Windows 7 and Vista
  • You can do the same thing using the input control functions in Excel VBA, but I just happen to use AutoHotKey script for this

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>