Is there a way to identify whether a PDF file is printable using VB.net

vijaya

New member
Joined
Aug 5, 2005
Messages
1
Programming Experience
5-10
Hi,

I just need to know, if the PDF file is printable or not. But not finding any properties to do so in "AcroExch.App"/"AcroExch.PDDoc"/"AcroExch.avdoc" object(s).

Is there any other way I can achieve this?

Also, if it is printable, I need to know if it needs a password to print.

I need to seperate pdf files
1.Which I am able to open and print
and
2.Those which are open/print protected.
Any comments or solutions are welcome.

Thanks in advance
Vijaya


My code is as below
----------
acrobatAVDoc = CreateObject("AcroExch.avdoc")
If acrobatAVDoc.Open(lFile.FullName, "") Then
'able to open
If acrobatAVDoc.PrintPages(1, 1, 1, 1, 1) Then
'able to print
MsgBox("Able to print")
Else
MsgBox("Unable to print")
End If
Else
MsgBox("unable to open")
End If
---------------------
This code actually ask for the password if the PDF is password protected for either opening or printing. and also it physically prints the document if it is not password protected for printing.
I want to just know if its printable without providing any password, I dont want to print it.

Thanks
Vijaya
 
Last edited:
This might help u

Hello,

I found the VB example on the SDK and managed to port it to .NET pretty cleanly, I got rid of all of the COM stuff except for the References to my Interop.Acrobat.dll and AFORMAUTLib.dll.

In my .NET application, I can create and manipulate form objects in my .PDF files, but when I try to print them nothing comes out. Here's my code:

--- Begin Code Snippet ---
Private Sub WorkWithExistingTemplateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WorkWithExistingTemplateButton.Click

Try


StatusBox.Text = "Opening PDF Document..."

' Open the sample PDF file
avDoc = CreateObject("AcroExch.AVDoc")
bOK = avDoc.Open("C:\test.pdf", "Forms Automation Demo")

'If everything was OK opening the PDF, we now instantiate the Forms
'Automation object.
If (bOK) Then
formApp = CreateObject("AFormAut.App")
acroForm = formApp.Fields
Else
avDoc = Nothing
MsgBox("Failed to open PDF Document. Aborting...")
End
End If

'Update the status box
StatusBox.Text = "Populating Form Fields..."


field = acroForm.Item("accountnumber")

field.Value = "123456789"

field = acroForm.Item("businessname")

field.Value = "John Doe's Plumbing"


field = acroForm.Item("authsigner1")

field.Value = "John Doe"

avDoc.PrintPages(1, 1, 1, False, False)


Catch ex As Exception
MsgBox(ex.Message)
Finally

End Try
End Sub
--- End Code Snippet ---
 
where can i get the sample?

Unfortunately I haven't got the SDk or not too sure how to access, could someone point me to a place on the internet i can get the original sample project above in vb.

all help will be appreciated
 
Back
Top