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
7
votes
1 answer

How to add SVG image to PDF built with HTML and Flying Saucer library (and Batik)?

Im working on generation of PDFs with XHTML using the flying saucer library (old but open source). I got that working but I also want to add SVG images. Ive started working on integrating batik to try and get it to work but I'm running into issues.…
Daxterwous
  • 299
  • 1
  • 3
  • 14
7
votes
2 answers

How to generate a Pdf in Land Scape orientation from a html string using Itext 2

I am using this code to generate a PDF from HTML String. ITextRenderer renderer = new ITextRenderer(); renderer.setDocumentFromString(new String(htmlString.getBytes("UTF-8"))); In table some row contains data of a very large length.Due to which the…
Dexter
  • 105
  • 2
  • 9
7
votes
3 answers

Is it possible to resolve css as a classpath resource using Flying Saucer (XHTML-Renderer)?

I'm trying to package up resources into a jar, but I'm having trouble getting Flying Saucer to find the css on the classpath - I can't construct a URL easily to be able to resolve this seamlessly. Does Flying saucer have a way of specifying…
Stephen
  • 19,488
  • 10
  • 62
  • 83
6
votes
2 answers

Convert malformed HTML to PDF using Flying Saucer PDF Rendering

In a project GitHub I'm trying to convert any arbitrary HTML string into a PDF version. By convert I mean parse the HTML, and render it into a PDF file. To achieve that I'm using Flying Saucer PDF Rendering like this: Main.java public class Main { …
lealceldeiro
  • 14,342
  • 6
  • 49
  • 80
6
votes
2 answers

Resolving protected resources with Flying Saucer (ITextRenderer)

I'm using Flying Saucer to create a pdf from xhtml, hosted on a tomcat server. Most of the images included in the pdf are publicly available (logos and so on), but some of them are protected behind a login (that is, they are streamed through a…
ManiSto
  • 648
  • 1
  • 8
  • 23
6
votes
5 answers

image not displaying in PDF template using Spring Boot, flying saucer and Thymeleaf

I create a file pdf from html template using Spring Boot, flying saucer, thymeleaf. But image is not displaying in my file. Project structure: code html:
dinhbao10t4
  • 118
  • 1
  • 1
  • 5
6
votes
1 answer

How to protect pdf report with password using thymeleaf as template engine and flying-saucer as rendrer

PDF is generating successfully but I want to protect it with a password. flying-saucer-pdf doc does not help me. I am using this example Using thymeleaf+flying-saucer-pdf+Spring Boot
AsinghrawatZ
  • 73
  • 1
  • 6
6
votes
6 answers

External CSS in Flying Saucer

I would like to know how to include the External CSS in Flying-Saucer.Before that THB I checked with all the available links in StackOverflow but they are not helpful.That's the reason why made this one my self. TestCSS.xhtml renamed version of…
sunleo
  • 10,589
  • 35
  • 116
  • 196
6
votes
2 answers

Generate big PDF from huge amount of data

I read data from database from which I generate HTML DOM. The data volume is huge so it cannot fit in memory at once, however it can be provided chunk-by-chunk. I would like to transform resulting HTML into PDF using Flying Saucer: import…
dma_k
  • 10,431
  • 16
  • 76
  • 128
6
votes
2 answers

Footer on last page while pdf generation by flying saucer

I'm using flaying saucer java library. I'm trying to add footers to my generated pdf. The goal is to have the same footer on each page and different content on the last page. html>