We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Watermark Stamp not displaying if background = true

I use Aspose.pdf to merge pdfs together and then I want to put a watermark on the document. If I set the isbackground = false then the watermark appears. If I set it to true the watermark does not appear on all the pages. I am using the sample code provided, it is very straighforward. It seems the pdfs that are generated from the system do not show the watermark. These are reports like a crystal report that is saved as a pdf before merging together. I am using DevExpress tools for the reports that export to pdf. I don’t know if there is an option I need to be including when generating those report.

Any help is appreciated!

@PPIB,

Thanks for contacting support.

Can you please share the input PDF files and code snippet which you are using, so that we can test the scenario in our environment. We are sorry for this inconvenience.

PS, as per your statement, the code snippet is simple, but in order for us to replicate the same sceanrio, we need the same code snippet.

Here is my code:
Dim fileStamp As New PdfFileStamp()

            ' Open Document
            fileStamp.BindPdf(Server.MapPath(strFullDocName))

            ' Create stamp
            Dim stamp As New Aspose.Pdf.Facades.Stamp()
            stamp.BindLogo(New FormattedText("SAMPLE", System.Drawing.Color.LightGray, System.Drawing.Color.Transparent, Aspose.Pdf.Facades.FontStyle.Helvetica, Facades.EncodingType.Winansi, True, 100))
            stamp.SetOrigin(20, 20)
            stamp.Rotation = 0.0F
            stamp.Opacity = 50
             stamp.IsBackground = True


            ' Add stamp to PDF file
            fileStamp.AddStamp(stamp)

            ' Save updated PDF file
            fileStamp.Save(Server.MapPath(strFullDocName))

            ' Close fileStamp
            fileStamp.Close()

Is there a way for me to upload the pdf to you?

@PPIB

Thanks for sharing a sample code snippet and sorry for the delayed response.

Please check the option to upload in the shared screenshot and upload a sample PDF document. We will test the scenario in our environment and address it accordingly.

Add_Attachment.png (5.2 KB)

AgentCopy 1.pdf (357.0 KB)
Thank you for your reply. I have uploaded a document for you to test.

@PPIB

Thanks for sharing sample PDF document.

Please note the the property IsBackground when set to true, the stamp would be layered under the content of the PDF document, which means it will be present but invisible as it is under the main layer of content. Which is why, it is set to false by default and in order to display the stamp, you need to leave this property as it is.

Now concerning to the stamp showing over the content of the PDF and hiding the text under it, you need to set its Opacity correctly, so that the content/text, beneath it, would be visible. In your shared code snippet, you were setting the Opacity as 50 which is not proper in terms of transparency. Please try to set it as 0.5 and the stamp will be appeared as under the content of the PDF.

By setting the opacity as 0.5 and leaving the IsBackground property false, we have tried to stamp the PDF document and it looked fine. For your reference, we have attached the generated document as well. In case of any further assistance, please feel free to let us know.

AgentCopy 1_out.pdf (356.1 KB)

That worked great. Thank you for your help!