谁能告诉我如何用乌尔都语或除英语以外的任何其他语言生成 pdf 报告?我只想要乌尔都语的标题(硬编码)。所有其他字段均为英文。那么我怎样才能用乌尔都语写我的标题呢?我正在尝试的只是不起作用。pdf 已创建,但未显示 urdu。这是我的代码:
private void savePDF(){
Document mDoc = new Document();
fileName = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.getDefault()).format(System.currentTimeMillis());
filePath = Environment.getExternalStorageDirectory() + "/Cattle App/" ;
try{
File dir = new File(filePath);
if (!dir.exists())
dir.mkdirs();
file = new File(dir, selName + "_" +fileName+".pdf");
FileOutputStream fOut = new FileOutputStream(file);
PdfWriter.getInstance(mDoc,fOut);
mDoc.open();
mDoc.addTitle("Cattle App");
mDoc.addSubject("Add Buyer and sellers");
mDoc.addKeywords("Cattle App");
mDoc.addAuthor("Softix");
mDoc.addCreator("Fahad");
Paragraph preface = new Paragraph();
Paragraph repTitle = new Paragraph("الیکٹرونک ریکارڈ مینیجمنٹ سسٹم", catFont);
repTitle.setAlignment(Element.ALIGN_CENTER);
preface.add(repTitle);
Paragraph repTitlepowered = new Paragraph("رسید براے ٹیکس فری کیٹل مارکیٹ____________________________", smallBold);
repTitlepowered.setAlignment(Element.ALIGN_CENTER);
preface.add(repTitlepowered);
Paragraph emptyL = new Paragraph("\n");
preface.add(emptyL);
mDoc.add(preface);
mDoc.close();
}catch (Exception e){
Toast.makeText(this, ""+e.getMessage(), Toast.LENGTH_SHORT).show();
}
}