Learn the ways GroupDocs.Watermark adds watermarks in PDF documents.
XObjects
When add on Watermarker is called, a simple XObject is added to the PDF.
Image XObject and Form XObject are used to add ImageWatermark and TextWatermark respectively. XObjects are page real content and are not removed by Adobe Acrobat sanitization.
Artifacts
Watermarks can be represented by artifacts. Add an artifact watermark using PdfArtifactWatermarkOptions.
importgroupdocs.watermarkasgwimportgroupdocs.watermark.watermarksasgwwimportgroupdocs.watermark.contents.pdfasgwc_pdfimportgroupdocs.watermark.options.pdfasgwo_pdfimportgroupdocs.watermark.commonasgwcload_options=gw.PdfLoadOptions()withgw.Watermarker("document.pdf",load_options)aswatermarker:options=gwo_pdf.PdfArtifactWatermarkOptions()text_watermark=gww.TextWatermark("This is an artifact watermark",gww.Font("Arial",8.0))text_watermark.horizontal_alignment=gwc.HorizontalAlignment.RIGHTwatermarker.add(text_watermark,options)withgww.ImageWatermark("logo.bmp")asimage_watermark:watermarker.add(image_watermark,options)watermarker.save("document.pdf")
Annotations
Add annotation watermarks using PdfAnnotationWatermarkOptions.
importgroupdocs.watermarkasgwimportgroupdocs.watermark.watermarksasgwwimportgroupdocs.watermark.contents.pdfasgwc_pdfimportgroupdocs.watermark.options.pdfasgwo_pdfimportgroupdocs.watermark.commonasgwcload_options=gw.PdfLoadOptions()withgw.Watermarker("document.pdf",load_options)aswatermarker:options=gwo_pdf.PdfAnnotationWatermarkOptions()text_watermark=gww.TextWatermark("This is a annotation watermark",gww.Font("Arial",8.0))text_watermark.horizontal_alignment=gwc.HorizontalAlignment.LEFTtext_watermark.vertical_alignment=gwc.VerticalAlignment.TOPwatermarker.add(text_watermark,options)withgww.ImageWatermark("protect.jpg")asimage_watermark:image_watermark.horizontal_alignment=gwc.HorizontalAlignment.RIGHTimage_watermark.vertical_alignment=gwc.VerticalAlignment.TOPwatermarker.add(image_watermark,options)watermarker.save("document.pdf")
Print-only annotations
Make an annotation print-only using print_only.
importgroupdocs.watermarkasgwimportgroupdocs.watermark.watermarksasgwwimportgroupdocs.watermark.options.pdfasgwo_pdfload_options=gw.PdfLoadOptions()withgw.Watermarker("document.pdf",load_options)aswatermarker:text_watermark=gww.TextWatermark("This is a print only test watermark. It won't appear in view mode.",gww.Font("Arial",8.0),)options=gwo_pdf.PdfAnnotationWatermarkOptions()options.page_index=0options.print_only=Truewatermarker.add(text_watermark,options)watermarker.save("document.pdf")
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.