I am evaluating iText as a PDFGenerator for java swing application. The output is supposed to be in \"Marathi\", which is a local Indian langauge similar to hindi but not sa
The following worked for me.
import java.awt.Graphics2D;
import java.io.*;
import com.lowagie.text.*;
public class Test {
/** Path to the resulting PDF file. */
public static final String RESULT
= "/home/test.pdf";
/**
* Creates a PDF file: test.pdf
* @param args no arguments needed
*/
public static void main(String[] args)
throws DocumentException, IOException {
Document document = new Document();
PdfWriter writer =
PdfWriter.getInstance(document, new FileOutputStream(RESULT));
document.open();
int w = 400;
int h = 150;
PdfContentByte cb = writer.getDirectContent();
PdfTemplate tp = cb.createTemplate(w, h);
Graphics2D g2 = tp.createGraphicsShapes(w, h);
g2.drawString("मराठी ग्रीटींग्स, मराठी शुभेच्छापत्रे", 20, 100);
g2.dispose();
cb.addTemplate(tp, 50, 400);
document.close();
}
}