HTML to PDF / DOCX / RTF Java converter library Forums PD4ML v3 Archived Forums (Read Only) Troubleshooting getting NullPointerException when "Content-Type" is set

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26636

    Hello,
    I keep getting NPEs when I’m attempting to render an RTF doc.

    Below is the test.

    Thanks,
    Nathan

    <br /> package com.nwest.tests.pd4ml;<br /> <br /> import java.io.ByteArrayOutputStream;<br /> import java.io.IOException;<br /> import java.io.StringReader;<br /> <br /> import org.zefer.pd4ml.PD4Constants;<br /> import org.zefer.pd4ml.PD4ML;<br /> <br /> public class PDFConverterTest<br /> {<br /> private static String doesNotWork = "<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>blah</title></head><body><div>test</div></body></html>";<br /> private static String works = "<html xmlns="http://www.w3.org/1999/xhtml"><head><title>blah</title></head><body><div>test</div></body></html>";<br /> <br /> public static ByteArrayOutputStream createDocument(String pageOrientation, String documentContent, String format)<br /> throws IOException<br /> {<br /> PD4ML pd4ml = new PD4ML();<br /> <br /> if (format.equals(PD4Constants.PDF) || format.equals(PD4Constants.RTF))<br /> {<br /> pd4ml.outputFormat(format);<br /> }<br /> <br /> StringReader reader = new StringReader(documentContent);<br /> ByteArrayOutputStream baos = new ByteArrayOutputStream();<br /> <br /> pd4ml.render(reader, baos);<br /> <br /> return baos;<br /> }<br /> <br /> public static void main(String args[]) {<br /> try {<br /> PDFConverterTest.createDocument("landscape", works, PD4Constants.RTF);<br /> System.out.println("no meta works");<br /> <br /> PDFConverterTest.createDocument("landscape", doesNotWork, PD4Constants.RTF);<br /> System.out.println("doesNotWork");<br /> <br /> } catch (IOException e) {<br /> <br /> }<br /> }<br /> }<br /> <br /> <br />

    #28733

    Thank you for the report!

    We’ve just fixed the issue in the development build. The fix will be available with the next beta release.

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘Troubleshooting’ is closed to new topics and replies.