I should be able to check for existence of watermark in a pdf.
Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thank you for sharing the sample code.
We have found your mentioned issue after an initial test. Your issue has been registered in our issue tracking system with issue id: PDFNEWNET-31535. We will update your regarding any progress against your issue via this forum thread.
Sorry for the inconvenience caused,
Hi,
In order to get the number of watermark images in document, please try using the following code snippet. In fact in your code snippet, you are passing existing PDF document to Pdf object which is not supported. you can pass MemoryStream object to Pdf but the steam object should be empty.
[C#]
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(@“d:\pdftest\WatermarkExample.pdf”);
//extract the images from PDF
XImageCollection collection = pdfDocument.Pages[1].Resources.Images;
if (collection.Count == 0)
MessageBox.Show(“No Image exists…”);
else
MessageBox.Show(“Number of images in document are :” + collection.Count);
Thanks for the code sample, I am able to identify the presence of images using this code.
However , one of the scenarios where It does not work for me is when, there is already a image present in the pdf.
By identifying watermark image, what I mean is the image that will be repreated through every page. When I am accessing a XImage element from the collection the name property is coming as null.
If I am able to set some unique value here , or some other property in order to be able to uniquely identify the watermark image, that solves the purpose for me.
Hi Sanjay,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
I am afraid this feature is not supported at the moment. I have registered this feature as new feature request in our issue tracking system with issue id: PDFNEWNET-31581. Our development team will further investigate and see if this can be supported in the future version. You will be notified via this forum post regarding any updates against your request.
Sorry for the inconvenience,
Hi Sanjay,
The issues you have found earlier (filed as 31535) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
The issues you have found earlier (filed as PDFNEWNET-31581) have been fixed in Aspose.Pdf for .NET 9.3.0.
Blog post for this release can be viewed over this link
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hi Sanjay,
Document doc = new Document(“31581.pdf”);<o:p></o:p>
foreach (Artifact art in doc.Pages[1].Artifacts)
{
if (art is WatermarkArtifact)
{
FileStream fs = new FileStream("artifact_image.png", FileMode.Create, FileAccess.ReadWrite);
//XImage of the artifact
XImage image = (art as WatermarkArtifact).Image;
image.Save(fs, ImageFormat.Png);
fs.Close();
//name of the Form in page resources.
Console.WriteLine("Form name: " + art.Form.Name);
}
}
Please feel free to contact us for any further assistance.
Best Regards,