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

370 questions
49
votes
3 answers

Creating page headers and footers using CSS for print

I'm creating a PDF using Flying Saucer (which dumps out CSS/HTML to iText to a PDF) and I'm trying to use CSS3 to apply an image header and footer to each page. I'd essentially like to put this div in the top left of each page:
Naftuli Kay
  • 75,812
  • 80
  • 244
  • 374
29
votes
4 answers

With Flying Saucer, how do I generate a pdf with a page number and page total on every page at the footer?

It took me a little more research than I would have liked to figure this out on my own, so I'm going to post a comprehensive answer here. It seems like the information to do this is spread across many different websites and I'd like to put it in…
Daniel Kaplan
  • 54,448
  • 39
  • 189
  • 282
28
votes
3 answers

Generating header/footer with flying saucer (xHTMLRenderer) and iText

I realize this question has been asked before (I looked at all the solutions and tried them all) but I am still trying to generate a pdf document with a header and footer that repeat on every page. I am using flying saucer R8 with iText2.0.8 I have…
flyingCaffine
  • 382
  • 1
  • 4
  • 9
19
votes
1 answer

Flying saucer, Thymeleaf and Spring

I have a Spring application and need to build support for PDF generation. I'm thinking of using Flying-saucer together with Thymeleaf to render the PDF. However, I cannot find that much information about using Flying-saucer together with Thymeleaf.…
per_jansson
  • 1,923
  • 3
  • 27
  • 45
17
votes
3 answers

Using Flying Saucer to Render Images to PDF In Memory

I'm using Flying Saucer to convert XHTML to a PDF document. I've gotten the code to work with just basic HTML and in-line CSS, however, now I'm attempting to add an image as a sort of header to the PDF. What I'm wondering is if there is any way…
JToland
  • 3,436
  • 11
  • 44
  • 70
16
votes
3 answers

CSS to PDF,the css in Flying Saucer : -fs-table-paginate result in border-collapse:collapse invalid

Now I am using xhtmlrenderer to covert html to PDF. My maven dependancy as follows: org.mvel mvel2 2.1.0.drools2 compile
FishGel
  • 1,010
  • 1
  • 15
  • 26
14
votes
3 answers

How to embed font in PDF created from HTML with iText and Flying Saucer?

I have problem with embedding Polish fonts into PDF converted from HTML. My HTML code have style in body: I tried 2 ways of converting such HTML into PDF: FOP with…
Michał Niklas
  • 48,759
  • 16
  • 62
  • 100
12
votes
3 answers

Blurry render of SwingNode in JavaFX on Windows

Overview Using FlyingSaucer within a JavaFX application, to avoid WebView for various reasons: doesn't provide direct API access to its scrollbars for synchronous behaviour; bundles JavaScript, which is a huge bloat for my use case; and failed to…
Dave Jarvis
  • 28,853
  • 37
  • 164
  • 291
12
votes
3 answers

Adding Arial Unicode MS to CKEditor

My web application allows user to write rich text inside CKEditor, then export the result as PDF with the Flying Saucer library. As they need to write Greek characters, I chose to add Arial Unicode MS to the available fonts, by doing the following :…
realUser404
  • 1,841
  • 3
  • 16
  • 36
11
votes
1 answer

Render image from servlet in flyingsaucer generated pdf

I'm using flyingsaucer to render an xhtml document to pdf through a servlet which returns the generated pdf document. The xhtml document features an image which is requested from another servlet. The image servlet checks who is logged in before…
Edd
  • 7,660
  • 14
  • 44
  • 70
11
votes
3 answers

Generation of PDF from HTML with non-Latin characters using ITextRenderer does not work

This is the 2nd day I spend investigating with no results. At least now, I am able to ask something very specific. I am trying to write a valid HTML code that contains some non-Latin characters in a PDF file using iText and more specifically using…
alexandros
  • 544
  • 1
  • 6
  • 15
10
votes
2 answers

Flying Saucer font for unicode characters

I am generating PDF using Grails export plugin (basically, Flying Saucer). My GSP page is an UTF-8 page (or at least properties are showing that it is UTF-8, also in the beginning of the GSP page there is a
Alex K.
  • 3,190
  • 4
  • 24
  • 38
9
votes
1 answer

HTML to PDF Conversion - "Can't load the XML resource" Error

I'm trying to convert strict XHTML to PDF using flying saucer and iText. I've validated XHTML and path of input and output file are precise. I have no goddamn clue why this is throwing an exception on…
srijan
  • 1,476
  • 1
  • 13
  • 23
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
  • 10,649
  • 20
  • 77
  • 104
1
2 3
24 25