Conversion process fails on “save” with a java.lang.NullPointerException in com.aspose.xps.rendering.ApsDevice.lif. The original xps document can be viewed in xps viewer without a problem. Has anybody seen this type of problem?
Could you please share your sample XPS file with us so that we can test the scenario in our environment and address it accordingly.
I decided to try the latest version of “pages” and while testing with a simple xps file that works with version 19.6, I discovered that it fails with the following message with all the libraries 20.x. The error message is “Cannot create graphic object from indexed image format”.
at com.aspose.page.internal.l174.I47.(Unknown Source)
at com.aspose.page.internal.l174.I1l.lif(Unknown Source)
at com.aspose.page.internal.l174.I71.l0l(Unknown Source)
at com.aspose.xps.rendering.I7.lif(Unknown Source)
at com.aspose.xps.rendering.I7.fill(Unknown Source)
at com.aspose.xps.rendering.PdfDevice.fill(Unknown Source)
at com.aspose.xps.I7I.lif(Unknown Source)
at com.aspose.xps.XpsPath.lif(Unknown Source)
at com.aspose.xps.XpsElement.lif(Unknown Source)
at com.aspose.xps.XpsPage.lif(Unknown Source)
at com.aspose.xps.I1l.lif(Unknown Source)
at com.aspose.xps.I31.lIf(Unknown Source)
at com.aspose.xps.XpsDocument.save(Unknown Source)
I would like to share the file but the sensitive nature of the document is creating a few obstacles. I will need to get the OK from the management.
You may also share your sample file in a private message if you do not want to share it publicly. You can send a private message by clicking over username and pressing the Blue Message Button.
Additional information. I tried converting the same xps document that produced this error:
java.lang.NullPointerException in com.aspose.xps.rendering.ApsDevice.lif
using aspose-page-20.12 library and the result is very different. Here is the error stack:
class com.aspose.page.internal.l161.I0l: .WDP images conversion is not supported.
It appears to think that the image contained in the xps docuement is of WDP format. Again, the xps viewer has no problem with this file
More information on the xps file in question. I analyzed the contents of the xps file we are trying to convert to pdf and I discovered that it does indeed contain images in wdp format:
Index Filename Encrypted Timestamp
1 Documents/1/Metadata/Document_PT.xml 0 2018-11-01 14:01:40
2 Documents/1/Resources/Images/PIX_0_0.wdp 0 2018-11-01 14:01:40
3 Documents/1/Resources/Images/PIX_0_1.wdp 0 2018-11-01 14:01:40
4 Documents/1/Resources/Images/PIX_0_2.wdp 0 2018-11-01 14:01:40
5 Documents/1/Resources/Images/PIX_0_3.wdp 0 2018-11-01 14:01:40
6 Documents/1/Resources/Images/PIX_0_4.wdp 0 2018-11-01 14:01:40
7 Metadata/Job_PT.xml 0 2018-11-01 14:01:42
8 Documents/1/Pages/_rels/Esc1.fpage.rels 0 2018-11-01 14:01:42
9 Documents/1/Pages/Esc1.fpage 0 2018-11-01 14:01:42
10 Documents/1/_rels/FixedDocument.fdoc.rels 0 2018-11-01 14:01:42
11 Documents/1/FixedDocument.fdoc 0 2018-11-01 14:01:42
12 _rels/FixedDocumentSequence.fdseq.rels 0 2018-11-01 14:01:42
13 FixedDocumentSequence.fdseq 0 2018-11-01 14:01:42
14 _rels/.rels 0 2018-11-01 14:01:42
15 [Content_Types].xml 0 2018-11-01 14:01:42
Now the question is, what are our options if aspose does not handle this format?
As far as this new issue that has appeared in versions 20.x of the aspose.page, I found similar problem with the aspose.slide was reported and, apparently fixed in the version 20.6. I wonder if the same issue exists in the page module but just wasn’t reported just yet.
The issue you are facing needs to be properly investigated and resolved. In order to do that, we need a sample file (as requested earlier). We will be able to share further comments on the situation after replicating the issue on our side. Yes, there is a possibility that it is some kind of regression in the API but still, it needs to be investigated to get fixed.