flying-saucer

.NET version or port of Flying Saucer

浪尽此生 提交于 2019-12-05 02:39:19
Is there any open source .NET project (or port) similar to the Flying Saucer project which renders HTML to PDF using iText ? I always recommend wkHTMLtoPDF for web->PDF conversions. It's web kit based though I'm not sure what PDF library it's sitting on. At any rate, you'll be hard pressed to find something that will render your HTML more accurately (it'll even run script, set innerHtml and so forth). For a quick-and-dirty solution you could try using IKVM to compile the Java to .NET. http://www.ikvm.net/ Use the Pechkin .NET wrapper for WkHtmlToPdf. The resulting pdf can be outputted as a

flying-saucer/iText PDF in servlet not finding css file

房东的猫 提交于 2019-12-04 14:31:46
A code snippet is at the bottom of the question I am successfully able to render a PDF in the client's browser using a servlet and flying-saucer/iText. However, I can't figure out how to get the style sheet included in the PDF rendering. I've tried the following and none have worked thus far: getServletContext().getRealPath("/PDFservlet.css") and putting "PDFservlet.css" at the web root directory buf.append("<head><link rel='stylesheet' type='text/css' href='PDFservlet.css' /></head>") and putting "PDFservlet.css" at the web root directory, the directory where the servlet class file is and

Flying Saucer is not applying internal css

≯℡__Kan透↙ 提交于 2019-12-04 05:25:40
问题 I am using the following code in my struts2 action for converting HTML to PDF using flying saucer: It is just printing the style code just as it is and does not applying it. static String readFile(String path, Charset encoding) throws IOException { byte[] encoded = Files.readAllBytes(Paths.get(path)); return new String(encoded, encoding); } public String execute() throws Exception { String result="success"; try { String url = "C:\\Users\\Anoop\\Desktop\\files\\form1.html"; System.setProperty(

What's the easiest way of converting an xhtml string to PDF using Flying Saucer?

爱⌒轻易说出口 提交于 2019-12-04 05:20:43
I've been using Flying Saucer for a while now with awesome results. I can set a document via uri like so ITextRenderer renderer = new ITextRenderer(); renderer.setDocument(xhtmlUri); Which is nice, as it will resolve all relative css resources etc relative to the given URI. However, I'm now generating the xhtml, and want to render it directly to a PDF (without saving a file). The appropriate methods in ITextRenderer seem to be: private Document loadDocument(final String uri) { return _sharedContext.getUac().getXMLResource(uri).getDocument(); } public void setDocument(String uri) { setDocument

Relative paths in Flying Saucer XHTML?

≡放荡痞女 提交于 2019-12-03 14:14:07
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 how to reference my images and CSS. The setDocument() method takes two parameters: document and url.

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

喜你入骨 提交于 2019-12-03 12:15:13
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 ITextRenderer from Flying Saucer . My short example/code starts by initializing a string variable doc with this value: String doc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\">" + "<body>Some greek characters: Καλημέρα Some greek characters" + "</body></html>"; Here is the code that I use for

Flying saucer, Thymeleaf and Spring

ぃ、小莉子 提交于 2019-12-03 07:11:44
问题 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. Have anyone else used those to technologies together? 回答1: I'm using Flyingsaucer-R8 with Thymeleaf 2.0.14 without problems (and I'm sure current version of Thymeleaf works as well). I have separate TemplateEngine with classpath template resolver

Flying saucer, Thymeleaf and Spring

落花浮王杯 提交于 2019-12-02 20:44:51
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. Have anyone else used those to technologies together? I'm using Flyingsaucer-R8 with Thymeleaf 2.0.14 without problems (and I'm sure current version of Thymeleaf works as well). I have separate TemplateEngine with classpath template resolver configured for this purpose. Using it to produce XHTML as String . Flyingsaucer creates PDF document from

Flying Saucer is not applying internal css

痞子三分冷 提交于 2019-12-02 06:49:20
I am using the following code in my struts2 action for converting HTML to PDF using flying saucer: It is just printing the style code just as it is and does not applying it. static String readFile(String path, Charset encoding) throws IOException { byte[] encoded = Files.readAllBytes(Paths.get(path)); return new String(encoded, encoding); } public String execute() throws Exception { String result="success"; try { String url = "C:\\Users\\Anoop\\Desktop\\files\\form1.html"; System.setProperty("file.encoding", "UTF-8"); String content = PDFGeneratorFromHTML.readFile(url,Charset.forName("UTF-8")

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

雨燕双飞 提交于 2019-12-01 18:34:48
问题 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