PDF Generating Tool Support Forum

HOME   Login   Register    Search

  Subject: getting NullPointerException when "Content-Type" is set
   PostPosted: 06 Dec 2011, 00:46 
I keep getting NPEs when I'm attempting to render an RTF doc.

Below is the test.


package com.nwest.tests.pd4ml;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.StringReader;

import org.zefer.pd4ml.PD4Constants;
import org.zefer.pd4ml.PD4ML;

public class PDFConverterTest
   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>";
   private static String works = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>blah</title></head><body><div>test</div></body></html>";

   public static ByteArrayOutputStream createDocument(String pageOrientation, String documentContent, String format)
         throws IOException
      PD4ML pd4ml = new PD4ML();

      if (format.equals(PD4Constants.PDF) || format.equals(PD4Constants.RTF))

      StringReader reader = new StringReader(documentContent);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();

      pd4ml.render(reader, baos);

      return baos;
   public static void main(String args[]) {
      try {
         PDFConverterTest.createDocument("landscape", works, PD4Constants.RTF);
         System.out.println("no meta works");

         PDFConverterTest.createDocument("landscape", doesNotWork, PD4Constants.RTF);
      } catch (IOException e) {

  Subject: Re: getting NullPointerException when "Content-Type" is set
   PostPosted: 06 Dec 2011, 15:42 
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.

[Reply]     [ 2 posts ] 

Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share