Free Support Forum - aspose.com

Convert password protected document to pdf


#1

We want to convert password protected document into pdf . Without asking password form the user .Is their any solution available.?


#2

@gauravbhandari,

Thanks for your query.

I am not sure if you can load a password protected document without specifying a correct password via Aspose APIs object model. Even how could you open an encrypted document into MS Office (Word, Excel, Powerpoint) application without giving a correct password manually? Anyways, please provide details about your input document and attach the sample document here, you may zip the document prior attaching.


#3

So what is the process to convert password protected document?


#4

@gauravbhandari,

As requested earlier, please provide details about your input document and attach the sample document here, you may zip the document prior attaching. We will check it soon.


#5

DOC file before conversion.zip (224.5 KB)
Attached document is password protected MS word document.


#6

@gauravbhandari,

Thanks for the document.

I am afraid, you have to use the password to load the file into Aspose.Words’ Document object model.
MS Word does the same, it cannot open an encrypted file with a correct password.
In short, you have to give password to import the document as shown below:
e.g
Sample code:

Document doc = new Document(MyDir + "Document.LoadEncrypted.doc", new LoadOptions("password"));

doc.Save("output.pdf"); 

In the event of any other query, let us know with details.


#7

Thankyou i will try to implement


#8

@gauravbhandari,

Yes, you need to specify the correct password while loading your document as demonstrated by the sample code. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.