Khmer unicode is not shown in PDF doc

I want to create a pdf doc which can display khmer language (Unicode font).Here is my code


String fontPath = Environment.getExternalStorageDirectory()
+ File.separator
+ “FontsTest”
+ File.separator
+ “khmerOS.ttf”;
textFragment.getTextState().setFont(com.aspose.pdf.FontRepository.openFont(fontPath, “”));

But is does’t show anything. How to use custom font in android project?

Here I have attached the fonts.

Thanks.

Hi Biswajit,


Thanks for your inquiry. Please check following code snippet to use your custom fonts. Hopefully it will help you to accomplish the task.

// Open font
Font font = FontRepository.OpenFont(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Fonts/khmerOS.ttf");
textFragment.getTextState().setFont(font));

Please feel free to contact us for any further assistance.

Best Regards,

Hi Tilal,

I have tried but it display nothing. Here is the code :

import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.view.Menu;
import android.widget.TextView;
import com.aspose.java.awt.Color;
import com.aspose.pdf.FontRepository;
import com.aspose.pdf.Page;
public class MainActivity extends Activity {
static com.aspose.pdf.Font font;
private static void HelloWorld()
{
String outputPath=Environment.getExternalStorageDirectory().getAbsolutePath();
com.aspose.pdf.Document pdfDocument1 = new com.aspose.pdf.Document();
// add a page to PDF file
Page page= pdfDocument1.getPages().add();
// add text in new page
//create text fragment
com.aspose.pdf.TextFragment textFragment = new com.aspose.pdf.TextFragment(“ការ​ស្ទង់​មតិ​បង្ហាញ​ថា​មាន​ការ​កើន​ឡើង​ការ​មិន​ពេញ​ចិត្ត​ចំពោះ​ការ​ដឹកនាំ​របស់​រដ្ឋាភិបាល”);
textFragment.setPosition(new com.aspose.pdf.Position(100, 600));
//set text properties
textFragment.getTextState().setFont(font);
//textFragment.getTextState().setFont(com.aspose.pdf.FontRepository.findFont(“Helvetica”));
textFragment.getTextState().setFontSize(14);
textFragment.getTextState().setForegroundColor(Color.BLUE);
textFragment.getTextState().setBackgroundColor(Color.GRAY);
// create TextBuilder object
com.aspose.pdf.TextBuilder textBuilder = new com.aspose.pdf.TextBuilder(page);
// append the text fragment to the PDF page
textBuilder.appendText(textFragment);
// save the PDF file
pdfDocument1.save(outputPath + “/HelloWorld.pdf”);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
font = FontRepository.openFont(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Fonts/khmerOS.ttf");
final TextView tx = (TextView) findViewById(R.id.textBox);
try {
HelloWorld();
tx.setText(“Documents created successfully, please check the root of your SD card”);
} catch (Exception e) {
tx.setText("Error during document processing: " + e.getMessage());
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}

Hi Biswajit,


Thanks for the feedback. We are working over this query and will get back to you soon.

Hi Biswajit,


Thanks for your patience.

I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFANDROID-269. We will
investigate this issue in details and will keep you updated on the status of a
correction. <o:p></o:p>

We apologize for your inconvenience.

The issues you have found earlier (filed as PDFANDROID-269) have been fixed in Aspose.Pdf for Android 1.7.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan