Hello,
It seems, that I can add new text on PDF file page. But I cannot made this text clickable. Could you please look at my code snippet below and tell me any advice?
Mikhael
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
’ add watermark
Dim sPDFFile = "C:\in\Demo.pdf"
Dim sFontFile = "C:\in\bgothm.ttf"
Dim nFontSize = 20
Dim sMessage = "Trial version"
Dim sOutPDF = "C:\Out\watermark.pdf"
Using pdfDocument = New Document(sPDFFile)
Using fontStream = File.OpenRead(sFontFile)
For Each pg In pdfDocument.Pages
Dim pgRest = pg.Rect
Dim tf = New TextFragment(sMessage) With {
.Position = New Position(0, 0)
}
tf.TextState.FontSize = nFontSize
'tf.TextState.Font = FontRepository.OpenFont(fontStream, FontTypes.TTF)
tf.TextState.Font = FontRepository.FindFont("Arial")
tf.TextState.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Transparent)
tf.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.DeepSkyBlue)
tf.TextState.Rotation = 90
tf.Position = New Position(pgRest.Width, pgRest.Height - tf.Rectangle.Width - nFontSize / 2)
tf.Hyperlink = New WebHyperlink("https:\\www.google.com")
Dim tb = New TextBuilder(pg)
tb.AppendText(tf)
Next
End Using
pdfDocument.Save(sOutPDF)
End Using
End Sub