sgcPDF Feature Matrix

Everything sgcPDF does, grouped by task. Every feature is implemented in Object Pascal in the sgcPDF_*.pas units and ships with full source code. The code samples on this page were compiled against the sgcPDF sources and run.

Creation

13 features

Editing

6 features

Extraction

5 features

Forms

3 features

Creation

FeatureDetails
PagesAny page size and orientation, A4, Letter or custom, and page rotation.
TextThe 14 standard PDF fonts and colored text, with paragraph wrapping through the canvas and HTML renderers.
Embedded fontsTrueType, OpenType (TrueType and CFF outlines) and TrueType collections, embedded and subset automatically, with Unicode ToUnicode maps so the text can be copied and searched.
Complex scriptsKerning and ligatures, Arabic joining forms through GSUB, and the Unicode bidirectional algorithm for right to left text.
CJK textChinese, Japanese and Korean text through embedded TrueType and TrueType collection fonts.
ImagesJPEG, PNG with alpha, BMP and TIFF (including CCITT fax images), with soft masks.
Vector graphicsLines, rectangles, circles, ellipses, Bezier curves, polygons, dash patterns, line caps and joins, transparency and gradients.
TablesTables with headers, borders, cell padding and colors that continue across pages.
BarcodesCode 128, Code 39, EAN-13, EAN-8, UPC-A, ITF, Codabar, GS1-128, QR Code, DataMatrix (ECC200) and PDF417, drawn as vectors.
Annotations and linksText notes, highlights, links to URLs and to pages, stamps and free text annotations.
Bookmarks and layersNested bookmarks (outline) and optional content groups (layers) that readers can show or hide.
HTML to PDFTsgcPDFHTMLRenderer: headings, paragraphs, inline CSS styles, lists, tables, images, links, page breaks, headers, footers and page numbers.
Canvas and EMF to PDFTsgcPDFCanvas records drawing calls into PDF content, and EMF metafiles are played back into PDF vectors, so existing report and chart code produces PDF output.

HTML to PDF

procedure HTMLToPDF(const APDFFile: string);
var
  oHTML: TsgcPDFHTMLRenderer;
begin
  oHTML := TsgcPDFHTMLRenderer.Create(nil);
  try
    oHTML.PageWidth := 595;
    oHTML.PageHeight := 842;
    oHTML.FooterText := 'Page {page} of {pages}';
    oHTML.HTMLToPDFFile(
      '<html><head><style>h1 { color: #003366 }</style></head><body>' +
      '<h1>Invoice 2026-001</h1>' +
      '<table><tr><th>Item</th><th>Amount</th></tr>' +
      '<tr><td>Consulting</td><td>299.00</td></tr></table>' +
      '</body></html>', APDFFile);
  finally
    oHTML.Free;
  end;
end;

Editing

FeatureDetails
Watermarks and stampsText watermarks with font, size, rotation, color and opacity, on one page or on all pages.
Headers, footers, page numbersHeader and footer text and page numbers with a format such as Page %d of %d.
Page operationsMerge documents, split, extract page ranges, insert, delete, rotate and reorder pages.
Incremental saveChanges are appended to the original file as a new revision, which keeps earlier digital signatures valid.
Compact outputObject streams and cross reference streams for smaller files, plus TsgcPDFOptimizer to remove duplicates and unused objects and to downsample images.
Large filesOffsets are 64 bit end to end and objects are loaded on demand from a stream, so files over 2 GB can be opened and saved.

Rendering & Viewers

FeatureDetails
VCL viewerTsgcPDFViewerControl with scrolling, zoom modes, page navigation, text selection and copy, search with highlight, form field filling, link navigation and printing, plus TsgcPDFThumbnailView and TsgcPDFOutlineView.
FireMonkey viewerTsgcPDFViewerFMX draws through the FMX canvas on Windows, macOS, iOS and Android.
Raster renderer for serversTsgcPDFRendererRaster is a pure Pascal rasterizer that renders pages to pixels or PNG without GDI, on Windows and Linux.
GDI renderer and exportRender to a bitmap or a device context on Windows, and export pages and thumbnails to BMP, PNG or JPEG with TsgcPDFExporter.
Graphics modelDeviceGray, DeviceRGB, DeviceCMYK, Indexed, ICCBased and Lab color spaces, axial and radial shadings, tiling patterns, soft masks, blend opacity and form XObjects.
FontsEmbedded TrueType, CFF, OpenType and Type 1 font programs are rendered from their outlines, with the standard encodings and Identity-H CID fonts.
Image decodersFlate, LZW, ASCII85, ASCIIHex, RunLength, JPEG (baseline and progressive, CMYK), JPEG 2000, CCITT Group 3 and 4, and JBIG2.

