Add image to XPS document using Aspose.Page for Java - content will be left blank

When the print picture (windows picture viewer) is finished with the watermark, the original picture content will be left blank and only the fork will be displayed.

捕获52.zip (63.0 KB)

@wanyangye

Could you please elaborate a bit more about the issue by sharing some screenshot with annotations. Also, please share a sample code snippet which we can use to replicate the issue in our environment.

package com.aspose.xps.examples.images;

import com.aspose.xps.XpsDocument;
import com.aspose.xps.XpsFontStyle;
import com.aspose.xps.XpsPath;
import com.aspose.xps.java.examples.Utils;
import java.awt.Color;
import java.awt.geom.Rectangle2D;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class AddImage {
/**
* The main entry point for the application.
*/
public static void main(String[] args) throws Exception
{
// ExStart:AddImage
// The path to the documents directory.
String dataDir = Utils.getDataDir();
// Create new XPS Document
XpsDocument doc = new XpsDocument();
// Add Image
XpsPath path = doc.addPath(doc.createPathGeometry(“M 30,20 l 258.24,0 0,56.64 -258.24,0 Z”));
// Creating a matrix is optional, it can be used for proper positioning
path.setRenderTransform(doc.createMatrix(0.7f, 0f, 0f, 0.7f, 0f, 20f));
// Create Image Brush
path.setFill(doc.createImageBrush(dataDir + “QL_logo_color.tif”, new Rectangle2D.Double(0f, 0f, 258.24f, 56.64f), new Rectangle2D.Double(50f, 20f, 193.68f, 42.48f)));
// Save resultant XPS document
doc.save(dataDir + “AddImage_out.xps”);
//ExEnd:AddImage

}

}

微信截图_20190710090222.png (10.1 KB)
nowatermark xps.zip (51.4 KB)


This zip file is the original XPS file, the picture is the watermark after the effect diagram, fork.

@wanyangye

We tried to run your code snippet with Aspose.Page for Java 19.6 and used one of our sample images to create XPS document. We printed the output XPS document to PDF using Soft Printer and were unable to notice any issue. Would you please try using another printer to print the document and using Aspose.Page for Java to create the XPS documents. In case you still face any issue, please feel free to let us know. For your kind reference, we have attached sample files generated at our end.

AddImage_out.zip (52.1 KB)
printed.pdf (4.2 KB)

Caused by: java.lang.IllegalStateException: The license is not valid for this product. For free technical support, please post this error and the file in the Aspose.PDF Forums ![](file:///C:\Users\dgsteven\AppData\Roaming\Tencent\TIM\Temp%W@GJ$ACOF(TYDYECOKVDYB.png)Aspose.PDF Product Family - Free Support Forum - aspose.com
at com.aspose.page.I1.lif(Unknown Source)
at com.aspose.page.License.setLicense(Unknown Source)1

@wanyangye

Would you please share your license file with us in a private message. Please click over username and press Blue “Message” Button in order send a private message.

nowatermark xps.zip (51.4 KB)

Can you add watermark information to this file?

@wanyangye

Thanks for staying with us.

We have tested the scenario in our environment using your shared license and noticed that API gave similar error that you have reported. We have logged an issue as PAGEJAVA-40 in our issue tracking system for the sake of correction.

Furthermore, we have also noticed that image got removed from the XPS when we tried to add new image in it. Therefore, an issue as PAGEJAVA-41 has been logged in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.

@wanyangye

We would like to share with you that issue i.e. PAGEJAVA-40 has been fixed. Please download latest Aspose.Page for Java 19.6 JAR and try using it with your existing Aspose.XPS license. In case you face any issue, please let us know.

the license is OK ,but Error in adding watermark to this file .5d26bc1f-94d2-456d-a3bd-284bc96fa63e.zip (263.4 KB)

@wanyangye

Thank you for your kind feedback.

We are looking into your concerns and will get back to you soon.

class com.aspose.page.internal.l16l.I0l: Property PathGeometry undefined: Canvas.Clip

com.aspose.xps.XpsPathGeometry.lif(Unknown Source)
com.aspose.xps.XpsPathGeometry.lif(Unknown Source)
com.aspose.xps.XpsPathGeometry.(Unknown Source)
com.aspose.xps.I81.lif(Unknown Source)

@wanyangye

Thank you for sharing error details.

We are looking into it and will share our feedback with you.

Do you have any good news to share with me? PAGEJAVA-41 and class com.aspose.page.internal.l16l.I0l:

@wanyangye

We regret that earlier logged issue is not yet resolved. We will surely look into details of it and let you know as soon as we have additional updates.

Another issue as PAGEJAVA-42 has been logged in our issue tracking system for above issue. We will also take care of the issue and resolve it. We greatly appreciate your patience in this regard. Please spare us little time.

I’ll take a look at the problem and make it easier for you to handle it.
problem 1:
file1(I add watermarks to the XPS file, but the original picture content is removed, leaving only the watermark content. )
problem 2:
file2(Error in adding watermark to this file) error info:
class com.aspose.page.internal.l16l.I0l: Property PathGeometry undefined: Canvas.Clip
com.aspose.xps.XpsPathGeometry.lif(Unknown Source)
com.aspose.xps.XpsPathGeometry.lif(Unknown Source)
com.aspose.xps.XpsPathGeometry.(Unknown Source)
com.aspose.xps.I81.lif(Unknown Source)

Can you repeat the problem? If you have any questions or need my cooperation, you can contact me at any time.
These two problems have been bothering me for a long time and hope to be solved as soon as possible. Thank you

file1.zip (51.4 KB)
file2.zip (263.3 KB)

When you are in debug, you can use the file 1 and file 2.

@wanyangye

Yes, we were able to reproduce the issues at our side. Which is why we have logged them in our issue tracking system. Sure, we will surely contact you in case we need some information from you.

We have noted your concerns and will take care of them during investigation and resolution of the issues. Please give us little time.

We are sorry for the inconvenience.

Are you having any problems? Can you tell me the latest progress of the problem? How long do you expect it will take?

@wanyangye

We regret to share that earlier logged issue is not yet resolved due to low priority. Please note that issues in free support model are resolved on first come first serve basis. However, we have recorded your concerns and will definitely consider them while resolving those issues. Please give us little time.

We are sorry for the inconvenience.