Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working with PDFs

Status
Not open for further replies.

strangeryet

Programmer
Jul 8, 2004
159
US
Hello,
One of our operators has a daily task that I was wondering if and how it could be automated to help them during this process. Let me explain.

We receive a CD that contains PDF files. Each Pdf file needs to be opened with a password, have the security removed, saved and moved into another folder that will eventually be imported into our documentaion management system.

How can I open a pdf,(using the password), remove security and save the PDF? Thanks!
 
Manipulating PDF is not a trivial task. First there are two password possibilities... user password and owner password.

To modify security you would have to be the owner of the doc which, if you are now doing manually, shouldn't be an issue. How is the operator doing it now? What software are they using to modify the PDF's?
 
thanks Tom,

They are using Adobe Acrobat Professional.
They click on the PDF, it asks for the password, they supply the password and then remove security in order to process into our documentation archive system.
Ideas?
thanks
 

Not very *elegant* way, but it may work for you.....

You said: "They click on the PDF", I take it: "They click on the PDF file in Windows Explorer"

To open a file with default file association:
Code:
Option Explicit

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
    ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

[green]'Then call it like this:[/green]

ShellExecute(0&, "open", sFileName, vbNullString, vbNullString, vbNormalFocus)

Or, start any file;
Code:
Public Sub OpenDocument(strDocPath As String)

Dim G As Long
G = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & strDocPath, vbNormalFocus)
    
End Sub
And to provide a password, and Save PDF AS in a new location, you may use [tt]SendKeys[/tt] in VB 6 (That's the NOT *elegant* part) :)



Have fun.

---- Andy
 
If the operator has a fiull version of Adobe Acrobat Professional they should have access to an ActiveX control called AcroExch which should give you an automation interface to Acrobat and to PDF documents
 
That's right, strongm.
Alas, I've looked at the AcroExch object catalogue and googled and all. There is no "password" parametre when opening a PDF via AcroExch.
[ponder]



[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
AcroExch library contains the PDDDOc object, which has the GetJSObject method, which returns an interface to the document's JavaScript API. The JSO gives access to the security stuff (since Acrobat 5). As far as I recall. But I've never really used it.
 
That's true, it does. But the document needs to be opened first. The way I read the OPs post is that the password needs to be entered in order to be able to open the doc.
Each Pdf file needs to be opened with a password,

Don't have access to Acrobat Professional at the moment, so I can't test whether this is no issue with AcroExch, but I would expect it to error out on opening.


[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Yes, that is true. They need to enter a password that will allow the document to be displayed.
So what is the general consenses on AcroExch? How is that used anyway? I've never seen it.
 
strangeryet - Here is some reference material I found yesterday while looking into this problem, it should give you a bit more info about AcroExch.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.

 
But it all seems pretty convoluted just to open a passworded document ...

The basic principle seems to be getting hold of the JSObject (you need a dummy base PDF, from which you can then open further documents, i.e the password protected ones), then ensuring that you are using the "Encrypt With Password" security policy (SP_STD_default), detemine its security handler, and login to it (hurrah, this should be where we can supply the password)

Ok course this is all supposition. It isn't really my are - and it isn't really a VB problem. You probably want to ask in one of the Acrobat forums ...
 
strongm said:
But it all seems pretty convoluted just to open a passworded document ...
After reading both the links we posted it really does...

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top