Hello!
I’m trying convert section’s pages to HTML using Aspose.Note for java. But I get exception if page contains printout of .xps file.
Exception:
class com.aspose.note.system.exceptions.ArgumentException: Error loading file: Unsupported file format
Parameter name: input
com.aspose.note.internal.at.b.a(Unknown Source)
com.aspose.note.internal.at.b.<init>(Unknown Source)
com.aspose.note.internal.at.b.<init>(Unknown Source)
com.aspose.note.internal.N.a.<init>(Unknown Source)
com.aspose.note.internal.al.e.a(Unknown Source)
com.aspose.note.internal.al.e.a(Unknown Source)
com.aspose.note.internal.ah.d.a(Unknown Source)
com.aspose.note.internal.ah.d.a(Unknown Source)
com.aspose.note.internal.u.h.a(Unknown Source)
com.aspose.note.internal.u.j.a(Unknown Source)
com.aspose.note.internal.u.d.a(Unknown Source)
com.aspose.note.internal.fixed2float.b.a(Unknown Source)
com.aspose.note.internal.html.n.a(Unknown Source)
com.aspose.note.internal.html.n.a(Unknown Source)
com.aspose.note.ar.d(Unknown Source)
com.aspose.note.r.a(Unknown Source)
com.aspose.note.Document.save(Unknown Source)
com.example.Main.main(Main.java:40)
at com.aspose.note.internal.at.b.a(Unknown Source)
at com.aspose.note.internal.at.b.<init>(Unknown Source)
at com.aspose.note.internal.at.b.<init>(Unknown Source)
at com.aspose.note.internal.N.a.<init>(Unknown Source)
at com.aspose.note.internal.al.e.a(Unknown Source)
at com.aspose.note.internal.al.e.a(Unknown Source)
at com.aspose.note.internal.ah.d.a(Unknown Source)
at com.aspose.note.internal.ah.d.a(Unknown Source)
at com.aspose.note.internal.u.h.a(Unknown Source)
at com.aspose.note.internal.u.j.a(Unknown Source)
at com.aspose.note.internal.u.d.a(Unknown Source)
at com.aspose.note.internal.fixed2float.b.a(Unknown Source)
at com.aspose.note.internal.html.n.a(Unknown Source)
at com.aspose.note.internal.html.n.a(Unknown Source)
at com.aspose.note.ar.d(Unknown Source)
at com.aspose.note.r.a(Unknown Source)
at com.aspose.note.Document.save(Unknown Source)
at com.example.Main.main(Main.java:40)
Code I use:
public static void main(String[] args) throws IOException {
Path path = Path.of("path to .one file");
Path target = path.getParent().resolve("res");
Document section = new Document(path.toString());
List<Page> pages = section.getChildNodes(Page.class);
for (int index = 0; index < pages.size(); index++) {
try {
String pageName = Path.of(target.toString(), index + "").toString();
section.save(pageName, options(index));
} catch (Exception e) {
e.printStackTrace();
}
}
}
private static SaveOptions options(int pageIndex) {
HtmlSaveOptions options = new HtmlSaveOptions();
options.setExportCss(ResourceExportType.NoExport);
options.setExportFonts(ResourceExportType.NoExport);
options.setExportImages(ResourceExportType.ExportAsStream);
options.setPageCount(1);
options.setPageIndex(pageIndex);
return options;
}
One note section file: New Section 1.one.zip (505.5 KB)
Problem appears during converting of first page ‘Page’. If I use .pdf file instead of .xps as a printout then all is ok (see second page in attached file - ‘Page pdf’)
I’m using Aspose.Note for Java version 22.9, but problem appears on last version 23.3 too
Is there any limitations on .xps files? Or this is bug?
Thanks