Questions tagged [xmlworker]

XML Worker is an add-on for iText®. It allows developers to convert XML files to PDF documents in a programmer-friendly way.

About

XML Worker is an add-on for iText®. It allows developers to convert XML files to PDF documents in a programmer-friendly way. This functionality has been tested on straightforward HTML created with WYSIWYG editors such a TinyMCE and CKEditor.

It's possible to parse all kinds of XML, provided you write a specific implementation for that type of XML.

Example using default setup.

Document document = new Document();

    PdfWriter writer = PdfWriter.getInstance(document

    new FileOutputStream("results/loremipsum.pdf"));

document.open();

XMLWorkerHelper.getInstance().parseXHtml(writer, document,

    new FileInputStream("/html/loremipsum.html"));

document.close();

Links

Website

138 questions
75
votes
5 answers

How to convert HTML to PDF using iTextSharp

I want to convert the below HTML to PDF using iTextSharp but don't know where to start:

This is some sample

Chris Haas
  • 53,986
  • 12
  • 141
  • 274
15
votes
3 answers

ItextSharp Error on trying to parse html for pdf conversion

I was using the ItextSharp module to convert the below listed html in to a pdf page.
mma
mmar


Click to View Pricing
karry
  • 3,270
  • 3
  • 18
  • 31
11
votes
2 answers

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

Is there possible to achieve writing text direction bottom-up in xmlworker? I would like to use it in table. My code is
Daniel
  • 197
  • 1
  • 3
  • 16
10
votes
2 answers

Inline CSS for hr not applied while converting html to pdf using iText library

I am using Itext library for android for converting html to pdf which is working fine but at certain things it is not parsing properly. I want to create a dotted line separator of red color but it is always gives me a solid line separator with dark…
Vishwajit Palankar
  • 3,033
  • 3
  • 28
  • 48
9
votes
1 answer

iTextSharp HTMLWorker.ParseToList() throws NullReferenceException

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…
hofnarwillie
  • 3,563
  • 10
  • 49
  • 73
9
votes
2 answers

IText prevent row breaking across multiple pages using XML Worker

we are using iText 5.5.7 with XML Worker and have encountered an issue with long tables where rows that run off the end of the page are split in two over to the next page (see image). We have tried using page-break-inside:avoid; as suggested in…
owlyfool
  • 337
  • 3
  • 13
8
votes
3 answers

iText7 convert HTML to PDF "System.NullReferenceException."

OLD TITLE: iTextSharp convert HTML to PDF "The document has no pages." I am using iTextSharp and xmlworker to convert html from a view to PDF in ASP.NET Core 2.1 I tried many code snippets I found online but all generate an exception: The…
Stefano Balzarotti
  • 1,760
  • 1
  • 18
  • 35
8
votes
1 answer

iText's XmlWorker does not recognize border-bottom on table cell

XmlWorker does not recognize border-bottom on table cell. This is my code:
sports
  • 7,851
  • 14
  • 72
  • 129
7
votes
1 answer

iTextSharp creates PDF with blank pages

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…
juliano.net
  • 7,982
  • 13
  • 70
  • 164
5
votes
1 answer

how to rotate pages into landscape and page content should be in portrait iTextpdf

I'm trying to create a PDF document with more than 2 pages in portrait and others in landscape, I found that both page and text rotates to landscape I need to prevent page content rotation. am using following code Document document = new…
arj
  • 887
  • 1
  • 15
  • 37
5
votes
2 answers

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

I'm trying to convert HTML to PDF using iTextSharp in an ASP.NET web application that uses both MVC, and web forms. The and elements have absolute and relative URLs, and some of the elements are base64. Typical answers here at SO and…
kuujinbo
  • 9,272
  • 3
  • 44
  • 57
5
votes
1 answer

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

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…
Jon Z
  • 55
  • 1
  • 4
4
votes
2 answers

Convert HTML to PDF by iText & XMLWorker with Polish Letters

I've got a string with an example in it - it works really great, but when I'm adding polish letters, they're gone. I tried something like this: byte[] byteArray = str.getBytes(Charset.forName("UTF-8")); ByteArrayInputStream…
KurdTt-
  • 449
  • 1
  • 5
  • 21
4
votes
2 answers

How to generate a valid PDF/A file using iText and XMLWorker (HTML to PDF/A process)

I'm currently developing a method that will accept HTML input and convert it into a valid PDF/A file. I know how to programmatically construct a valid PDF/A file using iText (reference: http://itextsupport.com/download/pdfa3.html) but I'm unable to…
Arturo
  • 713
  • 7
  • 14
4
votes
3 answers

RTL not working in pdf generation with itext 5.5 for Arabic text

I have java code that writes arabic characters with the help of itext 5.5 and xmlworker jars, but its writing left to right even after writer.setRunDirection(PdfWriter.RUN_DIRECTION_RTL) is used. Code used is: public class CreateArabic extends…
sheena
  • 77
  • 2
  • 6
1
2 3
9 10
Your name