I have a PDF file containing Arabic text and a watermark. I am using PDFBox to print the PDF from Java. My issue is the PDF is printed with high quality, but all the lines with Arabic characters have junk characters instead. Could somebody help on this?
Code:
String pdfFile = "C:/AresEPOS_Home/Receipts/1391326264281.pdf";
PDDocument document = null;
try {
document = PDDocument.load(pdfFile);
//PDFont font = PDTrueTypeFont.loadTTF(document, "C:/Windows/Fonts/Arial.ttf");
PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setJobName(new File(pdfFile).getName());
PrintService[] printService = PrinterJob.lookupPrintServices();
boolean printerFound = false;
for (int i = 0; !printerFound && i < printService.length; i++) {
if (printService[i].getName().indexOf("EPSON") != -1) {
printJob.setPrintService(printService[i]);
printerFound = true;
}
}
document.silentPrint(printJob);
}
finally {
if (document != null) {
document.close();
}
}