What's New in Documents for PDF v6

GcPdf v6 - December 15, 2022

GrapeCity Documents for PDF (GcPdf)

Rendering HTML to PDF and Raster Images

GcPdf v6 release has updated the existing GrapeCity.Documents.Html (GcHtml) package with new API for converting HTML markup to PDF. The new package does not depend on a custom build of Chromium and does not include any GPL or LGPL licensed code. Also, GcHtml no longer requires any platform dependent packages specific to Windows, macOS and Linux, as required by the previous version of GcHtml. The package introduces GcHtmlBrowser class - the main licensed class which represents a browser process, such as Chrome, Edge, or Chromium browser, and BrowserFetcher class that helps with discovering the path to the browser or downloading the Chromium browser from the public server. An instance of GcHtmlBrowser has two important methods: NewPage(Uri uri) and NewPage(string html). Both methods return an instance of HtmlPage class which represents a browser tab after navigating to the specified web address, file, or the arbitrary HTML content.

The old 'GcHtmlRenderer' class is now obsolete but it is still available (for backward compatibility) and works internally through the new GcHtmlBrowser class. There are some added advantages of using the new package like:
  • No dependencies on custom Chromium build.

  • No dependency on GPL/LGPL licensed software

  • Use the same browser instance to render multiple pages

  • Modify/replace the HTML page content

There is a lot more to the introduction of the new GcHtml package. Have a look on following resources to read more on how to use this package.

Support for Appearance streams for all annotations

To render annotations with the same display in all viewers, Appearance streams are associated with annotations - these are optional settings part of the PDF specification. GcPdf now supports an appearance stream for all annotations it supports, thereby rendering the annotations exactly with the same appearance in any viewer. Please note - In this version, GcPdf cannot generate correct appearance streams for rich text.

Additionally, in the v6 release, GcPdf adds GcPdfDocument.BuildRichTextAppearanceStreams boolean property, which generates content streams for annotations having rich text. This property is false by default, so the content streams with rich text are not generated, and viewers supporting rich text can render these annotations the same as before. If set to true, GcPdf will generate the content streams using plain text so that the rich text will be lost, but the annotation will look the same in all viewers. In the snapshot below, this property is set to false, so the free text annotation with rich text is shown correctly. The appearance of annotations is the same as rendered in Acrobat.

View Help

GrapeCity Documents PDF Viewer (GcPdfViewer)

Support for Text Markup Annotations

Now highlight, strikeout, underline text or add squiggly line with new set of annotations in GcPdfViewer. Following options are added -

  • New toolbar for Highlight, Underline, Squiggly and StrikeOut annotations in Quick edit tools and Annotation Editor.


  • Text markup context menu with new options visible when the text is selected. The options are also added to the default context menu

  • Button keys for new annotations to add in the toolbar -'edit-highlight', 'edit-underline', 'edit-squiggly', 'edit-strike-out'.

  • Enable or disable Text markup context menu.

  • Change list of colors available in context menu through code.

View Help | Demo

Save PDF pages as Images

You can now save PDF pages as images from the viewer. GcPdfViewer client API adds a new saveAsImages method - to save pages of the current PDF document as PNG images. The option zips the resultant images and downloads the result zip archive on the client side. The ‘Save as images’ button can be added to ‘Annotation Editor' or ‘Form Editor’ with the button key - "save-images".

The following code can be used to save the images and specify resultant zip file name programmatically:

// Save the pages of the current PDF document as PNG images and specify destination zip file name
viewer.saveAsImages('images.zip');

View Help | Demo

Select Product Version...