Skip to main content Skip to footer

What's New in GrapeCity Documents for Imaging .NET API in v3

GrapeCity Documents for Imaging (GcImaging) is a high-performance imaging library that can create, load, modify, and save images in .NET Core applications with full support on Windows, macOS, and Linux. GcImaging can be deployed as FaaS with AWS Lambda and Azure functions.

The library is a feature-rich API that can load popular image formats like, BMP, JPEG, TIFF, GIF, and PNG. It can apply advanced image processing techniques and save them back; read/write images, modify images (like rotate, crop, and resize), convert images, apply dithering, and thresholding effects on grayscale images; apply effects on RGB images, draw and fill graphics on images, draw advanced text with full font handling, text, paragraph formatting on images, apply advanced TIFF features, and much more.

Now, with the v3 release, users can convert HTML content to images.

Here is a look into the new features:

Render HTML Content to Images

Render HTML Content to Images

Saving web pages directly as HTML may not give the same rendering results as the original HTML, especially when viewing the page on different devices. When browsing the web, some content may need to be used in other formats, (Word, Excel, PowerPoint, or another documents). It's best to have the content as images, so you make edits like re-sizing, formatting or annotating through standard image editors.

GrapeCity Documents for HTML

The new GrapeCity Documents for Html package will help you render HTML content to Images. It is a utility package available with the GcPdf/GcImaging packages. A platform independent package, GcHtml can convert HTML content to images (PNG, JPEG, and PDF documents). To learn more, see what's New in GrapeCity Documents for PDF.

It also provides a set of convenient extension methods - DrawHtml() to render HTML content on the graphics. HTML rendering is done using the industry standard Chromium web browser engine working in headless mode, offering the advantage of rendering HTML to images on any platform (Windows, Linux, and macOS).

Users can additionally set various image settings while converting HTML to images. You do not need an additional license required to run GcHtml.

The package, GrapeCity.Documents.Html, includes the GcHtmlRenderer class, the main class that can render HTML content to Images. Internally, it uses one of three system-dependent HTML engine packages:

  • GrapeCity.Documents.Html.Windows.X64
  • GrapeCity.Documents.Html.Mac.X64
  • GrapeCity.Documents.Html.Linux.X64

GcHtml will automatically select the correct system-dependent engine package at runtime. That package must be referenced by your project so that GcHtml can find it. You can add references to all three platform packages to your project, or if you only target one or two platforms. Just add the relevant packages for the target platforms.

Key Features
  • Multi-platform package to render HTML content on Windows, macOS or Linux
  • Render HTML string/page/URI source to JPEG, PNG Images
  • Supports:
    • Images
    • CSS
    • JavaScript
    • HTML5
    • SVG
    • HTML Tables
  • Split long HTML content into multiple pages
  • Specify Page Margins
  • Specify JPEG Settings, PNG settings
    • DefaultBackgroundColor
    • WindowSize
    • Viewport
  • Specify JPEG Compression Quality (0%-100%)
  • Specify HtmlToImageFormat - formatting attributes for rendering HTML on GcGraphics

Read more about how to convert HTML content to images using GcImaging.

Help | GcHtml Architecture | Demo

Bitmap Glyphs Support

GcImaging now supports glyph bitmaps specified by the EBDT (Embedded bitmap data) table. With the new release, two new properties -AllowFontSbits and UseBitmapCache are added for rendering small text with low resolution in images.

Sbits are embedded bitmaps present in OpenType fonts for rendering complex glyphs at very small sizes. Such bitmaps usually appear in CJK fonts. If such bitmaps are provided in the font, the Font use these bitmaps when rendering the glyphs. Enlarge the two images below. The first one is before applying the bitmaps and the second one is after applying the AllowFontSBits and UseBitmapCache properties which looks much sharper.

Before applying bitmaps:

After applying bitmaps:

After applying bitmaps:

Documentation

What do you think about the new features? Leave a comment below.

Shilpa Sharma - Product Manager

Shilpa Sharma

Product Manager
comments powered by Disqus