FNCPDFLib Pos Receipt Creation


I did not know that you have FNCPDFLib in order to create PDF documents at least for iOS and Android correct?

I need to create custom PDF in order to be printed at bluetooth printers, I show you the next images in order you to know what I need to acomplished:

I have a lot of questions and I want you to be honest and tell me what is possible to do and what is not, so here are my topics:

  1. How to "calculate" the height of the PDF on the fly and increase it without need to know the exact size before PDF creation, this is because on my code step by step I will travel my user data input.

  2. How to converse the 58mm width of most bluetooth printers paper into your PDF unit of measure, I mean I do not know if your width measure is screen points so in real life how to convert 58 milimeters into the appropiate width for the FNCPDFLib component.

  3. How to CENTER text based on the step before "the width" on any part of the PDF result.

  4. Is it possible to introduce "tabs spaces" so in a text rectangle I can see dent spaces?

  5. How can tail align text as showed on the previous receipt images, represented by currency data?

  6. In some of your documentation I saw is it possible to automatically wrap text or split into several lines based on the length of the caracters right?

  7. How to stretch an image logo and draws at the begining of PDF document?

In general I wish to have all the necessary document material in order to use it at my own convinience, if you already have DEMOS for POS printers will be very useful.

In case you do not have demos I can create them and share with you, but please give me all the docs and tips in order to use your FNCPDFLib component at maximum POS capabilities.


My goal is to use FNCPDFLib component and create PDF documents like the next image for: Windows, iOS, Android and macOS.

  1. The PDF library has a way to set the PageHeight, but this cannot be done dynamically based on the content. The PageHeight needs to be precalculated.

  2. There are conversion routines from PixelsToMillimeter and vice versa

  3. There is a library called TTMSFNCGraphicsPDFEngine which is capable of applying the same code as you would use when custom drawing within FNC, there you can specify parameters to center text.

  4. The PDF Lib is capable of rendering mini HTML, so I would assume you need to apply a TAG before adding the text to assure indenting of the text within a paragraph.

  5. In the same way as 3

  6. That is correct.

  7. Images can drawn within a stretching rectangle in the same way as 3 with the separate graphics engine.

Some references:

Attached is a sample project - it's done in Lazarus, but you should have no problem converting it to Delphi.
You can also download the compiled application: paweld.it

fncpdf-test.pdf (93,7 KB)
test.zip (5,4 KB)

1 Like

Thanks Pieter

Awesome solution, thanks

Hello again

I'm testing the FNCPDFlib into my App, seems the code of Paweł Dmitruk works like a charm.

However the "EmbedFonts" property does not work correctly on "Windows" platform.

I will put here 3 different screnshoots and I need you to tell me why on Windows looks "GIANTS" fonts instead of mobile platforms like iOS and Android?




On mobile platforms, we are using the native PDF generation API, on Windows, we are generating a PDF from scratch so it's possible that the font-sizes do not match. The fontsize is just passed along as pixel sizes on Windows. You might need to convert the font size before drawing content on the PDF on Windows.

how to do that?

You will need to convert from display to PDF DPI size. Display is 96 DPI, PDF is 72 DPI.


Font.Size := Font.Size * 72 / 96