views:

250

answers:

3

Hi all,

I've been using Delphi and the Adobe Acrobat 9 API. I'm simply opening a PDF and printing it, followed by closing it without saving anything.

I'm having an issue while opening some PDFs though. If the PDF is password protected the Open method displays Adobe's "Input password" prompt. My application is running in an automated fashion, and therefor cannot proceed beyond this password prompt until somebody clicks cancel.

I've been looking for something that will either notify me that the file is password protected prior to opening it, or a parameter or something that will skip password protected files. I need my program to assume it cannot open any passworded PDF.

Does anyone know enough about the Acrobat API to provide any assistance here?

Thank you, Ryan

A: 

Anyone? I still have yet to figure this out.

Ryan
+1  A: 

How about detecting whether the PDF is secured first before trying to open it?

Dwight Kelly
That was my question. How do you do that?
Ryan
after a little more research, there is NOT a method to skip opening a password protected PDF using Acrobat. It would be possible to use another tool to determine if the file is password protected prior to attempting to open it in Acrobat.Xpdf has a tool called pdfinfo,Apago has a commercial tool called PDFspy (http://www.apagoinc.com/pdfspy),or develop your own with iText, PoDoFo, etc.
Dwight Kelly
+1  A: 

I had a similar issue where I needed to find out if printing was allowed before doing a print commnad on the PDF. The API does not complain and the print function returns success even though the PDF file does not allow for printing. I wrote a solution a while back by writing an Adobe plug in. If it's not out-of-the box, you 'll need to write a plug in.

macondo