HelloWorldUsingExistingDocuments


Bytescout_PDF_HelloWorldUsingExistingDocuments_1.png
Bytescout_PDF_HelloWorldUsingExistingDocuments_2.png

using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.PDF;
namespace HelloWorldUsingExistingDocuments
{
  class Program
  {
    static void Main(string[] args)
    {
      // Create main PDF Doc Engine
      PDFDocEngine engine = new PDFDocEngine("", "");
      // Open existing document
      Document document = engine.AddDocument("HelloWorld.pdf");
      // Get first page
      Page page = document.GetPage(0);
      // Create new drawing
      Drawing drawing = page.AddDrawing();
      // Add standard font
      uint font = document.AddFontStandard(StandardFontType.Courier, FontEncodingType.WinAnsi);
      // Set Active Font
      drawing.SetActiveFont(font, 50, false, false);
      // Draw Text
      drawing.PlaceText(100, 150, 0, "Hello again, World!");
      drawing.PlaceText(100, 200, 0, "(was added to the existing page)");
      // Closing drawing on the page
      drawing.Close();
      // Save document
      document.Save("HelloWorldAgain.pdf");
    }
  }
}