var watermark = PdfImage.Load("file");
watermark.Size = new PdfSize(width, height);
page1.Content.DrawImage(watermark, new PdfPoint(X,Y));
page2.Content.DrawImage(watermark, new PdfPoint(X,Y));
page3.Content.DrawImage(watermark, new PdfPoint(X,Y));
Is it OK to Draw that same image in multiple pages like this?
Yes, you should be able to draw the same PdfImage multiple times, on the same and on a different page.
Also, you should be able to draw it even on a different PdfDocument.
Hi Mario. Sometimes after a change in the way we print the PDF (Not only the code I quoted above) I irregularly faced an Exception saying that
“Basic PDF object contains descendant indirect object that is contained in another PDF document”
Can you help me to understand better what does this mean and what is often the cause of it? From a quick research, I understand that it should only happens if there are multiple PdfDocument being handled at once / using the same resource.
Thanks, Mario. I will just wait and see beacuse this happens irregularly I didn’t have the chance to capture a stacktrace
If this surface again I will switch to the hotfix. Right now it is not possible for me to do so
System.ArgumentException: Basic PDF object contains descendant indirect object that is contained in another PDF document. (Parameter ‘item’)
at GemBox.Pdf.Objects.PdfBasicContainer.(PdfBasicContainer )
at GemBox.Pdf.Objects.PdfBasicContainer.lc8lpgped2564ebsf5tnlmfh9uj6jzaz(PdfBasicObject )
at GemBox.Pdf.Objects.PdfDictionary.lc8lpgped2564ebsf5tnlmfh9uj6jzaz(PdfBasicObject )
at GemBox.Pdf.Objects.PdfDictionary.(PdfName , PdfBasicObject , , Int32)
at GemBox.Pdf.Objects.PdfDictionary.Add(PdfName key, PdfBasicObject value)
at .(PdfName , )
at .( )
at.ee(PdfExternalObject )
at .(PdfImageContent )
at .(PdfContentElementCollection )
at .(PdfContentGroup )
at .(PdfContentElementCollection )
at .(e , PdfContentElementCollection )
at GemBox.Pdf.Content.PdfContent.EndEdit(Boolean force)
at GemBox.Pdf.Content.PdfContent.()
at GemBox.Pdf.Content.PdfContentElement()
at GemBox.Pdf.Content.PdfContentElementCollection()
at GemBox.Pdf.Content.PdfContentElementCollection.(PdfContentElement )
at GemBox.Pdf.Content.PdfContentElementCollection.(PdfContentElement , PdfContentElement )
at GemBox.Pdf.Content.PdfContentElementCollection.AddPath(PdfContentElement nextElement)
Not a reproducible project but stack trace at the time. Could be related to multi-threading also
The function I was calling is
Managed to reproduce the issue. It was presenting on our current version 17.0.1208 and fixed in the latest stable version 17.0.1300. Thanks for the support