I am evaluating Aspose for support for Khmer, and if it is fit for use for our purpose
We need to convert html into pdf. The html contains styles to embed fonts as below
And I am trying to convert it using the following code
String basePath = "c:\\basePath\\";
com.aspose.pdf.HtmlLoadOptions htmloptions = new com.aspose.pdf.HtmlLoadOptions(basePath);
String basePath = "c:\\basePath\\";
com.aspose.pdf.HtmlLoadOptions htmloptions = new com.aspose.pdf.HtmlLoadOptions(basePath);
// htmloptions.setInputEncoding("UTF-8");
// TextState txtState = new TextState();
// txtState.setFont(FontRepository.openFont(basePath + "KhmerOS.ttf"));
// htmloptions.getPageInfo().setDefaultTextState(txtState);
// Load HTML file
com.aspose.pdf.Document doc = new com.aspose.pdf.Document(basePath+"test.html", htmloptions);
// Save HTML file
doc.save("c:\\basePath\\result.pdf");
Is something like this even possible using Aspose? Given that the font has been embedded in the html, ideally there should be no need to specify the font again in java at the time of conversion. Even if I do it doesn't work
Is there an example that I can look at?
Thanks
We need to convert html into pdf. The html contains styles to embed fonts as below
<html>
<head>
<style type="text/css">
@font-face{
font-family: 'KhmerOS';
src: url("KhmerOS.ttf");
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: Identity-H;
}
@font-face{
font-family: 'KhmerOSmuollight';
src: url('KhmerOSmuollight.ttf');
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: Identity-H;
}
.khmertext {
font-family: "Khmer OS","KhmerOS", "KhmerOSmuollight",sans-serif;
}
</style>
</head>
<body>
<div class="khmertext">This is Khmer = វិញ្ញាបនប័ត្ររបស់កេ</div>
</body>
</html>
And I am trying to convert it using the following code
String basePath = "c:\\basePath\\";
com.aspose.pdf.HtmlLoadOptions htmloptions = new com.aspose.pdf.HtmlLoadOptions(basePath);
String basePath = "c:\\basePath\\";
com.aspose.pdf.HtmlLoadOptions htmloptions = new com.aspose.pdf.HtmlLoadOptions(basePath);
// htmloptions.setInputEncoding("UTF-8");
// TextState txtState = new TextState();
// txtState.setFont(FontRepository.openFont(basePath + "KhmerOS.ttf"));
// htmloptions.getPageInfo().setDefaultTextState(txtState);
// Load HTML file
com.aspose.pdf.Document doc = new com.aspose.pdf.Document(basePath+"test.html", htmloptions);
// Save HTML file
doc.save("c:\\basePath\\result.pdf");
Is something like this even possible using Aspose? Given that the font has been embedded in the html, ideally there should be no need to specify the font again in java at the time of conversion. Even if I do it doesn't work
Is there an example that I can look at?
Thanks