Extraction

FeatureDetails
TextPage text or whole document text, with Unicode mapping of embedded and CID fonts.
Text positionsTsgcPDFTextExtractor returns each text fragment with X, Y, font name and font size.
SearchFind text on a page or in the document.
ImagesTsgcPDFImageExtractor enumerates the images of a page, including inline images and images inside form XObjects, and decodes them to PNG, JPEG or BMP.
Metadata and attachmentsDocument information, XMP metadata, bookmarks, layers and embedded files.

Forms

FeatureDetails
Create formsText fields, check boxes, radio buttons, combo boxes, list boxes and push buttons with appearance streams.
Fill and flattenSet field values in code or in the viewer, then flatten the form into static page content.
FDF and XFDFImport and export form data as FDF and XFDF.

Security & Signatures

FeatureDetails
Password encryptionRC4 40 bit and 128 bit, AES-128 and AES-256 (revisions 5 and 6), with user and owner passwords and permission flags. Encrypted files are decrypted on load.
Certificate encryptionPublic key encryption for one or more recipient certificates (adbe.pkcs7.s4 and adbe.pkcs7.s5).
Digital signaturesSign with a PFX certificate, visible or invisible signature fields, SHA-256, SHA-384 and SHA-512, RFC 3161 timestamps and document timestamps.
PAdES via sgcSignTsgcPDFPAdESSigner produces ETSI.CAdES.detached signatures at levels B-B, B-T, B-LT and B-LTA, with DSS validation data, using any key provider of sgcSign (PEM, PFX, PKCS#11, Windows certificate store, cloud HSMs). sgcSign is licensed separately.
VerificationTsgcPDFSignatureVerifier checks integrity, byte range coverage, the signer certificate and the certificate chain of every signature.
RedactionTsgcPDFRedactor removes text at glyph level, image pixels, vector paths and annotations under a region or matching a text, adds an overlay and can strip metadata. The removed text cannot be extracted from the output.

AES-256 password encryption

procedure CreateEncryptedPDF(const AFileName: string);
var
  oPDF: TsgcPDFDocument;
begin
  oPDF := TsgcPDFDocument.Create;
  try
    oPDF.AddPage(595, 842).DrawText('Secret', 50, 780, sfHelveticaBold, 24);
    // user password opens the file, owner password grants full rights
    oPDF.SetEncryption(emAES_256, 'user123', 'owner456');
    oPDF.SaveToFile(AFileName);
  finally
    oPDF.Free;
  end;
end;

Sign with a PFX certificate

procedure SignPDF(const AInput, AOutput: string);
var
  oSigner: TsgcPDFSignatureHandler;
begin
  oSigner := TsgcPDFSignatureHandler.Create;
  try
    oSigner.LoadCertificateFromPFX('signer.pfx', 'test123');
    oSigner.Reason := 'Document approval';
    oSigner.Location := 'Barcelona';
    oSigner.HashAlgorithm := shaSHA256;
    // visible signature field on page 1: Left, Bottom, Right, Top
    oSigner.SetField('Signature1', 0, 50, 50, 250, 100);
    oSigner.SignDocument(AInput, AOutput);
  finally
    oSigner.Free;
  end;
end;

PAdES through the sgcSign bridge

procedure SignPAdES(const AInput, AOutput: string);
var
  oKey: TsgcPEMKeyProvider;
  oSigner: TsgcPDFPAdESSigner;
begin
  oKey := TsgcPEMKeyProvider.Create(nil);
  oSigner := TsgcPDFPAdESSigner.Create(nil);
  try
    // any sgcSign key provider: PEM, PFX, PKCS#11, Windows store, cloud HSM
    oKey.LoadFromFile('signer.pem', 'signer.key');
    oSigner.KeyProvider := oKey;
    // paBB, paBT (timestamp), paBLT and paBLTA (long term validation)
    oSigner.Level := paBB;
    // signature field and appearance through the sgcPDF handler
    oSigner.Handler.SetField('Signature1', 0, 350, 50, 550, 110);
    oSigner.Handler.SignerName := 'John Smith';
    oSigner.Handler.Reason := 'Approved';
    oSigner.SignPDFFile(AInput, AOutput);
    oSigner.KeyProvider := nil;
  finally
    oSigner.Free;
    oKey.Free;
  end;
end;

Redact a name and an area

procedure RedactFile(const AInput, AOutput: string);
var
  oRedactor: TsgcPDFRedactor;
  vOptions: TsgcPDFRedactionOptions;
begin
  oRedactor := TsgcPDFRedactor.Create;
  try
    // every occurrence of a text, on all pages
    oRedactor.AddText('John Smith');
    // an area of page 0: left, bottom, right, top in points
    oRedactor.AddArea(0, 50, 500, 250, 650);
    vOptions := oRedactor.Options;
    vOptions.OverlayText := 'REDACTED';
    vOptions.RemoveMetadata := True;
    oRedactor.Options := vOptions;
    oRedactor.Apply(AInput, AOutput);
  finally
    oRedactor.Free;
  end;
end;

Archiving & Accessibility

FeatureDetails
PDF/APDF/A-1, PDF/A-2 and PDF/A-3 output at levels a and b, with XMP metadata, output intent and embedded fonts.
ValidatorTsgcPDFAValidator checks a file against the selected PDF/A level and reports errors and warnings.
Tagged PDFStructure tree with Document, Part, Sect, H1 to H6, P, L, LI, Table, TR, TH, TD and Figure with alternate text, marked content, role map, language and MarkInfo.
PDF/UA-1Accessible output together with PDF/A-2a or PDF/A-3a, and PDF/UA-1 checks in the validator.
AttachmentsEmbedded files with MIME type, dates and PDF/A-3 associated file relationships.
Factur-X and ZUGFeRDEmbeds the invoice XML with the Factur-X XMP extension schema for the Minimum, Basic WL, Basic, EN 16931, Extended and XRechnung profiles, and saves the file as PDF/A-3b.

Factur-X invoice as PDF/A-3b

procedure CreateFacturX(const AInvoiceXML, AFileName: string);
var
  oPDF: TsgcPDFDocument;
  oXML: TMemoryStream;
  vXML: TBytes;
  vFont: Integer;
begin
  oPDF := TsgcPDFDocument.Create;
  oXML := TMemoryStream.Create;
  try
    // the invoice XML (CII) is created by your application
    oXML.LoadFromFile(AInvoiceXML);
    SetLength(vXML, oXML.Size);
    Move(oXML.Memory^, vXML[0], oXML.Size);
    oPDF.Info.Title := 'Invoice 2026-001';
    // PDF/A requires embedded fonts
    vFont := oPDF.AddTrueTypeFont('Arial', False, False);
    oPDF.AddPage(595, 842).DrawTextTT('Invoice 2026-001', 50, 780, vFont, 18);
    // embeds factur-x.xml, adds the Factur-X XMP schema, saves as PDF/A-3b
    oPDF.Attachments.AddFacturX(vXML, fxpEN16931);
    oPDF.SaveToFile(AFileName);
  finally
    oXML.Free;
    oPDF.Free;
  end;
end;

Validate PDF/A

procedure ValidatePDFA(const AFileName: string);
var
  oParser: TsgcPDFParser;
  oValidator: TsgcPDFAValidator;
  i: Integer;
begin
  oParser := TsgcPDFParser.Create;
  oValidator := TsgcPDFAValidator.Create(paA3b);
  try
    oParser.LoadFromFile(AFileName);
    oParser.Parse;
    if oValidator.Validate(oParser) then
      WriteLn('PDF/A-3b: no errors')
    else
      for i := 0 to oValidator.Errors.Count - 1 do
        WriteLn('Error: ', oValidator.Errors[i]);
  finally
    oValidator.Free;
    oParser.Free;
  end;
end;
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Build with sgcPDF

Request a trial and add PDF features to your Delphi or C++ Builder application.