// This code is part of GrapeCity Documents for PDF samples.
// Copyright (c) GrapeCity, Inc. All rights reserved.
// This sample demonstrates that as of version 4.1,
// GcPdf supports rendering PDFs that include text
// that uses Adobe Type 1 Font specification fonts.
// Compare images generated by this sample (e.g. TIFF)
// with images generated by the same code but using
// and older version of GcPdf (v4 or earlier) to see
// the difference.
public class Type1FontsDemo
public void CreatePDF(Stream stream)
GcPdfDocument doc = new GcPdfDocument();
// We load a PDF that uses PDF Type 1 fonts, add some text to it,
// and save it to PDF and images (JPEG and TIFF) as in all other samples.
// The original text in the loaded PDF is rendered using Adobe Type 1 fonts,
// so if using GcPdf v4.0 or earlier, the generated images would contain
// garbled text. Starting with v4.1, Type 1 fonts are rendered correctly.
using (var fs = File.OpenRead(Path.Combine("Resources", "PDFs", "Type1FontSample.pdf")))
// Add note to the (only) page in the doc:
var page = doc.Pages.Last;
"This sample demonstrates rendering Adobe Type 1 fonts when a PDF is saved as image by GcPdf. " +
"This is supported starting with GcPdf v4.1. To see the result, open the generated PDF " +
"saved as image (e.g. TIFF). Using the same code with an earlier version of GcPdf produces " +
"garbled text in the saved image.",
new RectangleF(12, 12, 72 * 5, 0));