xmlworker

itext xmlworker with javafx htmleditor

倾然丶 夕夏残阳落幕 提交于 2019-12-06 02:02:53
I created a simple JavaFX (2.2) FXML project. I am trying to convert a html string to different Elements and add them to a Paragraph in my PDF document generated by iText. As HTMLWorker is deprecated, I use XMLWorker. It does seem to work with a own written simple html string, e.g.: StringReader in = new StringReader("<html><body><p>test</p></body></html>"); However, when I try to use the html string generated by the JavaFX HTMLEditor control, I receive following message: Caused by: java.lang.NoSuchMethodError: com.itextpdf.tool.xml.html.pdfelement.NoNewLineParagraph.setMultipliedLeading(F)V

iTextSharp creates PDF with blank pages

左心房为你撑大大i 提交于 2019-12-03 14:52:31
I've just added the iTextSharp XMLWorker nuget package (and its dependencies) to my project and I'm trying to convert the HTML from a string into a PDF file, even though no exceptions are being thrown, the PDF file is being generated with two blank pages. Why? The previous version of the code was using just iTextSharp 5.5.8.0 with HTMLWorker and ParseList method, then I switched to Here is the code I'm using: public void ExportToPdf() { string htmlString = ""; Document document = new Document(PageSize.A4, 40, 40, 40, 40); var memoryStream = new MemoryStream(); PdfWriter writer = PdfWriter

Using itextsharp xmlworker to convert html to pdf and write text vertically

余生长醉 提交于 2019-12-03 07:19:50
Is there possible to achieve writing text direction bottom-up in xmlworker? I would like to use it in table. My code is <table border=1> <tr> <td style="padding-right:18px"> <p style="writing-mode:sideways-lr;text-align:center">First</p</td> <td style="padding-right:18px"> <p style="writing-mode:sideways-lr;text-align:center">Second</p></td></tr> <tr><td><p style="text-align:center">1</p> </td> <td><p style="text-align:center">2</p></td> </tr> </table> But it it doesn't work after conversion from html to pdf. Text FIRST and SECOND are not in direction bottom-to-up. This was a pretty

Can't set RTL direction for Hebrew letters while converting from *.xhtml to *.pdf by using iText library

我只是一个虾纸丫 提交于 2019-12-02 13:55:36
问题 I'm trying to convert *.xhtml with Hebrew characters (UTF-8) to PDF by using iText library but I getting all letter in reverse order. As far I understand from this question I can set RTL only for ColumnText and PdfCell objects: Arabic (and Hebrew) can only be rendered correctly in the context of ColumnText and PdfPCell. So I doubt is it possible to convert whole *.xhtml page to PDF? This is an *.xhtml file which I try to import : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

Adding PdfDiv to Paragraph

风格不统一 提交于 2019-12-02 11:25:38
问题 It's the topic connected with List items in table cell are not formatted. I'm using XmlWorker to process HTML output from formattable control (dijit/Editor from Dojo). There are some blocks (when you use centering or margin formatters) like that: <div> <p align="center"><font size="5"><b> <font color="#32cd32">My centered Para</font></b></font><font color="#32cd32"> </font></p> </div> However, when I add them to the Paragraph that is added to the Table like here: PdfPCell htmlCell = new

how can I add cellspacing to pdftable when parsing html using XMLWorker and itext

丶灬走出姿态 提交于 2019-12-02 09:13:07
I am using XMLWorker and itext to convert html to pdf . my html have a table and I need to set it's cellspacing =0 cellpadding=0 . does anyone know how to do it ? in html I saw I can replace it by setting the style : border-collapse: collapse; border-spacing: 0px ; border : 0; padding : 0; thanks Tami I've tried what you're doing using the CSS you propose and it works for me: You can find my test here: ParseHtmlTable5 This is my HTML (including the CSS): table3_css.html <html> <head> <style> table, td { border: 1px solid green; border-spacing: 0px; padding: 0px; } </style> </head> <body>

How to create a PDF with iText+XMLWorker from servlet using custom font?

笑着哭i 提交于 2019-12-01 00:35:40
Playing with iText/XMLWorker samples (mostly this one ), I could easily write simple applications able to create PDF files from HTML code using my own extra fonts, but as soon as tried to use my stuff in some web service code, I ended with exceptions like: Table 'name' does not exist in file:/C:/work/MyServer/target/classes/fonts/My%20Font.ttf ExceptionConverter: com.itextpdf.text.DocumentException: Table 'name' does not exist in file:/C:/work/MyServer/target/classes/fonts/My%20Font.ttf ...which seems to point out that in a web service context, the font file couldn't be loaded as expected.

place text next to image html to pdf using itextsharp

南楼画角 提交于 2019-11-29 11:46:04
I am converting html to pdf using itextsharp. I have to place text next to the image not below the image. In html I am able to place text next to image but in pdf the text line starts after image Please help. Since you mention HTML, you understand block and inline display, right? By analogy, iTextSharp's default Image display is block . To inline Image objects you need to: Add images to Chunk object(s) Add text in Phrase object(s) Then add those object to a Paragraph object Something like this: Image image = Image.GetInstance(imagePath); Paragraph p = new Paragraph(); p.Add(new Phrase("Text

iTextSharp HTMLWorker.ParseToList() throws NullReferenceException

我与影子孤独终老i 提交于 2019-11-29 10:01:34
I am using iTextSharp v.4 to merge a whole bunch of html files. It was working fine until I needed to upgrade to v.5 of iTextSharp. The problem comes when I pass a streamreader (reading the content of the html file) into the HTMLWorker object's ParseToList method. It throws a null reference exception. On debugging it I can access the streamReader and can confirm that the correct content of the file is read. Here is the code: List<IElement> objects; try { objects = HTMLWorker.ParseToList(new StringReader(htmlString), null); } catch (Exception e) { htmlString = "<html><head></head><body><br/><br

How can I use iText to convert HTML with images and hyperlinks to PDF?

我们两清 提交于 2019-11-28 12:28:44
I'm trying to convert HTML to PDF using iTextSharp in an ASP.NET web application that uses both MVC , and web forms . The <img> and <a> elements have absolute and relative URLs, and some of the <img> elements are base64 . Typical answers here at SO and Google search results use generic HTML to PDF code with XMLWorkerHelper that looks something like this: using (var stringReader = new StringReader(xHtml)) { using (Document document = new Document()) { PdfWriter writer = PdfWriter.GetInstance(document, stream); document.Open(); XMLWorkerHelper.GetInstance().ParseXHtml( writer, document,