flying-saucer

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

十年热恋 提交于 2019-12-01 18:08:49
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. The SVG images are not drawn. The XHTML still renders, but it doesnt seem to show the SVG. I've gotten SVG to render on separate PDFs but never together with the flying saucer results. I've added the usual ReplacedElementFactory (which works with regular images as well but havent included that code). The only relevant method (that does get called

JSF 2.0 Get content of xhtml page within current session

吃可爱长大的小学妹 提交于 2019-12-01 08:57:07
问题 I am trying to convert a JSF Page to PDF with Flying Saucer. @ManagedBean @SessionScoped public class ReportController { ... public void createPDF() { FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = facesContext.getExternalContext(); try { ITextRenderer renderer = new ITextRenderer(); renderer.setDocument(new URL("http://myserver.com/report.xhtml").toString()); renderer.layout(); HttpServletResponse response = (HttpServletResponse)

Render image from servlet in flyingsaucer generated pdf

限于喜欢 提交于 2019-11-30 12:39:13
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 returning the appropriate image. The code below shows how the image is requested: <img height="140" width="140" src="http://localhost:8080/myapp/servlet/DisplayPic" /> My problem is that the http request for the image is from the pdf renderer and not the logged in user so the image servlet doesn't know who's logged in and therefore the desired image is

Using Flying Saucer to Render Images to PDF In Memory

北慕城南 提交于 2019-11-30 05:02:26
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 whatsoever to add the image by reading in an image file as a Java Image object, then adding that somehow to the PDF (or to the XHTML -- like it gets a virtual "url" representing the Image object that I can use to render the PDF). Has anyone ever done anything like this? Thanks in advance for any help you can provide! I had to do that last week so

Is there any way improve the performance of FlyingSaucer?

ⅰ亾dé卋堺 提交于 2019-11-29 16:19:24
问题 I've followed this article to use FlyingSaucer to convert XHTML to PDF and it's brilliant but has one major downfall... it's ridiculously slow! I'm finding that it takes between 1 and 2 minutes to render a PDF from an XHTML, regardless of how simple that page is. Basic code: import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import org.xhtmlrenderer.pdf.ITextRenderer; import com.lowagie.text.DocumentException; public class FirstDoc {

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

两盒软妹~` 提交于 2019-11-28 20:22:58
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 tried many different methods to get it working but so far to no avail. Some methods I tested out were https://gist.github.com/626264 , using running elements and margin boxs http://pigeonholdings.com/projects/flyingsaucer/R8/doc/guide/users-guide-R8.html#xil_40 (css3 feature), a guide for flying saucer r7 that doesn't work for r8 http://today.java

Creating page headers and footers using CSS for print

天涯浪子 提交于 2019-11-27 17:20:19
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: <div id="pageHeader"> <img src="..." width="250" height="25"/> </div> My CSS looks somewhat like this: @page { size: 8.5in 11in; margin: 0.5in; @top-left { content: "Hello"; } } Is there a way for me to put this div in the content ? Putting an element to the top of each page: @page { @top-center { content: element(pageHeader); } } #pageHeader{ position: running

Creating page headers and footers using CSS for print

你离开我真会死。 提交于 2019-11-26 17:58:14
问题 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: <div id="pageHeader"> <img src="..." width="250" height="25"/> </div> My CSS looks somewhat like this: @page { size: 8.5in 11in; margin: 0.5in; @top-left { content: "Hello"; } } Is there a way for me to put this div in the content ? 回答1: Putting an element to the top