We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Setting custom properties in Pdf.Generator


I am creating a pdf document from html string using pdf.generator.pdf class. After that, I have to add some standard properties and some custom properties. With standard properties it is very easy, but I have no idea how to set custom properties.

var pdf = new Aspose.Pdf.Generator.Pdf();

pdf.Creator = “My Namev”;
pdf.Title = “My Title”;
string mycustomkey = "my key"
string mycustomvalue = “myvalue”
??? How can I set custom values here?

I do understand that it is possible to switch to pdf.document class and use Info field, but it requires additional saving and reading from file - I want to avoid it because I am working on a big array of files.
Will appreciate any ideas
Thank you,

Hi Alexei,

Thanks for contacting support.

I am afraid you cannot set custom properties while creating PDF documents. However with Document class, you can add custom values. Furthermore, please note that Aspose.Pdf.Document class also supports the feature to Convert HTML to PDF Format.

I would also suggest you to please take a look over this blog post.

In the event of any further query, please feel free to contact.


In my case there is a problem with pdf.document class:

At the point where I have to create a document, i may not have a html string. For example sometimes I have an empty document but with properties set. With pdf.generator, I can use builder to add html when I need it. With pdf.document, it looks like I have to CREATE a document based on html string:

Document doc = new Document("input.html", htmloptions);

My question now will be:

Can I create an EMPTY pdf.document object and add my html content later?

Thank you,


Hi Alexei,

Thanks for your inquiry. I am afraid currently Aspose.Pdf.Document(DOM approach) renders HTML document to PDF document, but it does not support to add HTML contents in PDF document at the moment, as you are including HTML using Aspose.Pdf.Geneartor namespace. We've already logged this feature request as PDFNEWNET-35804 in our issue tracking system. We will update you via this forum thread as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regard,

The issues you have found earlier (filed as PDFNEWNET-35804) have been fixed in Aspose.Pdf for .NET 9.5.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Alexei,

Thanks for your patience. As stated above PDFNEWNET-35804 is also resolved and now you can add HTML string in new/existing document using new DOM approach. Please check following documentation link for the purpose. It will help you to accomplish your requirements.

Please feel free to contact us for any further assistance.

Best Regards,