Tools to Capture and Convert the Web

Why is creating PDF and Word documents in an app so difficult?

Thursday, April 30, 2020
Solve difficulties creating documents

Apps often need to create documents dynamically. One way to do this would be to use a specialist library such as the Microsoft Office Interop Word to build the document piece-by-piece.

Unfortunately using such a library means that the document content is tied to the library used to produce it. As most libraries used to create documents require content to be encoded into an object structure unique to that library.

Therefore if an app has to produce a document in PDF, which is then later required in Microsoft Word. The code required to convert the document would need to be done in two significantly different ways.

Fortunately, we already have an independent format that represents documents, this is of course HTML! If you combine HTML with CSS the document can be formatted in any way you require.

This is a game-changer because knowledge of HTML is already wide-spread. Meaning there is no large learning curve, allowing a web developer to create what they want in a local HTML file. Viewing it in a browser get it just right.

However, there is one thing missing from being able to free the document content from its implementation. That is, of course, a system that can convert HTML into PDF and DOCX.

GrabzIt provides such a system, using GrabzIt’s API an app can convert any HTML into the required document format.

This makes producing the document in different formats in the future much easier. As often happens in business for example, when a user requirement could request that a PDF-only report should now also be available in Word. Of course, that same HTML could also be converted into other supported formats as well like PNG, WEBP and JPEG.

Once a developer has the HTML document just right the parts that change regularly can be replaced with variables, to create a template that can be easily used in future conversions.

All of these features and more can be added to your app using GrabzIt's API. Or you can use these features independently of your app with the Screenshot Tool.

View the latest blog posts