Document toolboxDocument toolbox

6.1. Quick start

Getting started

You can drag the widget, sorted under ‘Add-ons’ on a page and follow the configuration below to get started.

Configuration

You can create your own logic and domain model to fit your application needs. For demostration purposes we created an InputExample and OutputExample entity, both specializations of System.FileDocument. We created a 1-1 association between the two entities, but this is not necessary.

image-20240725-134516.png
  • The InputExample entity is the original PDF Document you want to use in our PDF Kit.

    • AnnotationJSON attribute is used to store the annotations that are created in our PDF Kit. These are stored as a string and are parsed in the widget. This attribute is required if you want to use annotations separately and want to keep the original PDF document untouched.

    • Base64 is used within our PDF Kit widget to flatten the PDF document and the annotations. This is required if you don't want to use the annotations separately but want to bake the annotations in the PDF document. This is not reversible.

  • TheOutputExample entity is where the flattened PDF document with annotations is stored. You will need to create a microflow that converts the Base64 attribute to a System.FileDocument object. Below is an example:

    image-20240725-140243.png

     

It is important to understand the function of the AnnotationJSON. You need this attribute if you want to add annotations to a PDF Document that you want to edit in the future. If you do not provide this attribute, the widget does not have a place to store the annotations. So if you want to have a PDF Document with annotations that are editable, you need to store them in this attribute.

As for the Base64 attribute, you will need this if you want get the flattened PDF Document (with annotations baked in) and use it in your Mendix application. If you just want to download the flattened PDF Document, you can just click on the ‘Export’ button in the toolbar. You need to make sure this is enabled (See toolbar configuration below).

But for example, if you want to add annotations and mail the PDF document with annotations somewhere, you will need store the Base64 and add a microflow that stores said Base64 in a System.FileDocument.

Toolbar configuration

You can enable or disable certain functionalities of the PDF Kit toolbar here.

License

Experimenting with the PDF Kit widget locally on your PC or within a Mendix sandbox environment doesn't require a license. However, a license is required for a production build.

Though without a license token you will get a watermark on your PDF Document.