PDF Mosaic: How to specify text rendering mode


Home       Features       Download       Tutorial       Version History       License       Source Code

 

This sample shows how to specify text rendering mode.


 

C# :

using PDFMosaic;
using System.Drawing;
 
namespace RenderingMode
{
  class RenderingMode
  {
    static void Main()
    {
      PDFDocument document = new PDFDocument();
      document.Pages.Add(new PDFPage(PDFPaperFormat.A4));
      PDFCanvas canvas = document.Pages[0].Canvas;
 
      PDFFont font = new PDFFont("Arial", 24);
      PDFBrush brush = new PDFSolidBrush(new PDFColorRGB(123, 123, 123));
      PDFPen pen = new PDFSolidPen(new PDFColorRGB(0, 255, 0));
 
      string text = "Text rendering mode";
 
      canvas.DrawString(text, font, pen, 10, 100);
      canvas.DrawString(text, font, pen, brush, 10, 130);
      canvas.DrawString(text, font, brush, 10, 160);
 
      document.Save("RenderingMode.pdf", true);
    }
  }
}

 

Visial Basic.NET :

Imports PDFMosaic
Imports System.Drawing
 
Module RenderingMode
  Sub Main()
    Dim document As PDFDocument = New PDFDocument()
    document.Pages.Add(New PDFPage(PDFPaperFormat.A4))
    Dim canvas As PDFCanvas = document.Pages(0).Canvas
 
    Dim font As PDFFont = New PDFFont("Arial", 24)
    Dim brush As PDFBrush = New PDFSolidBrush(New PDFColorRGB(123, 123, 123))
    Dim pen As PDFPen = New PDFSolidPen(New PDFColorRGB(0, 255, 0))
 
    Dim text As String = "Text rendering mode"
 
    canvas.DrawString(text, font, pen, 10, 100)
    canvas.DrawString(text, font, pen, brush, 10, 130)
    canvas.DrawString(text, font, brush, 10, 160)
 
    document.Save("RenderingMode.pdf", True)
  End Sub
End Module

 


Home       Features       Download       Tutorial       Version History       License       Source Code