xmlworker

Certain HTML entities (arrows) are not rendered in PDF (iText)

删除回忆录丶 提交于 2019-12-11 23:50:05
问题 I tried to render ⇒ ⇔ € © → in the HTML with the XMLWorker and iText. Only the copyright and euro symbol appear in the PDF. I used the dafault font and Arial but without success. Is there a way to get those entities rendered? Is there an alterantive way to render arrows in text? 回答1: As you can see in the ParseHtml3 example, it works for me: This is my code to create the PDF: public void createPdf(String file) throws IOException, DocumentException { // step 1 Document document = new Document(

print all the languages in a single pdf using itext

被刻印的时光 ゝ 提交于 2019-12-11 06:09:01
问题 Hi I want to print all the languages in a single pdf. My code would be as below .I am not able to see any of characters other than english in my pdf.Please check the attachment for generated pdf. I can not understand where the real problem exists import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.nio.charset.Charset; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf

NoNewLineParagraph cannot be cast to Element

送分小仙女□ 提交于 2019-12-11 05:04:14
问题 I'm following the itextpdf example http://itextpdf.com/sandbox/htmlworker/HtmlContentForCell. I have the following code: // Relevant code from main part of the class: ByteArrayOutputStream baos = new ByteArrayOutputStream(); Document document = new Document(PageSize.A4, 40, 40, 40, 40); PdfWriter writer = PdfWriter.getInstance(document, baos); document.open(); document.add(buildContent()); document.close(); // method that should provide content to the document. public PdfPTable buildContent()

Prevent page break in text block with iText, XMLWorker

╄→尐↘猪︶ㄣ 提交于 2019-12-11 03:48:51
问题 I have a text block in a <div> or <p> which I want not to have a page break within. If the text block does not fit on the current page then I want it on a new page. How can I setup XMLWorker to prevent page breaks within certain tags? 回答1: As of version 5.5.7 the XMLWorker in iText supports page-break-inside: avoid; See Changelog 来源: https://stackoverflow.com/questions/29601081/prevent-page-break-in-text-block-with-itext-xmlworker

Set line spacing when using XMLWorker to parse HTML to PDF - ITextSharp C#

早过忘川 提交于 2019-12-10 15:51:44
问题 I am using XMLWorker to parse an HTML string into a PDF Document, and cannot find a way to control the line spacing of the PDF being generated. Document document = new Document(PageSize.LETTER, 72f, 72f, 108f, 90f); MemoryStream stream1 = new MemoryStream(); PdfWriter pdfWriter = PdfWriter.GetInstance(document, stream1); document.Open(); //parse HTML into document XMLWorkerHelper.GetInstance().ParseXHtml(pdfWriter, document, new StringReader(summary.Content)); The "summary.Content" is an HTML

itextpdf 5.5.1 Issue with PDF content resolution when converted from HTML

◇◆丶佛笑我妖孽 提交于 2019-12-10 12:19:34
问题 i am working in HTML to PDF conversion using ItextPdf 5.5.1 and XMLWorker 5.5.1 in Java. i managed to convert PDF document having height as that of HTML contents but contents in PDF looking bigger and having unwanted spaces between lines. These spaces are not there in HTML document. private static void createPdf() { try { // getting HTML file from the path InputStream is = new FileInputStream(new File("/Users/salman.nazir/Desktop/html/tq.txt")); Date now = new Date(); File file = new File(("

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

为君一笑 提交于 2019-12-09 05:47:55
问题 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

Parsing HTML snippets and adding to PdfPTable

眉间皱痕 提交于 2019-12-08 07:12:57
问题 I am creating a PDF made of several PdfPTables where some PdfCell's consist of simple Phrases and others need to be parsed HTML snippets. To make sure the parsed HTML is added with the needed styling and in the correct place I have been storing it in a Paragraph then adding it to a PdfPCell. However doing this causes me to run into issues when dealing with some HTML tags like lists and quotes. Below is a rough example of what I am doing, what can I do to properly handle HTML lists, quotes,

itext XMLWorkerHelper ignores value attribute of <li> tag

怎甘沉沦 提交于 2019-12-08 01:55:09
问题 I'm using itext 5.4.5 with XMLWorker 5.4.5 to generate pdf from html that cames from ckEditor. Users can also paste some text from word documents and this results sometimes in something like this: <ol> <li value="3">some text1</li> </ol> <div>lorem ipsum dolor</div> <ol> <li value="100">some text2</li> </ol> <div>lorem ipsum dolor</div> <ol> <li value="77">some text3</li> </ol> this results in ckEditor and in html as 3. some text1 lorem ipsum dolor 100. some text2 lorem ipsum dolor 77. some

itext XMLWorkerHelper ignores value attribute of <li> tag

不想你离开。 提交于 2019-12-06 11:59:35
I'm using itext 5.4.5 with XMLWorker 5.4.5 to generate pdf from html that cames from ckEditor. Users can also paste some text from word documents and this results sometimes in something like this: <ol> <li value="3">some text1</li> </ol> <div>lorem ipsum dolor</div> <ol> <li value="100">some text2</li> </ol> <div>lorem ipsum dolor</div> <ol> <li value="77">some text3</li> </ol> this results in ckEditor and in html as 3. some text1 lorem ipsum dolor 100. some text2 lorem ipsum dolor 77. some text3 But if itext convert this html to pdf, it ignores the value of li-tags and sets it to "1." and