XFINIUM.PDF 6.0 brings support for creating PDF files in flow layout mode.
In flow layout mode you just have to feed the document with content and the document takes care of all the layout operations and distributes the content across pages.
A new type of document has been introduced in order to support the flow layout and it is represented by the PdfFlowDocument class.
At this moment 4 types of content are supported: text, image, form XObject and tables. Next versions will bring support for other types of content.
The new samples that present the new features are:
- Invoice – combines text, images and tables to create an invoice
- SimpleTable – shows how to create a simple tabular report from data
- TableCellSpans – shows the col span / row span functionality in a tables
- TableGroups – shows how to create a tables with grouping headers and footers for rows
The fixed layout mode is still available and the new flow layout mode is built on top of it.
Because creating PDF documents in flow layout mode is a large topic, we’ll start a series of articles on the blog that will present this functionality in great detail so you can take full advantage of it.
Hi,
I have a problem when using FlowDocument. I want to add some leading spaces to the text, but those spaces are trimmed. In the Invoice example I see the problem too, for example in the BuyerSection, if you modify the line:
PdfFormattedTextBlock labelVAT = new PdfFormattedTextBlock(” Your VAT/Tax number: “, labelFont);
the spaces will not be printed? Is it a bug? A feature? How can I print those spaces?
Thank you in advance!
Wojciech Undrych
At this moment regular spaces (0x20) are trimmed. The solution is to use no-break space characters (0xA0) instead of regular spaces (0x20).
This code will generate 3 spaces in front of the text:
PdfFormattedTextBlock labelVAT = new PdfFormattedTextBlock("\u00A0\u00A0\u00A0Your VAT/Tax number: ", labelFont);
In the future we’ll add support to preserve start/end spaces.