Accusoft.PdfXpress7.ActiveX
Add Text to a PDF Document

To add text to a PDF document, do the following:

  1. Create a PDFXpress object and initialize it.
  2. Create a PdfDocument object from an existing PDF file.
  3. Create an AddTextOptions object.
  4. Set the AddTextOptions:
  5. Call AddText() on the PdfDocument object.
  6. Create a SaveOptions object.
  7. Call Save() on the PdfDocument object to save the PDF with text added.
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 options As New AddTextOptions
    options.FontSize = 14
    options.FontWeight = PDF_FontWeight_Bold
   
    doc.AddText 0, options, "Hello World!"
   
    Dim so As New SaveOptions
    so.FileName = "C:\text.pdf"
    so.Linearized = True
    so.Overwrite = True
   
    doc.SaveDocument so
   
    Set so = Nothing
    Set options = Nothing
    Set doc = Nothing
    pdf.Terminate
    Set pdf = Nothing
End Sub

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback