Hi, I’m very new to this, I just wanted to make an application that would make my life easier, but I got the following error while converting an html file to a pdf file. Maybe this is something that can be solved very easily, but I couldn’t find a solution for 3 days. Could someone help me?
part of my basic code:
String downloadsPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
String htmlFilePath = downloadsPath + "/test.html";
String pdfFilePath = downloadsPath + "/output.pdf";
try {
HtmlLoadOptions htmloptions = new HtmlLoadOptions();
Document doc = new Document(new FileInputStream(htmlFilePath), htmloptions);
doc.save(pdfFilePath);
} catch (IOException e) {
throw new RuntimeException(e);
}
and error:
E FATAL EXCEPTION: main | look right for error ------>
Process: com.lyki.easyapp, PID: 19247
class com.aspose.pdf.exceptions.PdfException: Unsupported load format
com.aspose.pdf.ADocument.m1(Unknown Source:44)
com.aspose.pdf.ADocument.<init>(Unknown Source:46)
com.aspose.pdf.Document.<init>(Unknown Source:4)
com.lyki.easyapp.MainActivity.lambda$onCreate$1$com-lyki-easyapp-MainActivity(MainActivity.java:152)
com.lyki.easyapp.MainActivity$$ExternalSyntheticLambda1.onClick(Unknown Source:2)
android.view.View.performClick(View.java:7448)
android.view.View.performClickInternal(View.java:7425)
android.view.View.access$3600(View.java:810)
android.view.View$PerformClick.run(View.java:28305)
android.os.Handler.handleCallback(Handler.java:938)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:223)
android.app.ActivityThread.main(ActivityThread.java:7656)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
at com.aspose.pdf.ADocument.m1(Unknown Source:44)
at com.aspose.pdf.ADocument.<init>(Unknown Source:46)
at com.aspose.pdf.Document.<init>(Unknown Source:4)
at com.lyki.easyapp.MainActivity.lambda$onCreate$1$com-lyki-easyapp-MainActivity(MainActivity.java:152)
at com.lyki.easyapp.MainActivity$$ExternalSyntheticLambda1.onClick(Unknown Source:2)
at android.view.View.performClick(View.java:7448)
at android.view.View.performClickInternal(View.java:7425)
at android.view.View.access$3600(View.java:810)
at android.view.View$PerformClick.run(View.java:28305)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
+ test.html file
test.zip (1.2 KB)
+ using aspose-pdf-23.2-android.via.java.jar
Thanks,