PDF Mosaic: How to edit an existing PDF document


Home       Features       Download       Tutorial       Version History       License       Source Code

 

This sample shows how to open existing PDF document and edit & re-save it using PDF Mosaic 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

 


Home       Features       Download       Tutorial       Version History       License       Source Code