How to Edit an Existing PDF Document

This sample shows how to open existing PDFm edit and re-save it using PDFMosaic library.

C# :

using PDFMosaic;
using System;

namespace EditAndSave
  class EditAndReSave
    static void Main(string[] args)
      PDFDocument document = new PDFDocument("document.pdf"); // Open existing PDF document
      PDFCanvas canvas = document.Pages[0].Canvas;

      PDFFont font = new PDFFont("Arial", 16);
      PDFBrush brush = new PDFSolidBrush();

      canvas.DrawString("The document was changed!!", font, brush, 100, 300);

      document.Save("EditAndReSave.pdf", true);

Visial Basic.NET :

Imports PDFMosaic
Imports System

Module EditAndSave
  Sub Main()
    Dim document As New PDFDocument("document.pdf")
' Open existing PDF document
  Dim canvas As PDFCanvas = document.Pages(0).Canvas

    Dim font As New PDFFont("Arial", 16)
    Dim brush As New PDFSolidBrush()

    canvas.DrawString("The test string", font, brush, 100, 100)
    document.Save("EditAndSave.pdf", True)
  End Sub
End Module