We ❤️ Open Source

A community education resource

5 min read

Automatically generate beautifully styled PDF files for contracts, approval notices, and project orders

Learn how to quickly and easily create PDF documents with OpenProject.

Successful teams always challenge the status quo and seek improvements. Top performers focus on high-value activities that contribute to project success—they avoid repetitive low-value tasks and invest their time in automation instead. They feel frustrated when they have to waste time identifying the latest version of a document. These individuals are irritated when they need to manually adjust styles in MS Word documents.

At OpenProject, we are passionate about automation. We dedicate all our energy and time to enhancing OpenProject, which means automating all repetitive tasks. It’s a pleasure to make these automation functions available to all OpenProject users.

This motivation led us to develop the automatic generation of PDF reports as part of the openDesk initiative in 2023.

The feedback from our users has been overwhelmingly positive, so we decided to invest further in this area.

We are currently developing a feature that allows teams to automatically create contracts, formal approval notices, and project orders.

Separation of content from styling

The inherent issue with MS Word or LibreOffice Writer is their flexibility and extensive formatting options. Ensuring consistent styling across multiple documents can be a lot of work, leading skilled professionals to waste valuable time harmonizing styles.

One solution to this problem is to use content editors and markup languages such as CommonMark. The idea is to provide authors with a standardized set of notations used to annotate a plain-text document’s content, offering information on the structure of the text or instructions on how it should be displayed.

These markup languages are widely used for blogging, documentation, and collaborative text creation—this blog article, for instance, is written in Markdown. The advantage is that authors can focus on content without worrying about formatting, as styling is handled separately in style sheets. This centralizes all styling information in one place.

Establishing a single source of truth

Having a single source of truth is crucial for process automation. All development activities in OpenProject revolve around this principle, whether it’s time tracking, dynamic meetings, or sharing work packages.

To automate the creation of project artifacts, we first considered how to establish a single source of truth. To establish a single source of truth we identified four key levels:

Single source of truthMappingExample
1Content templateDefault description texts for work packages typesNDA contract template
2Text formatting and stylingStyle sheetsLogo, font, colors, text formatting
3Contract input parametersWork package attributes added through macrosParties or contract date
4Status informationWork package status workflowsManager that approved the contract

Automatic creation of PDF files

In 2022, we open sourced the library md-to-pdf, which we internally used to automatically create PDF documents for the Data Processing Addendum (DPA).

We have now integrated the capabilities of this library with the collaborative features of work packages. This feature allows anyone to quickly and easily create PDF documents from work package descriptions. The input parameters are added through macros, so users only need to enter their input into the work package attributes.

Here is a screenshot of the current development status. The feature is still under development at the time of publishing this article, so changes may occur before its release:

OpenProject contract example screenshot

And this is what the generated PDF looks like in the current development version:

Generate PDF vs. download PDF: The upcoming feature will be called “Generate PDF”. It will be added to the current user options for work packages (via drop-down menu), including the “Download PDF” option. As mentioned above, downloading a PDF refers to the entire work package, while generating a PDF refers only to the description of the work package.

Example: Create a contract

Suppose you want to quickly create a new Non-Disclosure Agreement (NDA) with a business partner.

All you need to do is create a new work package of the type NDA. Then enter the input parameters into the corresponding work package attributes. The entered attributes are automatically added to the work package description through macros such as:

workPackageValue:signature-date
workPackageValue:first-name
workPackageValue:last-name
workPackageValue:company

Click on “Generate PDF.” Voilà—the contract is ready to sign and can be sent to the business partner for signature.

Possible next steps

We are currently exploring several possibilities:

  • Automatically storing the generated PDF files in cloud storage providers such as Nextcloud or SharePoint/OneDrive.
  • Offering more configuration options for file-naming conventions.
  • Adding form fields for e-signatures.
  • Creating additional default styling templates with more advanced document structures.
  • Providing more configuration options such as custom fonts.
    Integrating with e-signature solutions.

What do you think?

Will this feature help you in your daily work? What else would you need to simplify the creation of project artifacts and legal documents? Please share your thoughts in this feature discussion.

If you’re already using OpenProject, stay tuned for upcoming releases where we will enable this feature.

More from We Love Open Source


This article is adapted from “Beyond MS Word: Automatically generate beautifully styled pdf files for contracts, approval notices and project orders” by Niels Lindenthal, and is republished with permission from the author.

About the Author

Niels Lindenthal is co-founder and CEO of OpenProject. His enthusiasm for free and open source software and open collaboration drives him to continuously enhance OpenProject as a leading tool in the industry.

Read Niels Lindenthal's Full Bio

The opinions expressed on this website are those of each author, not of the author's employer or All Things Open/We Love Open Source.

Contribute to We ❤️ Open Source

Help educate our community by contributing a blog post, tutorial, or how-to.

Register for All Things Open 2024

Join thousands of open source friends October 27-29 in downtown Raleigh for ATO 2024!

Open Source Meetups

We host some of the most active open source meetups in the U.S. Get more info and RSVP to an upcoming event.