I have PDF Documents that have pages that come in many different sizes but in one PDF document. What is happening is that when I try placing watermarks on these documents I sometimes get a result where the watermark is much to large or to small for some of the pages. Right now it all depends on the first page. Example: I have a PDF where the first page is four times the size of the rest of the pages in the PDF. The first page comes out great but the rest of the pages only part of the watermark fits because it’s been scaled to the first page only.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Is there a way that I can scale the watermark for each individual page in the same PDF file?
Here is the example of the code I use now.
Dim TextSize As Integer
Dim license As Aspose.Pdf.Kit.License = New Aspose.Pdf.Kit.License
license.SetLicense("********")
Dim inFile As String = PDFFileLocation
Dim outFile As String = NewName
Dim fileInfo As PdfFileInfo = New PdfFileInfo(inFile)
TextSize = ((((fileInfo.GetPageWidth(1) + fileInfo.GetPageHeight(1)) / 2) / 700) * 40)
Dim fftext As FormattedText
fftext = New FormattedText("Uncontrolled In Hard Copy", New FontColor(0, 200, 0), FontStyle.Helvetica, EncodingType.Winansi, False, TextSize)
Dim aStamp As Stamp = New Stamp
aStamp.BindLogo(fftext)
aStamp.Rotation = 45
aStamp.Opacity = 0.2
aStamp.SetOrigin((fileInfo.GetPageWidth(1) / 4), (fileInfo.GetPageHeight(1) / 4))
Dim stamper As PdfFileStamp = New PdfFileStamp(inFile, outFile)
stamper.AddStamp(aStamp)
stamper.Close()
Thank you