flying-saucer

Relative paths in Flying Saucer XHTML?

戏子无情 提交于 2020-01-31 08:43:10
问题 I am using Flying Saucer to render some PDF documents from strings to XHTML. My code is something like: iTextRenderer.setDocument(documentGenerator.generate(xhtmlDocumentAsString)); iTextRenderer.layout(); iTextRenderer.createPDF(outputStream); What I'm trying to understand is, when using this method, where are relative paths in the XHTML resolved from? For example, for images or stylesheets. I am able to use this method to successfully generate a text-based document, but I need to understand

Generate PDF file in an appropriate format

*爱你&永不变心* 提交于 2020-01-16 19:48:29
问题 For my use, I created a PDF file using flying-saucer library. It was a legacy HTML so I cleaned out the XHTML using HTMLCleaner library. After this I serialize the XML as string then pass it to the iText module of flying-saucer to render it and subsequently create the PDF. This PDF I place it in the OutputStream . After the response is committed I get a dialog asking to save or open it. However it does not get saved as PDF file. I have to right-click and open it in Adobe or any PDF reader.

flying saucer - page count with css

倾然丶 夕夏残阳落幕 提交于 2020-01-16 00:56:21
问题 I'm using flying saucer to convert HTML data to PDF, but I've one issue to solve. In my PDF the first page is a introductory page, so this page don't have a number. The second page must have a number, and the number of page two must be 1. The thrid page must show Page 2 and etc. I want the page counter to only begin on the second page. How can I do it? 回答1: I've discovered. Just put "-fs-page-sequence" in a style on page that you want to start the counter, and the page counter will be reseted

Using Flying Saucer to Render Images to PDF In Memory

天大地大妈咪最大 提交于 2019-12-30 01:00:08
问题 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

number cannot be wrapped in flyingsaucer and itext

邮差的信 提交于 2019-12-25 07:29:16
问题 environment is : flyingsaucer r8 and itext 2.0.8 I'm going to create pdf file with flyingsaucer and itext, I added table-layout:fixed;word-wrap:break-word; to wrap the cell content. However, the generated pdf file looks like next : from the above diagram, we can see that over long English sentence of column 'Description' can be wrapped correctly, but the over long number in 'Account Code' and 'Description' cannot be wrapped. I also tried "word-break: break-all;", but it still doesn't work. my

itext, Flying Saucer: xhtml to pdf ClassCastException

巧了我就是萌 提交于 2019-12-24 09:07:49
问题 public void createPDF() { FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = facesContext.getExternalContext(); HttpSession session = (HttpSession) externalContext.getSession(true); String url = "http://localhost:8080/comap/pages/admin/student.xhtml"; try { ITextRenderer renderer = new ITextRenderer(); renderer.setDocument(url); renderer.layout(); HttpServletResponse response = (HttpServletResponse) externalContext.getResponse(); response.reset();

Cannot use border-radius CSS3 property with Flying Saucer

荒凉一梦 提交于 2019-12-24 02:33:08
问题 I am working on a project where I need to convert an HTML to a PDF. I am using Flying Saucer 9.1.6 from Maven Central for this. The subjacent PDF generation library is IText 2.1.7 . Although Flying Saucer Git repo states that it supports CSS3 border-radius syntax I am unable to achieve rounded corners with border-radius. Here is the sample code ITextRenderer pdfRenderer = new ITextRenderer(); String resumeHTML = "<html>\n" + "<head>\n" + " <title>JS Bin</title>\n" + " <style>\n" + " .circle{

Footer on last page while pdf generation by flying saucer

狂风中的少年 提交于 2019-12-23 14:46:31
问题 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> <head> <style type="text/css"> @page { size: 8.5in 11in; margin-bottom: 1in; @bottom-left { content: element(footer_one); } @bottom-right{ content: element(footer_two); } @bottom-center{ content: element(footer_rights); } } #footer_two {position: running(footer_two); } #footer_one {position: running(footer_one); }

Java/iText/Flying Saucer: Convert HTML containing svg tags to pdf

给你一囗甜甜゛ 提交于 2019-12-23 12:08:30
问题 I'm trying to generate a pdf file in Java from HTML. The HTML code contains a svg tag that was generated by Google Charts API to display a column chart. I tried to do it with Flying Saucer R8 like so: StringBuffer sb = new StringBuffer(); sb.append("<div id='chartArea'><svg width='830' height='400'><defs id='defs'><clipPath id='_ABSTRACT_RENDERER_ID_0'><rect x='45' y='77' width='560' height='247'/></clipPath></defs><rect x='0' y='0' width='830' height='400' stroke='none' stroke-width='0' fill

Getting this “org.xhtmlrenderer.render.BlockBox cannot be cast to org.xhtmlrenderer.newtable.TableBox” while trying to render a pdf

六眼飞鱼酱① 提交于 2019-12-23 03:12:58
问题 I am getting this error while I am trying to render a pdf. I am using Nicolas Leroux's PDF module for the play framework. This is the entire stackstrace: Pastebin. Googling only reveals 4 results. They suggest removing any float properties, and position attributes, which I have removed, jsut to give it a try. I am still facing this problem. Has anyone been able to solve the issue? EDIT: This is the html that renders the pdf: #{extends 'main.html' /} #{set title:'Salary Details' /} <html>