Slow PDF file creation issue using Gembox.Document

Hello.

I have a code that creates word document using Gembox.Document package and it works quite well. But when I try to save it as PDF using the same Save method but with PDF Save option, it takes a lot of time to create a pdf file (for at least one hundred thousands records); sometimes it also causes crushes and memory leaks.

How to solve the problem?

Thanks.

Hi Tamir,

Please create a small Visual Studio project that we can use to profile your execution.

Also, I should point out that saving to PDF, XPS, or image format requires more time and memory than saving to DOCX, RTF, or HTML format. The reason is that when saving to a fixed document type, GemBox, the document needs to paginate the content (calculate positions and sizes of document elements on the page) and render it (draw content).

Regards,
Mario

How can I simplify the page styling design to make it less heavy and faster?

A code snapshot will be appreciated.

Prefer to reuse the named styles from the DocumentModel.Styles collection rather than setting direct formatting on the document elements.

Also, avoid using floating layouts on Table; prefer using an inline layout in general.

I hope this helps.