Questions tagged [flying-saucer]

Flying Saucer (also called XHTML renderer) is a pure Java library for rendering XML, XHTML, and CSS 2.1 content.

Flying Saucer (also known as xhtmlrenderer) takes XML or XHTML and applies CSS 2.1-compliant stylesheets to it, in order to render to PDF (via iText), images, and on-screen using Swing or SWT. The library implements (basically) the entirety of CSS 2.1 and aims to be fully compliant with the W3C specification; it includes a small handful of CSS 3 features.

Features:

  • 100% Java XML+CSS layout engine with native PDF, Swing, image rendering.
  • Strong support for the CSS 2.1 specification including extensions to better support paged media.
  • Good performance.
  • Support for XHTML including forms.
  • Arbitrary elements may be replaced with custom content.
  • Limited support for dynamic effects (for example, the :hover pseudo-class and links)
  • Some support for PDF specific features (for example, bookmarks and internal links).

Limitations:

  • Resource loading is single threaded and occurs inline with layout.
  • Support for XHTML is weaker than XML+CSS (for example, not all XHTML presentational attributes are supported nor are X/HTML features like the element).
  • No support for legacy HTML (although there are several open source Java HTML cleaners of varying quality available).
  • No support for incremental layout (applies to screen media only).

Useful Links:

Synonyms: and

402 questions
10
votes
1 answer

Flying Saucer xhtml to pdf header margins on every page

Im still working with flying saucer to export xhtml to pdf. At the moment its just a datatable with header and footer on every page. The problem is, the header on the second page (and also on the following ones) has no margins, so the header…
Philipp Schemel
  • 943
  • 8
  • 19
9
votes
5 answers

FlyingSaucer renderer.setDocument throws "Stream closed" exception

I am having problems with creating a PDF using the simple example found here. It is my first time trying to use it and I have tried a few things and lots of searching but haven't found a reason why the error is generating. The error originates on…
paben
  • 101
  • 1
  • 1
  • 3
9
votes
4 answers

.NET version or port of Flying Saucer

Is there any open source .NET project (or port) similar to the Flying Saucer project which renders HTML to PDF using iText?
Tawani
  • 11,067
  • 20
  • 82
  • 106
9
votes
2 answers

Convert HTML page containing Arabic characters to PDF using FlyingSaucer

I want to convert an HTML page that contains Arabic characters to a PDF file using FlyingSaucer, but the generated PDF does not contain combined characters and prints the output backwards. HTML:
Samy Louize Hanna
  • 821
  • 2
  • 8
  • 15
9
votes
7 answers

Relative paths in Flying Saucer XHTML?

I am using Flying Saucer to render some PDF documents from strings to XHTML. My code is something…
Adam Burley
  • 5,551
  • 4
  • 51
  • 72
9
votes
1 answer

ITextRenderer: Adjust page height to content

I'm using ITextRenderer to generate a PDF from HTML and what I need to do is a cash register receipt. This receipt has dynamic width and, of course, dynamic content. This said, the height of content will always be different and right now I'm…
Oliveira
  • 1,281
  • 1
  • 11
  • 19
8
votes
2 answers

Static images not display with flying saucer and thymeleaf for generated pdf files

I am using thymeleaf as my template engin to map XHTML to HTML and flying saucer to generate a pdf file afterwards. Now i failed to display my static images located at /src/main/resources/ inside y generated pdf file. The file itsself will be…
user7307131
8
votes
1 answer

Flying Saucer: Chinese character rendered as a box in PDF

When I use Flying Saucer to convert html page with Chinese character. The Chinese character displayed as a box like below I have tried both methods: using the css as in this answer Flying Saucer font for unicode characters and using the code as in…
Tony Vu
  • 4,251
  • 3
  • 31
  • 38
8
votes
2 answers

css pdf page - header overlapping with content

As we can see from the image my content overlaps with the header image and this is the code I have: