package com.example.convert;


import com.lowagie.text.Document;

import com.lowagie.text.DocumentException;

import com.lowagie.text.pdf.PdfWriter;

import com.lowagie.text.rtf.parser.RtfParser;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;

public class ConvertRTFToPDF {


public static void main(String[] args) {

String inputFile = "D:\\yaser.rtf";

String outputFile = "D:\\sample_converted.pdf";

// create a new document

Document document = new Document();

try {

// create a PDF writer to save the new document to disk

PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(outputFile));

// open the document for modifications

document.open();

// create a new parser to load the RTF file

RtfParser parser = new RtfParser(null);

// read the rtf file into a compatible document

parser.convertRtfDocument(new FileInputStream(inputFile), document);

// save the pdf to disk

document.close();

System.out.println("Finished");

} catch (DocumentException e) {

e.printStackTrace();

} catch (FileNotFoundException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

}

}

}

سلام دوستان
در جاوا کدی نوشتم بدین صورت اما یک چنین خطایی میده
Exception in thread "main" java.lang.NullPointerException
at com.lowagie.text.rtf.parser.destinations.RtfDestin ationFontTable.importSystemFonts(Unknown Source)
at com.lowagie.text.rtf.parser.destinations.RtfDestin ationFontTable.init(Unknown Source)
at com.lowagie.text.rtf.parser.destinations.RtfDestin ationFontTable.setParser(Unknown Source)
at com.lowagie.text.rtf.parser.destinations.RtfDestin ationMgr.addDestination(Unknown Source)
at com.lowagie.text.rtf.parser.ctrlwords.RtfCtrlWordH andler.<init>(Unknown Source)
at com.lowagie.text.rtf.parser.ctrlwords.RtfCtrlWordM ap.<init>(Unknown Source)
at com.lowagie.text.rtf.parser.ctrlwords.RtfCtrlWordM gr.<init>(Unknown Source)
at com.lowagie.text.rtf.parser.RtfParser.init(Unknown Source)
at com.lowagie.text.rtf.parser.RtfParser.convertRtfDo cument(Unknown Source)
at com.example.convert.ConvertRTFToPDF.main(ConvertRT FToPDF.java:56)

تمامی jar های موردنظر رو به پروژه اضافه کردم کسی می تونه راهنماییم کنه که مشکل کجاست؟