xhtmlrenderer

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

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...

How to render Asian characters in a PDF using xhtmlrenderer

I was wondering what steps were needed to render Asian characters using the java based xhtmlrenderer (flying saucer) library? I am wanting to render the following: <html> <body>同名の映画のモデ</body> </html> Without any font settings being added to the HTML this renders fine in normal browsers, but I can't find anyway to render this to ...

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 resource packages on the classpath to resolve items and images? Note: I'm running this in a web...

How to paginate using itext and xhtmlrenderer

Greetings, I had a question regarding covnerting xml content to pdf. I am able to successfully generate pdf out of the xml using xhtmlrenderer and inbuilt interface to itext library. I had one question regarding page size and pagination. Currently, if my rendered xml does not fit on the specified page size, a second page is not created...

xhtmlrenderer xhtml to pdf font problem

Hi all, I'm using org.xhtmlrenderer.pdf.ITextRenderer to convert my (x)html page to pdf using Java. I've got most of it working, except the font part. I'm using verdana in my page and the pdf is rendered using default font. I have added the verdana.ttf to my jar and use the following code: DocumentBuilder builder = DocumentBuilderFa...

XHTML editor wanted!

I need an editor that outputs clean HTML, and preferably strict XHTML with CSS, as I am going to display the resulting pages as help pages in a java application using xhmtlrenderer ("Flying Saucer") which apparently very much prefers XHTML with CSS 2.1. Having searched stackoverflow for HTML editor and XHTML editor, I've found several m...

Bookmarks with xhtmlrenderer (iText)

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. ...

flying saucer (xhtmlrenderer) doesn't bold my font?

Hi all, I'm using a custom truetype font in a pdf generated by flying saucer xhtmlrenderer. ITextRenderer renderer = new ITextRenderer(); renderer.getFontResolver().addFont("myfont.ttf", BaseFont.CP1252, BaseFont.EMBEDDED); renderer.setDocument(XMLResource.load(in).getDocument(), url); renderer.layout(); renderer.createPDF(out); and ...

Using an ampersand in flying saucer

I get the error below when converting to PDF with flying saucer. I've removed the ampersand charector and it worked, so this seems to be the problem. How do I include ampersand's in my PDF documents? Thanks in advance. ERROR: 'The entity name must immediately follow the '&' in the entity reference.' ...

flying saucer (xhtmlrenderer) out of memory

I'm trying to use flying saucer to create a very large PDF and it seems to be running out of memory. below are a couple of stack traces which suggest to me that flying saucer is not completely scalable... or am i doing something wrong? java.lang.OutOfMemoryError: Java heap space at com.sun.org.apache.xerces.internal.util.XMLStr...

flying saucer (xhtmlrenderer) requests image 4 times

in my xhtml i have the following: ... <img src="myImage.jpg" /> ... and I render like so: ITextRenderer renderer = new ITextRenderer(); renderer.setDocument(XMLResource.load(in).getDocument(), url); renderer.layout(); renderer.createPDF(out); the resulting PDF is as expected, however I notice that the image (which is included only ...

content not allowed in prolog from document created by DOM when printing using flying saucer

I'm trying to print some text using my flying saucer (https://xhtmlrenderer.dev.java.net). The document is generated using DOM-API but when the print starts there is a 'content not allowed in prolog' exception. What is the reason for this exception? My code is this: DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory...

Java XHTMLRenderer print margin

I'm trying to use xhtmlprinter (flying saucer) to print the html part of a email. It almost works but on the page the imageable area of the paper is not used so the contents are clipped. Im using this code, which is modeled after the XHTMLPrintable in the simple package, to print the page. Graphics2D g2 = (Graphics2D) g; if (g2r == nu...

How to create TOC or index using the Flying Saucer project?

I convert HTML files to PDF format using The Flying Saucer Project. This are documents containing repetitive information - premises and their addresses, let's call them elements. At the end of a document I need to create an index. Each index entry should have a page number referring to the page where element was added. The number of elem...

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

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. ...