Free Support Forum - aspose.com

Setting PDF meta data

I need to set meta data for the generated PDF after I convert it from DOCX.

Things like “read only”, created date, “created by” etc etc…
Setting password so it cannot be opened by unauthorized person etc.

Can you point me to the snipplets to do this
Thank you.

@nick1234

Thank you for contacting support.

Please visit below documentation articles for your kind reference and then share your kind feedback with us.

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

Thanks Farhan

One more question.
How do I convert the Aspose PDF document to MemoryStream

I work with memory stream. We dont persist file down to physical file…
So after I set the privileges on the PDF document, I need to return the updated document as a memory stream.

I tried this
BinaryFormatter bf = new BinaryFormatter();
pdfStream = new MemoryStream();
bf.Serialize(pdfStream, pdfdoc);
but didn’t work.

Thanks

@nick1234

The Document.Save method has different overloads which allow you to save the PDF document in a memory stream instead of physical file.

Document document = new Document();
MemoryStream stream = new MemoryStream();
document.Save(stream);

We hope this will be helpful. Please feel free to contact us if you need any further assistance.