Skip to main content Skip to footer

What's New in GrapeCity Documents v5.2

We are pleased to announce the new v5.2 releases of GrapeCity Documents for PDFDocuments PDF ViewerDocuments for WordDocuments for Imaging, GrapeCity Documents for Excel .NET, and GrapeCity Documents for Excel Java. In addition, we're excited to introduce GrapeCity Documents Image Viewer (Beta), a JavaScript-based Image viewer to view and edit Images. In addition, GrapeCity Documents makes significant additions to existing Document APIs.

Have a look at the Key highlights of the releases below.

View and Edit More Document Formats with GrapeCity Documents

GrapeCity Documents Image Viewer Beta

GrapeCity Documents Image ViewerBeta  (GcImageViewer) is a JavaScript-based Image Viewer and Editor that can load images of multiple formats and allow users to edit these images using different tools. The user could also save/download the edited image in the viewer. 

Download v5.2 of GrapeCity Documents now!

In the v5.2 release, GcImageViewer includes the following features - 

  1. Load, edit, and save images
  2. Draw an image (through client-side API)
  3. Supported formats: JPEG, PNG, BMP, GIF, TIFF, ICO, SVG, and WebP.
  4. Zoom 
  5. Rotate
  6. Navigation
  7. Plugin Support 
  8. Responsive UI
  9. Client-side API 
  10. Download the edited image on the client side

And more advanced features for editing images are planned in future releases. 


View full blog for new product releases and Demo browser for feature implementation.

GrapeCity Documents for PDF (GcPdf)

Replace/Delete text in PDF documents

You can now not only search for text in a PDF document using common search options like whole word, case sensitivity, and regular expressions (already supported before) but also replace or remove the found text instances using the new API - ITextMap.ReplaceText(…) or ITextMap.DeleteText(…) methods. This is useful in situations where there are several PDF documents requiring updates. It provides the ability to update and replace certain information in each file programmatically, thus saving time and effort for users and programmers.

The new methods also work for RTL and Vertical text. When replacing text, the new text can have the same or different (specified) font/font size.

Deleting text can be done in two DeleteTextMode options -

Standard: In this mode, the text's position AFTER the deleted one is shifted.

PreserveSpace: In this mode, a space remains in the place of the deleted text, and the text after it does not move.

The following code finds text 'wetlands' in a PDF document and deletes text, using the Standard option:

// delete word "wetlands" from the document
using (FileStream fs = new FileStream(@"Wetlands.pdf", FileMode.Open, FileAccess.Read, FileShare.Read))
    GcPdfDocument doc = new GcPdfDocument();
    FindTextParams ftp = new FindTextParams("wetlands", true, false);
    doc.DeleteText(ftp, DeleteTextMode.Standard);

Delete Standard

View Help | Delete Text Demo | Replace Text Demo

GrapeCity Documents PDF Viewer (GcPdfViewer)

Zoom Textbox Editable

You can now type an arbitrary Zoom value in the Zoom Textbox of GcPdfViewer. The Zoom textbox is editable. Type your value and press Enter; the document will be zoomed to the desired value. Press Esc to revert to the original value while in Edit mode of Textbox.


View Demo 

New Additions to Existing APIs

GrapeCity Documents for Excel (GcExcel)

We are pleased to announce new feature additions to GcExcel API in v5.2. See key highlights below.

  1. New API to add Excel Form Controls to Spreadsheets
  2. Paginated Templates
  3. Support for Chart Data Table 
  4. Add Calculated Item to Pivot Table
  5. Support JSON as DataSource
  6. IsVolatile property support in Custom function 
  7. Get accurate range boundary 
  8. SVG image support in Spreadsheets
  9. Support for LET Function
  10. GetPivotData Formula supports spilled data
  11. Debug mode in GcExcel Templates
  12. Debug better with additional details in InvalidFormulaException
  13. Features for SpreadJS Integration
    • Support for CASCADESPARKLINE formula

Read the release blog for the full list.

GrapeCity Documents for Word (GcWord)

GcWord Report Template Enhancements

Extended syntax check for template tags

GcWord now includes Template tag syntax check upon Template processing. The template tag candidates will be scanned, and the structure will be examined. If any errors are found, an exception will be thrown with detailed information about the problem. 

