PDF Document Generation

Content Type: Module
Categories: Utility,Import/Export

Overview

The Document Generation module allows you to generate pixel-perfect PDF documents based on regular pages in your app. Make use of the full capabilities of the page editor, including the use of snippets, text templates, conditional visibility based on expressions, dynamic classes, etc. Add any existing web widget from the marketplace to your documents, or create your own.

Documentation

Please see Document Generation in the Mendix documentation for details.

Releases

Version: 1.3.0
Framework Version: 9.18.0
Release Notes: - We added “Mendix for Private Cloud Connected” to the supported deployment types. Note that we only support apps that allow bi-directional communication with the PDF Service in the Mendix Public Platform. - For registering your app environment(s), we now require a personal access token (PAT) instead of your developer API key. The PAT can be created in your Developer Settings in the Mendix Developer portal. For the scope, select 'mx:deployment:read' of the applicable deployment type. Existing app environment registrations stay valid after the module update, you do not need to re-register your app. Known issues: - When testing the PDF document generation locally using Chrome or Chromium version 117 or 118, the scaling of your PDF document might be different compared to generated document from the PDF document generation service that is using Chromium version 112 in the Mendix Public Cloud. This issue has been fixed in Chrome version 119, we recommend to update to the latest Chrome release if you run into this issue.
Version: 1.2.1
Framework Version: 9.18.0
Release Notes: - We aligned the behavior between the local service and the online service, so that redirects to external URLs are no longer allowed. Known issues: - When testing the PDF document generation locally using Chrome or Chromium version 117 or 118, the scaling of your PDF document might be different compared to generated document from the PDF document generation service that is using Chromium version 112 in the Mendix Public Cloud. This issue has been fixed in Chrome version 119, we recommend to update to the latest Chrome release if you run into this issue.
Version: 1.2.0
Framework Version: 9.18.0
Release Notes: - We included a migration file for the Java dependencies for Studio Pro 10 compatibility. Known issues: - When testing the PDF document generation locally using Chrome or Chromium version 117 or 118, the scaling of your PDF document might be different compared to generated document from the PDF document generation service that is using Chromium version 112 in the Mendix Public Cloud. This issue has been fixed in Chrome version 119, we recommend to update to the latest Chrome release if you run into this issue.
Version: 1.1.1
Framework Version: 9.18.0
Release Notes: - We fixed incorrect module version logging. - We fixed a consistency error of an unsupported design property when `ExampleDocument` page was included in the project. - We fixed an issue when generating a document returned a timeout if you also configured the Mendix Runtime custom setting `ApplicationRootURL` to a custom domain. Known issues: - When testing the PDF document generation locally using Chrome or Chromium version 117 or higher, the scaling of your PDF document might be different compared to generated document from the PDF document generation service in the Mendix Public Cloud. We are currently looking into this issue and we advice to use the Chromium version mention in the Chromium paragraph to guarantee locally the same result as from our PDF document generation service. Please refer the documentation "https://docs.mendix.com/appstore/modules/document-generation/#312-chromium" for more details.
Version: 1.1.0
Framework Version: 9.18.0
Release Notes: Note: This GA release contains breaking changes when migrating from the public beta version (v1.0.0). New Features: - We now apply the same styling that is used in your web browser when exporting a page to PDF, instead of print-specific styling. This means that your PDF documents are even closer to what you see in the browser or when using ‘Design mode’ in Studio Pro. - The class `document-generation-body-injected` is injected by the document generation service to the body element of your page. You can use this class instead of `@media print` if you want to re-use the same page for web and PDF documents, but apply some specific styles to the PDF document only. - We introduced two new design properties to the `Container widget` to help structure your documents: - Add page break: This design property enables you to force a page break before or after the specific container widget. - Avoid break inside: This design property allows you to prevent page breaks within a specific container. This can be useful to keep widgets grouped together on the same page. - We introduced the `$document-background-color` theme variable to configure the default background color of your PDF documents. - Note: When using Studio Pro 9.24.4 or lower, the background color that is set using this variable is not previewed correctly when using ‘Design mode’. Improvements: - We now use the time zone of the user that is passed in the `Generate as user` property for the localization of dates and times. If no time zone is configured for this user, it will use the default time zone as set in the App Settings. If the default time zone is not set, then the dates and times are displayed using UTC. - We have increased the maximum file size of a PDF from 10 MB to 25 MB per document. If your document exceeds this limit, the action will result in a timeout. - We no longer require Create and Write access rights for the user that is set for the ‘Generate as user’ property of the microflow action. - Note that setting the microflow property ‘Apply entity access’ to ‘Yes’ does not have any effect here. Regardless of the setting, the action does not require Create or Write access rights for the `FileDocument` object that gets created. - We removed the dependency on the FieldSet widget. - We removed the RedirectLayout from the module. - We removed the constants `UseCustomApplicationUrl` and `CustomApplicationUrl`. The document generation service now uses: - When running locally from Studio Pro: The Application Root URL as configured in the App Settings. - When running in the Mendix Cloud: The App URL as registered during the app environment registration. Breaking changes: - As we now apply the same styling that is used in your web browser instead of print-specific styling, you can no longer use the `@media print` media query to apply specific styles to the PDF document only. Use the `document-generation-body-injected` or `document-content` classes instead. - We have improved the mechanism that determines when the page has finished loading. We now wait until there are no more pending network requests. - Note: widgets or add-ons (for example a script in your `index.html`) that perform long polling network requests, are no longer supported. - We renamed the `DocumentLayout` layout to `DocumentGeneration_Default`. - When migrating from the public beta version, update the layout for all pages that are currently using `DocumentLayout`. Do not forget to set the design property `Enable PDF export` to ‘Yes’ for each page. - The use of this layout is no longer required. You can now use any layout of layout type `Responsive`, or create your own layout, as long as the layout does not include a scroll container. Layouts that do include a scroll container, such as `Atlas_Default`, will result in incomplete content. - We introduced a new design property `Enable PDF export`. Set this property to ‘Yes’ for any page that you want to export as a PDF using the module. - Note: setting this property is required. When migrating from the public beta version, do not forget to set this property for all pages that previously used the `DocumentLayout` layout. - We renamed the widgets that are included in the module. When migrating from the public beta version, remove the previous versions of the widgets by deleting the files below from the `widgets` directory of your app, and update all affected pages to use the new widgets. - Delete the file `mendix.DocGenRedirect.mpk` from the `widgets` directory - Delete the file `mendix.PageBreak.mpk` from the `widgets` directory - We renamed the theme variable `$default-margin` to `$document-section-padding`. To set the page margin of your documents, we recommend to set this using the `@page` rule in your stylesheet. - We renamed the `remove-margin` classes in the module stylesheet to `remove-padding`. If you are using one of those classes in your documents, update them accordingly. Known issues: - When testing the PDF document generation locally using Chrome or Chromium version 117 or higher, the scaling of your PDF document might be different compared to generated document from the PDF document generation service in the Mendix Public Cloud. We are currently looking into this issue and we advice to use the Chromium version mention in the Chromium paragraph to guarantee locally the same result as from our PDF document generation service. Please refer the documentation "https://docs.mendix.com/appstore/modules/document-generation/#312-chromium" for more details. Fixes: - We now support apps that include a Responsive Web Offline navigation profile. (Ticket #190165) - We removed incorrect Dutch translations from the registration snippet.