Convert HTML to PDF using Aspose.PDF for .NET - implement timeout while converting

Hi,

I am using Aspose.pdf, and want to implement timeout while converting html to pdf.
We have html file placed on local drive, and i am using following code snippet to convert it.

        License license = new License();
        license.SetLicense("Aspose.Pdf.lic");
        HtmlLoadOptions options = new HtmlLoadOptions();            
        Document pdfDocument = new Document(currentPath, options);
        MemoryStream docOutStream = new MemoryStream();
        pdfDocument.Save(docOutStream, SaveFormat.Pdf);
        pdfBytes = docOutStream.ToArray();
        pdfDocument.Dispose();

I want if a document takes more than 10 minutes in conversion, then throw an exception/ or return with proper error code.
How I can achieve this functionality?

Thanks in advance.

@saba.asghar

Thank you for contacting support.

We would like to share with you that Aspose.PDF API does not support this feature at the moment. A feature request with ID PDFNET-44392 has already been logged in our issue management system. We will investigate the feasibility of interrupting the Save method and free utilized resources as soon as some defined time token expires. The issue ID has been linked with this thread so that you will receive notification as soon as the issue is resolved.

We are sorry for the inconvenience.

Thanks for the response.
I want to confirm 1 thing, the actual html to pdf conversion start on
Document pdfDocument = new Document(currentPath, options);
or on
pdfDocument.Save(docOutStream, SaveFormat.Pdf);
?
Both don’t have timeout mechanism yet?

Thanks again for your kind response.

@saba.asghar

We would like to share with you that the source file is loaded into Document Object Model (DOM) of Aspose.PDF API when path of file is specified in the constructor of Document Class. However, the conversion starts with Save method that saves the resultant document. Both of these methods do not support any timeout feature, at the moment.

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

Thanks it was really helpful.
I want to ask one more thing, I have read a mechanism to add bookmarks in pdf, but is there any way to have bookmarks in converted pdf?
something we can do with html to get book marks when it get converted…?
I could not find any topics on it. Kindly share if there is any method to achieve this goal.

Regards

@saba.asghar

Thank you for your kind feedback.

We would like to request you to always create separate posts for separate inquiries. However, HTML file format does not support bookmarks, thus you can add bookmarks to the generated PDF document and no such changes can be made to an HTML file for creating the bookmarks.

Please feel free to contact us if you need nay further assistance. We will be glad to help.

Thanks for the feedback.