我需要在 pdf 文档中打印出土耳其字符,如“ş”、“ç”、“ü”等。我正在使用以下代码。
global class InvoicePDFGenerator {
public static final String FORM_HTML_START = '<HTML><BODY>';
public static final String FORM_HTML_END = '</BODY></HTML>';
webservice static void generateInvoicePDF(String invoiceId){
OppoInvoice__c invoice= [SELECT Id,Account_Name__c FROM OppoInvoice__c WHERE Id=:invoiceId];
String pdfContent = '';
try {
pdfContent = '<html><head><meta http-equiv=content-type content=text/html;charset=iso-8859-9></meta></head><body>';
pdfContent = pdfContent + '<P>' + invoice.Account_Name__c+ '</P>';
pdfContent = pdfContent + FORM_HTML_END;
}catch(Exception e){
pdfContent = '' + FORM_HTML_START;
pdfContent = pdfContent + '<P>THERE WAS AN ERROR GENERATING PDF: ' + e.getMessage() + '</P>';
pdfContent = pdfContent + FORM_HTML_END;
}
Attachment attachmentPDF = new Attachment();
attachmentPDF.parentId = invoice.Id;
attachmentPDF.Name = 'Invoice.pdf';
attachmentPDF.body = Blob.toPDF(pdfContent); //This creates the PDF content
insert attachmentPDF;
}
}
attachmentPDF.body = Blob.toPDF(pdfContent)
我认为是从线引起的问题。你对这个问题有什么想法吗?