In the example below, the Date Format specified in the Paragraph is parsed. The characters specified in the format are scanned and reported in the exception.

var coll = new[] { DateTime.Parse("2022/02/12"), DateTime.Parse("1011/03/04") };
var doc = new GcWordDocument();
doc.DataTemplate.DataSources.Add("ds", coll);
'Template key {{ds.value}:format(yyyy:MM:dd)} have non-escaped service char in the formatter param at position 23.
Chars '(',')',':','{','}' should be escaped.'


Add Datasource-specific cultures

With GcWord templates, you can now add specific culture to a specific datasource added to the template. New culture parameters are provided in doc.DataTemplate.DataSources.Add(..) method. All culture-specific conversions with tags from the data source will use the provided culture if this parameter is set. 

The following code adds separate cultures for separate data sources:

DsWord Culture

Demo - Culture-specific parsing | Demo - Culture-specific formatting

Support for Decimal, DateTime, and DateTimeOffset as a primitive type

GcWord Templates Allow primitive types such as integer or float in templates and access them using the ‘value’ tag. The types DecimalDateTime, and DateTimeOffset can also be used in this way.

The following code demonstrates support of DateTime and DateTimeOffset types while adding to data sources and their access using the value tag to set the Date/DateTime format:

var doc = new GcWordDocument();
// The data source (Napoleon's first italian company battle dates from Wikipedia):
doc.DataTemplate.DataSources.Add("dsItalianBattles", new DateTime[]
     //first stage
     //second stage
// The data source (world wide wars start dates):
doc.DataTemplate.DataSources.Add("dsWW", new DateTimeOffset[]
// Add a list template so that the data is formatted as a list:
var myListTemplate = doc.ListTemplates.Add(BuiltInListTemplateId.BulletDefault, "myListTemplate");
//DateTime list
doc.Body.Paragraphs.Add("Napoleon's first italian company battles dates:", doc.Styles[BuiltInStyleId.Heading1]);
// Add a list of battles dates:
var p = doc.Body.Paragraphs.Add("{{#dsItalianBattles}}{{dsItalianBattles.value}:format(yyyy-MM-dd)}{{/dsItalianBattles}}", doc.Styles[BuiltInStyleId.ListParagraph]);
p.ListFormat.Template = myListTemplate;
//DateTimeOffset list
doc.Body.Paragraphs.Add("World wars start dates:", doc.Styles[BuiltInStyleId.Heading1]);
p = doc.Body.Paragraphs.Add("{{#dsWW}}{{dsWW.value}:format(yyyy\\:MM\\:dd)}{{/dsWW}}", doc.Styles[BuiltInStyleId.ListParagraph]);
p.ListFormat.Template = myListTemplate;



Apply shadow effect on Text and Shape

You can now customize the look of your content in MS Word using a new API for applying shadow effects in shapes and text Word .docx files. The new Effects property is added to Font, Shape, Picture, GroupShape, CanvasShape, ShapeStyle, and FormatSсheme classes. The Shadow effect is split into four classes: 

  • ShadowBase is the base abstract class for all shadow classes
  • ShadowPreset and InnerShadow are based on the ShadowBase class
  • OuterShadow is based on the InnerShadow class
  • TextEffects class is used to apply effects to the Font class and contains only OuterShadow shadow type, while ShapeEffects is based on the TextEffects class and has additional InnerShadow and ShadowPreset shadow types

The following snapshot shows the Outer Shadow effect applied to the 'Treadstone' text and BuiltInShadowId.ProspectiveLowerLeft enum applied to the shape using GcWord API. 


You can apply both custom shadow and built-in shadow to Text and shapes. Please note that currently, shadows are not supported in PDF/image exports. 

See the detailed API to apply shadow effects on text and shapes below.

View Help Text Shadow | Help Shapes Style Shadow Effect | Help Shape Format Shadow Effect | Demo

Sample: Import markdown (.md) documents to Word (and convert to PDF/Images)

Now import your Markdown documents into GcWord and convert them to .docx files. GcWord Sample browser now implements a new sample with full source code to convert Markdown .md files to .docx files and PDF. The conversion is done by the GcWordWeb.Samples.MarkdownToWordRenderer.WordRenderer class uses the Markdig package (BSD 2-Clause license) for parsing .md files and the GcWord OM to create MS Word documents from it. The WordRenderer C# source code is included in the sample. The MarkdownToWordRenderer sources are located in the sample zip's Samples/Markdown/Renderer subdirectory.

Markdown to Word

View Demo


The PdfOutputSettings now include PdfOutputSettings.SecurityHandler property gives access to other security-related features (e.g., password, limit copying, etc.) when converting Word .docx file to PDF export. Have a look at the demo below.

Document Security


GrapeCity Documents for Imaging (GcImaging)

New GcImaging.Skia library for enhanced drawing performance and quality

GcImaging introduces a new package, GrapeCity.Documents.Imaging.Skia library represents a new rendering engine for drawing text and graphics with faster performance and enhanced rendering quality across platforms. The library is based on Skia - an open source 2D graphics library that provides common APIs that work across various hardware and software platforms. GcImaging.Skia includes three main classes: GcSkiaBitmapGcSkiaImage, and GcSkiaGraphics

There are several advantages to using GcImaging.Skia library. You can use this library in the following scenarios:

  • For rendering large/complex images
  • For rendering text with the best possible fidelity (with font hinting and subpixel rendering).
  • When you do not need access to individual pixels, DPI other than 96, EXIF/ICC profiles support effects (e.g., dithering).

The following snapshot compares complex text rendered using GcSkiaBitmap and other tools. Notice that text rendered using GcSkiaBitmap has better fidelity.

Skia Rendering

Have a look at the following resources.

View Help | Demo

Support for WebP Image Format

Images play an important role on any website. However, the file formats will dramatically influence how images appear on pages and how fast they load. WebP is a modern image file format to showcase high-quality images without affecting website performance. By using either lossy or lossless compression, WebP lets you retain the rich appearance of your images while simultaneously reaping the benefits of smaller file sizes. The GcBitmap class now supports loading and saving images in WebP format: all existing methods that load images - Image.FromFile/FromStream/FromBytes also now support WebPThe class also supports SaveAsWebp(..) method to save images in WebP format. The overload takes several parameters such as lossy/lossless format, compression quality, etc.

The following code loads a WebP image and saves it to PNG format using GcBitmap class. Also, the GcBitmap class loads a PNG image and saves it to WebP format.

// Converting a WEBP image to PNG format.
using var bmp = new GcBitmap("RoundClip.webp");
// Converting a PNG image to WEBP format.
bmp.SaveAsWebp("RoundClip.webp", null, true, 0,6);

The image below shows a PNG image converted to a WebP image. The size of the WebP image is smaller than PNG and, in addition, is of similar quality. 

Image Quality

View Help | Demo 

Support SVG Text element (basic support)

SVG images can contain text fragments. GcImaging now supports 'text' and 'tspan' elements with a limited set of attributes to SVG images. These elements provide greater control over the text displayed and its position. To support these elements, GcImaging adds SvgTextElement, SvgTSpanElement, SvgTextPathElement classes to its object model. You can add these elements through these classes, or, if they are present in the SVG string, the SVG can simply be loaded into GcSvgDocument and GcImaging object model. 

The following code loads, an SVG image with text and tspan elements draws it on GcBitmapGraphics, and saves it as a PNG image:

// Load an SVG with text and tspan:
var svgString =
"<svg width='12cm' height='3cm' viewBox='0 0 1000 300' xmlns='' version='1.1'>" +
"  <g font-family='Verdana' font-size='64' >" +
"    <text x='160' y='180' fill='blue'>Apples are not <tspan font-weight='bold' fill='orange'>oranges</tspan>.</text>" +
"  </g>" +
using var svg = GcSvgDocument.FromString(svgString);
// Render the SVG image and a border around it:
var bmp = new GcBitmap(pixelSize.Width, pixelSize.Height, opaque, dpi, dpi);
using var g = bmp.CreateGraphics(Color.White);
var pt = new PointF(dpi, dpi);
g.DrawSvg(svg, pt);
var sz = svg.GetIntrinsicSize(SvgLengthUnits.Pixels);
g.DrawRectangle(new RectangleF(pt, sz), Color.MediumPurple);

SVG text element

View Help | Demo

Download v5.2 of GrapeCity Documents now!



comments powered by Disqus