Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello,

I need to create password protected PDF file in VB6.0.

How can i do this? any reference link, suggestion or source code?

Thanks.
Posted
Comments
CHill60 17-Feb-14 8:17am    
Are you already creating an unprotected PDF and if so, what 3rd party tools are you using to do that?
Sergey Alexandrovich Kryukov 17-Feb-14 12:02pm    
Any specific reason to mess with VB6, ever?
—SA
kk2014 18-Feb-14 0:24am    
Hello,

Yes I have already created unprotected pdf and I am not using any 3rd party tool.
with below code i am generating pdf file.

As I am working in VB6, i have to mess with it.

On Error GoTo ErrorHandler
Dim ObjWord As Word.Application
Dim objWordDoc As Word.Document

Set ObjWord = CreateObject("Word.Application")
ObjWord.Visible = True
Set objWordDoc = ObjWord.Documents.Open(DocPath)
objWordDoc.ExportAsFixedFormat OutputFileName:= _
sDests & sDestsPDFFile, ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:= _
wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _
IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _
True, UseISO19005_1:=False
'objWordDoc.Password = "ita@123"
ObjWord.Quit
Set ObjWord = Nothing
Exit Function


Thanks

1 solution

The reason I didn't respond to your comment is because you didn't use the Reply button against my comment so I didn't get any notification.

However, I note that you reposted this question and someone has answered it
is it possible to create password protected pdf file using visual basic6.0?[^] so posting this "solution" to clear the question out of the Unanswered Questions list.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900