How to make a PDF document from a text file

2017-08-25

Today we will talk about the cases when you need to make a PDF document, but there is no Adobe Acrobat on the computer. You only have a text file with original data and FastReport Desktop.

To begin with, you need a test file, in which there is a division into paragraphs (carriage return to a new line). Such a data source will allow you to use paragraphs as data strings.

Now let's create a report in the designer.

Create a new data source:

 

Note the Separator field. By the way, you can enter any character that does not exist in the document, and this will allow you to use carriage return at the end of each paragraph as a separator.

Then select the column Field0:

In the data window appeared a source with one field:

 

Drag this field to the "Data" band and stretch it to the full width:

To fit the entire paragraph text on the band, enable the CanGrow property (can grow) for the added field and for the Data band. You can do this from the context menu:

Also, we call the context menu for the band by right clicking on the band header.

Add a title:

Let's see how the report looks in the preview mode:

As you can see, from a regular text file we received a paragraph-broken document.

So, half the work is done. It remains only to configure the export of the report to PDF format using FR Desktop.

Launch the Configurator tool. Choose the report we created:

We mark the option Export as. And choose the PDF format:

The next step is to select the folder where our PDF document will be saved. To do this, select the Save to option and select the value of Folder:

To select a folder, click the Settings button.

Now, save the configuration with the Save button. You can run the configuration file for execution immediately using the Run button, or use it later with the scheduler.

Press the Run button:

We will check the folder specified in the config. And there is! File created:

As we have seen, you can easily create PDF documents from text files using FastReport.

November 01, 2023

PDF/X, PDF/A, PDF/E: What is the difference, and why are there so many formats?

Let's try to understand the variety of PDF formats, compare the pros and cons of standards for various industries and their needs.
March 22, 2023

Creating PDF report in JetBrains Rider (C#) on Ubuntu 22.04.1 LTS

In this article, we'll take a look at the world of the .NET platform on Ubuntu 22.04.1 LTS and create a PDF exportable report.
December 19, 2022

Creating a PDF report in JetBrains Rider (C#) in Windows 11

In this article we will take a look at .NET in Windows 11 without using Microsoft Visual Studio, and export the report to PDF format.
Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.