Aspose.Pdf Save to xps - first page is entirely black

out.pdf (46.5 KB)

This function Opens a Pdf file and then Saves the content as an xps file:

    static void f2(string iFile, string oFile)
    {
        Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(iFile);
        Aspose.Pdf.XpsSaveOptions xo = new Aspose.Pdf.XpsSaveOptions();
        pdf.Save(oFile, xo);
    }

When I call this function on the uploaded out.pdf file, the xps file produced has a first page which is entirely black. The pdf content simply contains empty spreadsheet boxes - nothing fancy at all.

This behaviour exists in aspose.pdf 19.4

If you open the XML file /Documents/1/Pages/1.fpage, it starts like this:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<FixedPage xmlns="http://schemas.microsoft.com/xps/2005/06" xmlns:x="http://schemas.microsoft.com/xps/2005/06/resourcedictionary-key" xml:lang="en-us" Width="793.333333333" Height="1121.333333333" Name="Page1">
    <Canvas RenderTransform="1.333333373,0,0,1.333333373,0,0">
	    <Canvas>
		    <Canvas Clip="F1 M0,841 L0,-0.890014648 L0,-0.890014648 L595.280029297,-0.890014648 L595.280029297,-0.890014648 L595.280029297,841 L595.280029297,841 L0,841 Z">
			    <Path RenderTransform="1,0,0,-1,0,841" Data="F1 M0,841.890014648 L0,0 L0,0 L595.280029297,0 L595.280029297,0 L595.280029297,841.890014648 L595.280029297,841.890014648 L0,841.890014648 Z">
				    <Path.Fill>
					    <SolidColorBrush Color="#FF000000" />
				    </Path.Fill>
			    </Path>   . . . 

The problem is that the Path is being Filled rather than Stroked. If you manually changed Path.Fill to Path.Stroke then the page is no longer solid black.

There’s a further problem with the content of the Path Data - it contains duplicate vertices. Here’s what it looks like with added line breaks:

F1 M0,841.890014648
L0,0
L0,0
L595.280029297,0
L595.280029297,0
L595.280029297,841.890014648
L595.280029297,841.890014648
L0,841.890014648 Z

The Canvas Clip path is malformed in the same way.

@Brian_THOMAS

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-46334 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

This issue, logged in April 2019 still exists in aspose.pdf 20.1

@Brian_THOMAS

As issue was logged under free support model, it has low priority and is pending for resolution due to other issues in the queue. We will surely let you know as soon as we have some definite updates regarding availability of its fix. Please spare us some time.

We are sorry for the inconvenience.