use aspose.pdf convert a pdf to html in windows is success, but in centos6.5 is fail and not throw Exception。
Hi Jiaokun,
Do you have any test results?
Hi Jiaokun,
Hi Jiaokun,
com.aspose.pdf.Document
doc = new com.aspose.pdf.Document(dataDir + “test.pdf”);<o:p></o:p>
HtmlSaveOptions options = new HtmlSaveOptions();
doc.save(dataDir + "PDFToHtml2_out.html", options);
We will really appreciate if you please share more information regarding scenario i.e the JDK Version and API Version along with code snippet which you are using, so that we can test the scenario again in our environment and address it accordingly.
Best Regards,
Hi Jiaokun,
public void PDFToHtml()<o:p></o:p>
{
com.aspose.pdf.Document doc = new com.aspose.pdf.Document(dataDir + "test.pdf");
doc.save(dataDir + "PDFToHtml_out.html", getHtmlSaveOptions(dataDir + "xys.html"));
}
protected HtmlSaveOptions getHtmlSaveOptions(final String targetPath)
{
HtmlSaveOptions newOptions = new HtmlSaveOptions();
newOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
newOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats;
newOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
newOptions.LettersPositioningMethod = LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
newOptions.setSplitIntoPages(false);
newOptions.CustomHtmlSavingStrategy = new HtmlSaveOptions.HtmlPageMarkupSavingStrategy()
{
@Override
public void invoke(HtmlSaveOptions.HtmlPageMarkupSavingInfo htmlSavingInfo)
{
byte[] resultHtmlAsBytes;
try {
resultHtmlAsBytes = org.apache.commons.io.IOUtils.toByteArray(htmlSavingInfo.ContentStream);
htmlSavingInfo.ContentStream.read(resultHtmlAsBytes, 0, resultHtmlAsBytes.length);
htmlSavingInfo.ContentStream.read(resultHtmlAsBytes, 0, resultHtmlAsBytes.length);
FileOutputStream fos = null;
try
{
fos = new FileOutputStream(targetPath);
fos.write(resultHtmlAsBytes);
fos.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
try
{
if (null != fos) {
fos.close();
}
} catch (Exception e) {
}
}
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
};
return newOptions;
}