Products Technologies Demo Docs Blog Support Company

Why Generating PDF Documents Server-Side

A good, safe and reliable strategy to create documents in web applications is to generate them server-side. This article explains why this is a better strategy than using tools to generate documents directly in the browser.

Why Generating PDF Documents Server-Side

Creating PDF documents is a very usual task in all kinds of web applications. A typical architectural question is where to create the PDF document: Server-side or client-side directly in the browser?

Server-Side or Client-Side?

While it might be useful and unproblematic to create PDF documents with non-sensitive data client-side, when it comes to professional documents with valid, traceable data such as in invoices or reports, server-side document processing is a necessary requirement.

Open source and commercial libraries (or hybrids) can be used to create PDF documents directly in the browser. When considering a requirement in where an HTML blog entry or article should be offered as a PDF download for instance, this serverless, client-side approach is feasible and probably a very good option. The data in an article is not sensitive (in most cases) and it doesn't really matter, if content is altered by the user client-side before the document is created.

The following key aspects of why a server-side generation is the better option in business applications are explained in this article:

  • Security
  • Digital Signatures
  • Layout

Security First

The scenario is different when generating an invoice or any other business critical document in web applications. Consider a portal where users can see their orders and payment information. Developers might be tempted to generate a PDF from the HTML data to provide a downloadable invoice. As a developer, you have no control over what the user is doing client-side or how the document is generated. Client-side generated documents are unusable for business purposes as the data (and layout) cannot be validated. Just like the HTML DOM in the browser can be modified (F12 developer tools), the PDF generation could be altered and manipulated, too.

Reading Tip: Building an Invoice Portal

Deploying invoices is a critical process in a company to get paid on time and also to provide clients a perfect user experience. Decreasing the barrier to access, share and dispute invoices is a key aspect.

Invoice Deployment Strategies: Building an Invoice Portal

Control the Data

When creating documents server-side, developers have full control over the document generation process, the validation of the merged data and the layout of the created document. Back to the invoice example, the data that is merged into a template, comes in most cases from an ERP system or at least a business object that has been created from data of a connected system. This process can be fully controlled beginning at the query of the data to the generation of the document and can be validated internally.

The following animated diagram shows a typical document generation process that uses data from an ERP system to create a digital invoice with machine-readable data as an attachment in the PDF document.

Digital Signatures

In many cases, generated documents are signed digitally to guarantee that the document has not been modified and that the entity who claims to have authored the PDF document is actually the entity who generated the document.

When creating documents client-side, you might be able to sign the document with a certificate - but in this case, you would have to provide the certificate (potentially with a password) to the client to be able to sign the document. For obvious security reasons, this approach is not feasible and would be a dangerous strategy. Documents that have to be signed must be generated server-side in a safe and reliable environment.

Pixel-Perfect Look & Feel

Most client-side libraries provide a template construction based on HTML/CSS content. This might be obvious from a developer's perspective as it is easy to create an "okay-looking" PDF document with HTML and CSS. But what if sophisticated documents with headers and footers, sections and other complex word processing features is a requirement to match the corporate identity or government, legal requirements? Also, end-users are not familiar (or most) with HTML and CSS and it is not possible to provide them an easy way to create or modify templates.

Using MS Word templates or a true WYSIWYG, browser-based document editor, provide a way to generate professional, pixel-perfect PDF documents. Technically, an MS Word compatible template is used and merged with data to create the PDF document.

Create Adobe PDF Documents

Learn how to integrate PDF workflows into your business applications. TX Text Control is used to cover the complete PDF document workflow from creating the document to processing incoming documents in business applications.

Create and Process Adobe PDF Documents

Next Steps

Our libraries - built around our core technologies - help developers add deep functionality document processing to web, mobile, cloud and desktop applications.

TX Text Control is used to cover the complete PDF document workflow from creating the document to processing incoming documents in business applications. Combined with the powerful template-based document creation engine, TX Text Control provides developers the complete solution to handle PDF documents in business processes.

Learn more about our technologies or contact our engineers - we are always happy to help.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

ASP.NET

Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

ASP.NETASP.NET CorePDF

Validate Digital Signatures and the Integrity of PDF Documents in C# .NET

Learn how to validate digital signatures and the integrity of PDF documents using the PDF Validation component from TX Text Control in C# .NET. Ensure the authenticity and compliance of your…


ASP.NETASP.NET CorePDF

Validate PDF/UA Documents and Verify Electronic Signatures in C# .NET

The new TXTextControl.PDF.Validation NuGet package enables you to validate PDF/UA documents and verify digital signatures directly in your code without relying on third-party tools or external…


ASP.NETASP.NET CoreC#

How To Choose the Right C# PDF Generation Library: Developer Checklist

To make your choice easy, this guide provides a systematic evaluation framework for two library categories: basic and enterprise PDF libraries. It covers matching features to use cases, evaluating…


ASP.NETASP.NET CoreDigital Signatures

Why Digitally Signing your PDFs is the Only Reliable Way to Prevent Tampering

PDF documents are widely used for sharing information because of their fixed layout and cross-platform compatibility. However, it is crucial to ensure the integrity and authenticity of these…


ASP.NETAIASP.NET Core

Automating PDF/UA Accessibility with AI: Describing DOCX Documents Using TX…

This article shows how to use TX Text Control together with the OpenAI API to automatically add descriptive texts (alt text and labels) to images, links, and tables in a DOCX. The resulting…

Summarize this blog post with:

Share on this blog post on: