0

I'm trying to copy the text from a PDF into Excel. Problem is the PDF is password protected disabling the copy function. The text can easily be copied used Windows XPS viewer, Onenote, and other methods. I need the PDF to stay in PDF format because I have a program that pulls data from the PDF. So my original thought was to open my protected PDF and print it as another PDF to copy the text.

So I tried following the previous asked question here: How to remove security from a PDF file?

And it's posted several times over the internet so I assume it works for others. However, when I remove everything starting with "mark currentfile eexec...cleartomark" save, and distill with Adobe, I receive the error from the Adobe distiller:

%%[ Error: undefined; OffendingCommand:  ]%%
%%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
%%[ Warning: PostScript error. No PDF file produced. ] %%

I tried to research the error, but the OffendingCommand:  doesn't seem to be a popular one.

The steps I've taken for this process:

  1. Open Password Protected PDF
  2. Choose PDF print driver, check print to file
  3. The .ps file is created. I used Notepad to open and edit the .ps file and remove the "mark currentfile...cleartomark" text.
  4. Save
  5. Double click on file with automatically runs Adobe Distiller and I get the message above.

Any help on what I'm doing wrong? Or other ideas? I'm not at liberty to try a third party software in fully removing the password.

P.S. I had read that Adobe, in trying to print to a file creates a temp file that can sometimes be renamed ".pdf" to make it a PDF. Would this be applicable in this case? Which Temp folder would this be in? I tried searching my computer but could not find a like-sized file/files I did try did not work.

kaymteo
  • 1
  • 3
  • If the document allows printing, you may be lucky. In some projects, running on Mac, we use a generic PS printer (driver), and then access the print spooler, and retrieve the spool file to rename and push it into Distiller. The path would be /var/spool/cups in this case. However, we never tested it with protected files. – Max Wyss Mar 18 '15 at 19:32
  • The document does allow for printing. I am running windows 7 with Acrobat X Pro. Would you mind explaining a bit more of how you accomplish that? Would the PDF driver be a generic PS driver? – kaymteo Mar 18 '15 at 19:43
  • Since I can't edit anymore....If I could do what you suggested with windows, that sounds like It would work. – kaymteo Mar 18 '15 at 19:52
  • On Windows, you can use the AdobePS driver; it is only on Mac that the one UI step creation of PDF using the Adobe PostScript printer linking to Distiller no longer works. It is a hack, but worth the try. – Max Wyss Mar 18 '15 at 20:36
  • Thanks for the info. Do you know how to access the print spoiler and retrieve the spool file in windows? – kaymteo Mar 18 '15 at 22:13
  • It would appear as I go to print using the Adobe PS driver, a shockwave flash file is created in the spooler. I'm not sure how to go from a shockwave file to .ps or .pdf. – kaymteo Mar 18 '15 at 22:30
  • Not much help on the print spooler location. About the Flash file in the spooler, is it a Flash file, or does it say it is one? Make a copy of it and rename it to the suffix .ps and feed it into Distiller; what happens? – Max Wyss Mar 19 '15 at 08:02
  • You were right...renaming the shockwave file to .ps worked. However,the postscript still has the "mark currentfile eexec....cleartomark" injection. So the distiller will not work. When I remove that line of code I receive the same Error undefined as shown above. Im thinking there has to be some other protection in the postscript somewhere. – kaymteo Mar 19 '15 at 14:00

1 Answers1

0

I figured it out. Use Notepad++ and not Notepad. Notepad changes things as I saved the edited .ps which caused problems when trying to use ghostscript.

kaymteo
  • 1
  • 3