PDF Xpress for ActiveX - User Guide > How To > Modify PDF Document Content > Add Watermark to a PDF document |
You can add a source-based watermark or a text watermark to a PDF. Source-based means the source of the watermark is another PDF.
To add a source-based watermark to a PDF, do the following:
VB6 Example |
Copy Code
|
---|---|
Private Sub Form_Load() Dim pdf As New PdfXpress pdf.InitializePaths "C:\Users\Public\Documents\Accusoft\PDFXpress\V7.0\Support\Font", _ "C:\Users\Public\Documents\Accusoft\PDFXpress\V7.0\Support\CMap" Dim doc As New PdfDocument doc.SetParentControl pdf doc.OpenDocument "C:\myfile.pdf", "" Dim sourceDoc As New PdfDocument sourceDoc.SetParentControl pdf sourceDoc.OpenDocument "C:\source.pdf", "" Dim po As New PageArtifactOptions po.ArtifactType = PDF_TypeOfArtifact_SourceWatermark po.Opacity = 0.5 Dim pl As New PageList Dim pr As New PageRange pr.PageCount = 1 pr.StartPageNumber = 0 pl.Add pr po.PageList = pl po.SourceDocument = sourceDoc po.SourcePageNumber = 0 doc.AddWatermark po Dim so As New SaveOptions so.FileName = "C:\watermarked.pdf" so.Linearized = True so.Overwrite = True doc.SaveDocument so Set so = Nothing Set pr = Nothing Set pl = Nothing Set po = Nothing Set sourceDoc = Nothing Set doc = Nothing pdf.Terminate Set pdf = Nothing End Sub |