Exception while converting XPS to PDF


I’m evaluating Aspose.PDF for use as an XPS to PDF converter inside of a larger .NET application. When trying to convert certain XPS documents, I am encountering the following exception.

Exception during XPS to PDF: System.ArgumentException: Parameter is not valid.
at System.Drawing.Bitmap…ctor(Stream stream)
at ??:slight_smile::slight_smile:.:left_right_arrow:?▲:heart:.▼∟⌂(XmlNode )
at ??:slight_smile::slight_smile:.:left_right_arrow:?▲:heart:.??:slight_smile::slight_smile:(XmlNode )
at ??:slight_smile::slight_smile:.:left_right_arrow:?▲:heart:.?∟⌂(XmlNode )
at ??:slight_smile::slight_smile:.▲?▲:heart:.??☼(XmlNode , ↑?☼:diamonds: )
at ??:slight_smile::slight_smile:.⌂?▲:heart:.?∟⌂(XmlNode , ↑?☼:diamonds: )
at ??:slight_smile::slight_smile:.⌂?▲:heart:.?∟⌂(XmlNode , ↑?☼:diamonds: )
at ??:slight_smile::slight_smile:.??▲:heart:.?∟⌂(XmlNode )
at ??:slight_smile::slight_smile:.:arrow_up_down:?:left_right_arrow:.↑:left_right_arrow:⌂(String )
at ??:slight_smile::slight_smile:.:arrow_up_down:?:left_right_arrow:.Convert(Stream )
at ??:slight_smile::slight_smile:.???.Convert(Stream , ??:slight_smile::slight_smile: )
at ?:diamonds:♫.¶:diamonds::bangbang:.??☼(Stream , Document , XpsLoadOptions , Boolean )
at Aspose.Pdf.Document.→?(Stream , LoadOptions )
at Aspose.Pdf.Document…ctor(Stream input, LoadOptions options)
at TestPDFConversion.Program.XpsToPdf(Stream xpsFile) in c:\builds\STX-HostAgents-RemotePrinting\TestPDFConversion\Program.cs:line 48

This is using version of Aspose.PDF, the attached XPS file, and the following Aspose code.

var xpsStream = File.Open(filename, FileMode.Open);
MemoryStream pdfStream = new MemoryStream();
Document document = new Document(xpsStream, new XpsLoadOptions());

Thanks for any help you can offer!

Hi there,

Thanks for your inquiry. I have tested your scenario with shared XPS document using Aspose.Pdf for .NET 11.3.0 and managed to observe the reported exception. For further investigation, I have logged an issue in our issue tracking system as PDFNEWNET-40325 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

We are sorry for the inconvenience caused.

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;mso-fareast-font-family:
mso-bidi-language:AR-SA”>Best Regards,

Hi Tilal,

I’m glad you were able to reproduce the error. Has there been any further work on this issue or do you have any updates you could share?


Hi there,

Thanks for your feedback. I am afraid your issue is still not resolved, our product team is busy in resolving the issues in the queue, reported earlier. As soon as our product team completes the investigation of the issue then we will share any ETA/findings with you. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience.

Best Regards,

The issues you have found earlier (filed as PDFNET-40325) have been fixed in Aspose.PDF for .NET 23.4.