0

I'm trying to create PDF using iText in Java. When i tried to write HTML tags in my PDF it created like <a href="https://www.google.co.in">Google</a> instead of Google(as a link). After searching net i tried using XMLWorkerHelper. But my eclipse giving error as The method parseXHtml(PdfWriter, Document, InputStream) from the type XMLWorkerHelper refers to the missing type PdfWriter I'm not getting what is this error.

try {
    String k = "<html><body> This is my Project </body></html>";
    OutputStream file = new FileOutputStream(new File("C:\\Test.pdf"));
    Document document = new Document();
    PdfWriter writer = PdfWriter.getInstance(document, file);
    document.open();
    InputStream is = new ByteArrayInputStream(k.getBytes());
    XMLWorkerHelper.getInstance().parseXHtml(writer, document, is);
    document.close();
    file.close();
} catch (Exception e) {
    e.printStackTrace();
}

I want to know which PdfWriter i should use. I'm using xmlworker-5.4.1.jar jar file.

1 Answer 1

2

Looking at the com.itextpdf.tool.xml.XMLWorkerHelper source code, it looks like it is depending on com.itextpdf.text.pdf.PdfWriter which is part of the itextpdf-5.4.1.jar

Sign up to request clarification or add additional context in comments.

2 Comments

Why not use the latest version of iText, 5.4.4?
No special reason. Sathesh was referring to 5.4.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.