Can't convert section's page to HTML if there is .xps printout on page

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

@foat,

Thanks for the sample document.

I am able to reproduce the issue as you mentioned while rendering pages to HTMLs. I could not convert section’s page to HTML if there is .xps printout on OneNote document page. I got the same exception as you described. We need to evaluate your issue in details.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): NOTEJAVA-1184

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

@foat,

We have evaluated your issue in detail. The problem is caused by an image on the first page of the document. Currently, we are working on fixing the issue. Hopefully, our next Aspose.Note for Java release will include the bug fix. You will be notified once the next version is published.

Please stay in touch.

The issues you have found earlier (filed as NOTEJAVA-1184) have been fixed in this update. This message was posted using Bugs notification tool by senua.remizova

Hi @amjad.sahi
I tried Aspose.Note ver. 23.7, it works correct! Thank you very much!

@foat,

Thank you for your feedback. It is nice to know that your issue was resolved by using the latest version of the API. Should you have any further queries or issues, feel free to write us back.

1 Like