Here a snippet to add text on an existing PDF using incremental saving :
Code: Select all
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim oGdPicturePDF As New GdPicturePDF
oGdPicturePDF.SetLicenseNumber("XXX") 'Replace XXX by a valid demo or commercial key
If oGdPicturePDF.LoadFromFile("c:\test.pdf", True) = GdPictureStatus.OK Then
oGdPicturePDF.SelectPage(1) 'Selecting first page
Dim font_res_name As String = oGdPicturePDF.AddTrueTypeFont("Arial", False, False, False)
oGdPicturePDF.SetTextMode(PdfTextMode.PdfTextModeFill)
oGdPicturePDF.SetTextSize(30)
oGdPicturePDF.SetFillColor(255, 0, 0, 0) 'Using Cyan colour
oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
oGdPicturePDF.DrawText(font_res_name, 1, 1, "Hello World!")
oGdPicturePDF.SaveToFileInc("c:\test.pdf")
oGdPicturePDF.CloseDocument()
MsgBox("Done")
End If
End Sub