flying-saucer

Render embedded image in PDF using Flying-Saucer from html

流过昼夜 提交于 2019-12-22 04:40:57
问题 I have an xhtml document that I'm turning into a PDF using flyingsaucer. The xhtml has several tags that have a base64 encoded images inline. The source of the xhtml is dynamic so the structure of where the image tags are can vary. This is a sample of what the tag looks like: <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAagAAAEuCAYAAADbW4YFAAAgAElEQVR4Aex9CYBdRZ ... When I look at the html in a browser, the image appears correctly, however, the img element doesn't get rendered in

.NET version or port of Flying Saucer

可紊 提交于 2019-12-22 04:26:11
问题 Is there any open source .NET project (or port) similar to the Flying Saucer project which renders HTML to PDF using iText? 回答1: 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). 回答2: For a quick-and-dirty solution you could try using IKVM to compile the Java to .NET

Flying Saucer font for unicode characters

怎甘沉沦 提交于 2019-12-18 05:47:24
问题 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 <?xml version="1.0" encoding="UTF-8"?> directive). At first generated PDF properly contained umlaut characters "äöüõ", but Cyrillic characters were missing from PDF (not rendered at all). Then I've changed my css file as described in documentation by adding following: @font-face { src: url

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

假装没事ソ 提交于 2019-12-17 23:06:05
问题 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

Java Generate a PDF with flying Saucer

大兔子大兔子 提交于 2019-12-13 07:13:41
问题 The jar i am using is from the maven repo The code i am testing is from a previous stack solution I fear it might be outdated because the libraries are depreciated. When testing the following code: import java.io.ByteArrayInputStream; import java.io.FileOutputStream; import org.w3c.dom.Document; import org.xhtmlrenderer.pdf.ITextRenderer; public class test { public static void main(String[] args) { ITextRenderer renderer = new ITextRenderer(); // if you have html source in hand, use it to

Flying Saucer not recognizing html entities

≡放荡痞女 提交于 2019-12-13 03:23:28
问题 I'm trying to use an html file as a template for a pdf, but Flying Saucer isn't recognizing the HTML5 entities (&trade, &nbsp etc). If I replace them with their hex values, then the program runs fine. My code is as follows: public static InputStream create(String content) throws PDFUtilException { try (ByteArrayOutputStream baos = new ByteArrayOutputStream();) { ITextRenderer iTextRenderer = new ITextRenderer(); iTextRenderer.getSharedContext() .setReplacedElementFactory(new

Bookmarks with xhtmlrenderer (iText)

心已入冬 提交于 2019-12-13 01:13:16
问题 I'm using xhtmlrenderer (Also known as Flying Saucer) with iText to convert HTML to PDF. How would I create bookmarks with this? Does someone with have a small example? Thanks in advance. 回答1: It seems bookmarks were added in R6, but the user guide only gives them a passing reference. with a TODO to the author to add an example later. Searching the forums, I found this example: <html> <head> <bookmarks> <bookmark name="A bookmark" href="#bm" /> <bookmark name="A bookmark 2" href="#bm2" />

xhtml to pdf servlet with flyingsaucer

余生长醉 提交于 2019-12-12 12:31:13
问题 I am trying to use flyingsaucer to serve pdf generated from xhtml but I am having trouble getting the servlet example to run. All the other flyingsaucer examples work fine for me but I need this to work as a servlet to incorporate into a webapp. The full code for the servlet is as follows: import java.io.*; import java.net.*; import javax.servlet.*; import javax.servlet.http.*; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom

How to convert url of html page to pdf in java using iText & flying saucer?

旧巷老猫 提交于 2019-12-12 11:12:57
问题 I've just downloaded xhtmlrenderer and iText jar files. I can make pdf files by using these jars. What I exactly want is: I need to create pdf if I give one valid URL (say " https://xhtmlrenderer.dev.java.net/news.html ") in the place of "inputFile". Is it possible with flying saucer and iText? If yes, please guide me to achieve this. Also, when I'm trying to run the below code, I'm getting error: stream closed import java.io.*; import com.lowagie.text.DocumentException; import org

External CSS in Flying Saucer

十年热恋 提交于 2019-12-12 11:01:15
问题 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 TestCSS.html .So content of them are same. Below (Image 1 ) is the Structure of my Project in Eclipse IDE.If I run the TestCSS.html it will give the page result as Image 2 in Browser. Below are Code which are not working as External CSS : This one