Free Support Forum - aspose.com

Exception occurs while adding image in XPS document using Aspose.Page for Java

public class ImageWaterMark {
public static void test(){
getLicense(“C:\PrintHub\license\Aspose.Total.Product.Family.lic”);
String dataDir =“C:\PrintHub\docs\2019\7\9\”;
com.aspose.xps.XpsDocument doc = null;
try {
doc = new com.aspose.xps.XpsDocument(dataDir + “b71863d8-71d1-4e6e-8c79-d1a8a8a96003.xps”);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
long time1 = System.currentTimeMillis();
com.aspose.xps.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 + “1.png”, new java.awt.geom.Rectangle2D.Double(0f, 0f, 258.24f, 56.64f), new java.awt.geom.Rectangle2D.Double(50f, 20f, 193.68f, 42.48f)));
// Save resultant XPS document
try {
doc.save(dataDir + “AddImage_out2.xps”);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
long time2 = System.currentTimeMillis();
System.out.println("加水印时间: "+(time2 - time1));

}

}
————————

Invalid Offset property value: GradientStop
com.aspose.xps.XpsGradientStop.ll(Unknown Source)
com.aspose.xps.XpsGradientStop.lIf(Unknown Source)
com.aspose.xps.XpsGradientStop.(Unknown Source)
com.aspose.xps.XpsGradientBrush.ll(Unknown Source)
com.aspose.xps.XpsGradientBrush.lif(Unknown Source)
com.aspose.xps.XpsLinearGradientBrush.lif(Unknown Source)
com.aspose.xps.XpsLinearGradientBrush.(Unknown Source)
com.aspose.xps.XpsBrush.lif(Unknown Source)
com.aspose.xps.XpsBrush.lif(Unknown Source)
com.aspose.xps.I81.lif(Unknown Source)
com.aspose.xps.I81.lif(Unknown Source)
com.aspose.xps.XpsPath.lif(Unknown Source)
com.aspose.xps.XpsPath.(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.XpsPage.lif(Unknown Source)
com.aspose.xps.I1l.lif(Unknown Source)
com.aspose.xps.I1l.lif(Unknown Source)
com.aspose.xps.XpsDocument.liF(Unknown Source)
com.aspose.xps.XpsDocument.selectActivePage(Unknown Source)
com.aspose.xps.I10l.lf(Unknown Source)
com.aspose.xps.I10l.ll(Unknown Source)
com.aspose.xps.I4I.liF(Unknown Source)
com.aspose.xps.XpsDocument.ll(Unknown Source)
com.aspose.xps.XpsDocument.lif(Unknown Source)
com.aspose.xps.XpsDocument$I7.lif(Unknown Source)
com.aspose.page.internal.l421.Il.lif(Unknown Source)
com.aspose.page.internal.l421.II.lif(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.insolu.ImageWaterMark.test(ImageWaterMark.java:25)
com.insolu.OcrDemo.main(OcrDemo.java:13)
Exception in thread “main” class com.aspose.page.internal.l16l.I0l: Invalid Offset property value: GradientStop
com.aspose.xps.XpsGradientStop.ll(Unknown Source)
com.aspose.xps.XpsGradientStop.lIf(Unknown Source)
com.aspose.xps.XpsGradientStop.(Unknown Source)
com.aspose.xps.XpsGradientBrush.ll(Unknown Source)
com.aspose.xps.XpsGradientBrush.lif(Unknown Source)
com.aspose.xps.XpsLinearGradientBrush.lif(Unknown Source)
com.aspose.xps.XpsLinearGradientBrush.(Unknown Source)
com.aspose.xps.XpsBrush.lif(Unknown Source)
com.aspose.xps.XpsBrush.lif(Unknown Source)
com.aspose.xps.I81.lif(Unknown Source)
com.aspose.xps.I81.lif(Unknown Source)
com.aspose.xps.XpsPath.lif(Unknown Source)
com.aspose.xps.XpsPath.(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.XpsPage.lif(Unknown Source)
com.aspose.xps.I1l.lif(Unknown Source)
com.aspose.xps.I1l.lif(Unknown Source)
com.aspose.xps.XpsDocument.liF(Unknown Source)
com.aspose.xps.XpsDocument.selectActivePage(Unknown Source)
com.aspose.xps.I10l.lf(Unknown Source)
com.aspose.xps.I10l.ll(Unknown Source)
com.aspose.xps.I4I.liF(Unknown Source)
com.aspose.xps.XpsDocument.ll(Unknown Source)
com.aspose.xps.XpsDocument.lif(Unknown Source)
com.aspose.xps.XpsDocument$I7.lif(Unknown Source)
com.aspose.page.internal.l421.Il.lif(Unknown Source)
com.aspose.page.internal.l421.II.lif(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.insolu.ImageWaterMark.test(ImageWaterMark.java:25)
com.insolu.OcrDemo.main(OcrDemo.java:13)
at com.aspose.xps.XpsGradientStop.ll(Unknown Source)
at com.aspose.xps.XpsGradientStop.lIf(Unknown Source)
at com.aspose.xps.XpsGradientStop.(Unknown Source)
at com.aspose.xps.XpsGradientBrush.ll(Unknown Source)
at com.aspose.xps.XpsGradientBrush.lif(Unknown Source)
at com.aspose.xps.XpsLinearGradientBrush.lif(Unknown Source)
at com.aspose.xps.XpsLinearGradientBrush.(Unknown Source)
at com.aspose.xps.XpsBrush.lif(Unknown Source)
at com.aspose.xps.XpsBrush.lif(Unknown Source)
at com.aspose.xps.I81.lif(Unknown Source)
at com.aspose.xps.I81.lif(Unknown Source)
at com.aspose.xps.XpsPath.lif(Unknown Source)
at com.aspose.xps.XpsPath.(Unknown Source)
at com.aspose.xps.I10I.lif(Unknown Source)
at com.aspose.xps.XpsElement.lif(Unknown Source)
at com.aspose.xps.I10I.lif(Unknown Source)
at com.aspose.xps.XpsElement.lif(Unknown Source)
at com.aspose.xps.I10I.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.I1l.lif(Unknown Source)
at com.aspose.xps.XpsDocument.liF(Unknown Source)
at com.aspose.xps.XpsDocument.selectActivePage(Unknown Source)
at com.aspose.xps.I10l.lf(Unknown Source)
at com.aspose.xps.I10l.ll(Unknown Source)
at com.aspose.xps.I4I.liF(Unknown Source)
at com.aspose.xps.XpsDocument.ll(Unknown Source)
at com.aspose.xps.XpsDocument.lif(Unknown Source)
at com.aspose.xps.XpsDocument$I7.lif(Unknown Source)
at com.aspose.page.internal.l421.Il.lif(Unknown Source)
at com.aspose.page.internal.l421.II.lif(Unknown Source)
at com.aspose.xps.XpsDocument.save(Unknown Source)
at com.aspose.xps.XpsDocument.save(Unknown Source)
at com.insolu.ImageWaterMark.test(ImageWaterMark.java:25)
at com.insolu.OcrDemo.main(OcrDemo.java:13)

1.png (163.3 KB)

https://1drv.ms/u/s!AncXAOrkBW5Pzx5vF91ZSHx366gb?e=tVfTX3[quote=“wanyangye, post:1, topic:206967, full:true”]
public class ImageWaterMark {
public static void test(){
getLicense(“C:\PrintHub\license\Aspose.Total.Product.Family.lic”);
String dataDir =“C:\PrintHub\docs\2019\7\9\”;
com.aspose.xps.XpsDocument doc = null;
try {
doc = new com.aspose.xps.XpsDocument(dataDir + “b71863d8-71d1-4e6e-8c79-d1a8a8a96003.xps”);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
long time1 = System.currentTimeMillis();
com.aspose.xps.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 + “1.png”, new java.awt.geom.Rectangle2D.Double(0f, 0f, 258.24f, 56.64f), new java.awt.geom.Rectangle2D.Double(50f, 20f, 193.68f, 42.48f)));
// Save resultant XPS document
try {
doc.save(dataDir + “AddImage_out2.xps”);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
long time2 = System.currentTimeMillis();
System.out.println("加水印时间: "+(time2 - time1));

}

}
————————

Invalid Offset property value: GradientStop
com.aspose.xps.XpsGradientStop.ll(Unknown Source)
com.aspose.xps.XpsGradientStop.lIf(Unknown Source)
com.aspose.xps.XpsGradientStop.(Unknown Source)
com.aspose.xps.XpsGradientBrush.ll(Unknown Source)
com.aspose.xps.XpsGradientBrush.lif(Unknown Source)
com.aspose.xps.XpsLinearGradientBrush.lif(Unknown Source)
com.aspose.xps.XpsLinearGradientBrush.(Unknown Source)
com.aspose.xps.XpsBrush.lif(Unknown Source)
com.aspose.xps.XpsBrush.lif(Unknown Source)
com.aspose.xps.I81.lif(Unknown Source)
com.aspose.xps.I81.lif(Unknown Source)
com.aspose.xps.XpsPath.lif(Unknown Source)
com.aspose.xps.XpsPath.(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.XpsPage.lif(Unknown Source)
com.aspose.xps.I1l.lif(Unknown Source)
com.aspose.xps.I1l.lif(Unknown Source)
com.aspose.xps.XpsDocument.liF(Unknown Source)
com.aspose.xps.XpsDocument.selectActivePage(Unknown Source)
com.aspose.xps.I10l.lf(Unknown Source)
com.aspose.xps.I10l.ll(Unknown Source)
com.aspose.xps.I4I.liF(Unknown Source)
com.aspose.xps.XpsDocument.ll(Unknown Source)
com.aspose.xps.XpsDocument.lif(Unknown Source)
com.aspose.xps.XpsDocument$I7.lif(Unknown Source)
com.aspose.page.internal.l421.Il.lif(Unknown Source)
com.aspose.page.internal.l421.II.lif(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.insolu.ImageWaterMark.test(ImageWaterMark.java:25)
com.insolu.OcrDemo.main(OcrDemo.java:13)
Exception in thread “main” class com.aspose.page.internal.l16l.I0l: Invalid Offset property value: GradientStop
com.aspose.xps.XpsGradientStop.ll(Unknown Source)
com.aspose.xps.XpsGradientStop.lIf(Unknown Source)
com.aspose.xps.XpsGradientStop.(Unknown Source)
com.aspose.xps.XpsGradientBrush.ll(Unknown Source)
com.aspose.xps.XpsGradientBrush.lif(Unknown Source)
com.aspose.xps.XpsLinearGradientBrush.lif(Unknown Source)
com.aspose.xps.XpsLinearGradientBrush.(Unknown Source)
com.aspose.xps.XpsBrush.lif(Unknown Source)
com.aspose.xps.XpsBrush.lif(Unknown Source)
com.aspose.xps.I81.lif(Unknown Source)
com.aspose.xps.I81.lif(Unknown Source)
com.aspose.xps.XpsPath.lif(Unknown Source)
com.aspose.xps.XpsPath.(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.I10I.lif(Unknown Source)
com.aspose.xps.XpsElement.lif(Unknown Source)
com.aspose.xps.XpsPage.lif(Unknown Source)
com.aspose.xps.I1l.lif(Unknown Source)
com.aspose.xps.I1l.lif(Unknown Source)
com.aspose.xps.XpsDocument.liF(Unknown Source)
com.aspose.xps.XpsDocument.selectActivePage(Unknown Source)
com.aspose.xps.I10l.lf(Unknown Source)
com.aspose.xps.I10l.ll(Unknown Source)
com.aspose.xps.I4I.liF(Unknown Source)
com.aspose.xps.XpsDocument.ll(Unknown Source)
com.aspose.xps.XpsDocument.lif(Unknown Source)
com.aspose.xps.XpsDocument$I7.lif(Unknown Source)
com.aspose.page.internal.l421.Il.lif(Unknown Source)
com.aspose.page.internal.l421.II.lif(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.aspose.xps.XpsDocument.save(Unknown Source)
com.insolu.ImageWaterMark.test(ImageWaterMark.java:25)
com.insolu.OcrDemo.main(OcrDemo.java:13)
at com.aspose.xps.XpsGradientStop.ll(Unknown Source)
at com.aspose.xps.XpsGradientStop.lIf(Unknown Source)
at com.aspose.xps.XpsGradientStop.(Unknown Source)
at com.aspose.xps.XpsGradientBrush.ll(Unknown Source)
at com.aspose.xps.XpsGradientBrush.lif(Unknown Source)
at com.aspose.xps.XpsLinearGradientBrush.lif(Unknown Source)
at com.aspose.xps.XpsLinearGradientBrush.(Unknown Source)
at com.aspose.xps.XpsBrush.lif(Unknown Source)
at com.aspose.xps.XpsBrush.lif(Unknown Source)
at com.aspose.xps.I81.lif(Unknown Source)
at com.aspose.xps.I81.lif(Unknown Source)
at com.aspose.xps.XpsPath.lif(Unknown Source)
at com.aspose.xps.XpsPath.(Unknown Source)
at com.aspose.xps.I10I.lif(Unknown Source)
at com.aspose.xps.XpsElement.lif(Unknown Source)
at com.aspose.xps.I10I.lif(Unknown Source)
at com.aspose.xps.XpsElement.lif(Unknown Source)
at com.aspose.xps.I10I.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.I1l.lif(Unknown Source)
at com.aspose.xps.XpsDocument.liF(Unknown Source)
at com.aspose.xps.XpsDocument.selectActivePage(Unknown Source)
at com.aspose.xps.I10l.lf(Unknown Source)
at com.aspose.xps.I10l.ll(Unknown Source)
at com.aspose.xps.I4I.liF(Unknown Source)
at com.aspose.xps.XpsDocument.ll(Unknown Source)
at com.aspose.xps.XpsDocument.lif(Unknown Source)
at com.aspose.xps.XpsDocument$I7.lif(Unknown Source)
at com.aspose.page.internal.l421.Il.lif(Unknown Source)
at com.aspose.page.internal.l421.II.lif(Unknown Source)
at com.aspose.xps.XpsDocument.save(Unknown Source)
at com.aspose.xps.XpsDocument.save(Unknown Source)
at com.insolu.ImageWaterMark.test(ImageWaterMark.java:25)
at com.insolu.OcrDemo.main(OcrDemo.java:13)
[/quote]

file download link,Already sent [Adnan.Ahmad]

@wanyangye

We were able to replicate the issue in our environment and logged it as PAGEJAVA-85 in our issue tracking system. We will further look into details of this 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.

The issues you have found earlier (filed as PAGEJAVA-85) have been fixed in Aspose.Page for Java 20.1.

I encountered the same problem again, the file is attached…

@wanyangye

There are 3 files over the link you shared. Are you facing issue with all files?

yes, Can the program output the log to a file after the program reports an error? The detailed content is, for example, the file name of the processing error, the corresponding error content, so that we can find the problem.