E. Jacob wrote:
I’m trying to convert a xsl file to a rtf file using the Code example from your 
Website

(https://www.xmlmind.com/foconverter/_distrib/doc/user/samples/java/Sample1.java)

I changed it a bit to:

public class RTFConverter {
    public static void main(String[] args) {

        File inFile = new File("bla.xsl");
        File outFile = new File("hello.rtf");

        try {
            Converter converter = new Converter();
            converter.setProperty("outputFormat", "rtf");
            converter.setProperty("outputEncoding", "Cp1252");
            converter.setProperty("imageResolution", "120");

            InputSource src = new InputSource(inFile.toURI().toASCIIString());
            OutputDestination dst = new OutputDestination(outFile.getPath());
            converter.convert(src, dst);
        } catch (Exception e) {
            System.err.println("cannot convert '" + inFile +
                    "' to '" + outFile + "': " + e);
            System.exit(2);
        }
    }
}

But everytime i try to convert the file im getting a NullPointerException

„cannot convert 'bla.xsl' to 'hello.rtf': java.lang.NullPointerException“


Please notice that "Sample1.java" starts with:
---
        if (args.length != 2) {
            System.err.println("usage: java Sample1 fo_file rtf_file");
            System.exit(1);
        }
---

But your "bla.xsl" does not seem to be an XSL-FO file (https://www.w3.org/TR/2001/REC-xsl-20011015/). It seems to be an XSLT stylesheet (https://www.w3.org/TR/xslt/). If this is the case, any kind of error may occur, including a NullPointerException.

Also please note that:

- I'm not supposed to help you. More information in "XMLmind XSL-FO Converter support policy": https://www.xmlmind.com/foconverter/support_policy.html

- Because you are not a customer, you are almost certainly using our Evaluation Edition. This Evaluation Edition generates output containing random duplicate letters. See https://www.xmlmind.com/foconverter/downloadeval.shtml#about_eval




--
XMLmind FO Converter Support List
[email protected]
https://www.xmlmind.com/mailman/listinfo/xfc-support

Reply via email to