HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › General questions / FAQ › UTF – 8 char issue › Re: Re: UTF – 8 char issue
I have tried with the following text :-
Arabic نيويورك
Japanese 定期購読お申し込みフォーム
Russian Эксперт Online
Other ÆØÅ_æ–øå_ö
中文名的来源
and the output is :-
Arabic نيويورك
Japanese
Russian Эксперт Online
Other ÆØÅ_æ–øå_ö
means chiness and japanese char display as blank
i have puted font.jar in web-inf lib folder and i changed my code as you suggested.
new code is :-
public File runConverter(File inputFileName, File outputFileName) throws IOException
{
if (inputFileName != null && outputFileName != null)
{
PD4ML pd4ml = new PD4ML();
pd4ml.enableSmartTableBreaks(true);
if (inputFileName.length() > 0)
{
InputStreamReader isr = new InputStreamReader(new FileInputStream(inputFileName), “UTF-8”);
java.io.FileOutputStream fos = new java.io.FileOutputStream(outputFileName);
/* START: CONFIGURATION FOR PAGE ORIENTATION */
try
{
pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.A4));
}
catch (Exception e)
{
e.printStackTrace();
}
/* END: CONFIGURATION FOR PAGE ORIENTATION */
/* START: CONFIGURATION FOR PAGE ORIENTATION */
pd4ml.setPageInsets(new Insets(10, 10, 10, 10));
/* END: CONFIGURATION FOR PAGE ORIENTATION */
/* START: CONFIGURATION FOR PAGE HEADER */
PD4PageMark pageMarkForHeader = new PD4PageMark();
pageMarkForHeader.setAreaHeight(10);
pageMarkForHeader.setHtmlTemplate(“Hi, this is for testing only that page is start
“);
pd4ml.setPageHeader(pageMarkForHeader);
/* END: CONFIGURATION FOR PAGE HEADER */
PD4PageMark pageMarkForFooter = new PD4PageMark();
pageMarkForFooter.setAreaHeight(10);
pageMarkForFooter.setInitialPageNumber(10);
pageMarkForFooter.setHtmlTemplate(“Hi, this is for testing only that page is end
“); // ${title} for title, ${page} for page number, ${total} for total number of pages
pd4ml.setPageFooter(pageMarkForFooter);
URL base = new URL( “file:C:/tempJava/” );
pd4ml.setHtmlWidth(780);
pd4ml.useTTF( “java:fonts”, true );
pd4ml.setDefaultTTFs(“Times New Roman”, “Arial”, “Courier New”);
pd4ml.render(isr, fos, base);
}
}
return outputFileName;
}