Skip to main content Skip to footer

What's New in Document Solutions v7.1

We are excited to announce the most recent updates to our document management capabilities: the release of Document Solutions v7.1. This release adds the ability to select text and add comments in DsPdfViewer, supports PDF files with embedded media files, and saves images to another image format in Image Viewer, and much more.

Explore the new features of this release below:

Document Solutions for PDF (DsPdf)
Document Solutions PDF Viewer (DsPdfViewer)
Document Solutions for Excel (DsExcel)
Document Solutions for Imaging (DsImaging)
Document Solutions Image Viewer (DsImageViewer)
Document Solutions for Word (DsWord)

Ready to Check Out the Release? Download Document Solutions Today!

Document Solutions for PDF (DsPdf)

Add Rich Media to PDF Documents

Enhance your PDF documents by seamlessly incorporating rich media elements such as audio and video. With the addition of rich media, you can elevate user engagement and create dynamic, interactive content within your PDFs. Incorporate multimedia support programmatically into your PDF documents using the new RichMediaAnnotation class.

Here are the key capabilities of the class:

  1. Embed Multimedia Content: RichMedia annotations enable incorporating multimedia assets, including audio, video, and animations, into PDF files. This can enhance presentations, educational materials, or interactive forms.
  2. Annotation Properties: RichMedia annotations have properties that define how the multimedia content should be presented. These properties may include the activation conditions, visibility settings, and the appearance of the annotation.
  3. Activation and Deactivation: Activation conditions determine when the multimedia content should start or stop playing. For example, you can set the content to play when the user clicks the annotation or when the page containing the clip becomes visible.
  4. Presentation Style: RichMedia annotations support two types of presentation styles - Embedded and Windowed.
  5. Control Navigation: RichMedia annotations allow you to control the settings of navigation options to True or False.

The following code adds a RichMediaAnnotation to the PDF document:

GcPdfDocument doc = new GcPdfDocument();

var p = doc.NewPage();

// add video when page becomes visible
RichMediaAnnotation rma = new RichMediaAnnotation();
rma.SetVideo(GetFile(doc, "Wetlands.mp4"));
rma.PresentationStyle = RichMediaAnnotationPresentationStyle.Embedded;
rma.ActivationCondition = RichMediaAnnotationActivation.PageBecomesVisible;
rma.DeactivationCondition = RichMediaAnnotationDeactivation.PageBecomesInvisible;
rma.ShowNavigationPane = true;
rma.Page = p;
rma.Rect = new _Rect(10, 10, 300, 200);


Programmatically add rich media to PDF documents using C# and a .NET PDF API

Help | Demo Basic | Demo - Insert Video in existing PDF

Optimize PDF File Size

You can now optimize the PDF file by using new API that helps eliminate redundant instances of identical images internally within the document. It will now also be possible to optimize the PDF File size of a merged PDF document. Following new API is introduced -

  1. New GcPdfDocument.RemoveDuplicateImages() method to remove instances of identical images internally.
  2. MergeDocumentOptions.RemoveDuplicateImages boolean property which if ‘true’, calls RemoveDuplicateImages() method internally.

Have a look on the following code that implements GcPdfDocument.RemoveDuplicateImages() method while merging two PDF documents.

 static void MergeDoc(GcPdfDocument dstDoc, string fileName)
            GcPdfDocument d = new GcPdfDocument();
            var fs = new FileStream(fileName, FileMode.Open);
static void Main(string[] args)
            GcPdfDocument doc = new GcPdfDocument();
            MergeDoc(doc, @"..\..\..\Individual_PDF1.pdf");
            MergeDoc(doc, @"..\..\..\Individual_PDF2.pdf");

The file size of the PDF Document merged with the above method and merged without the above method can be seen below -

Exclude Duplicate Images on Merging PDFs using C#

Help Demo

Document Solutions for PDF (DsPdf) and Document Solutions for Imaging (DsImaging)

Draw Rotated Text within Unrotated Rectangular Bounds

Drawing rotated text within unrotated rectangular bounds offers several advantages, such as allowing better space utilization, consistency in layout, efficiency with responsive designs without major disruptions to the design, and more. DsPdf and DsImaging now support drawing rotated text within unrotated rectangular bounds. With DsPdf/DsImaging, users can now employ the DrawRotatedText and MeasureRotatedText methods within the GcGraphics class to draw rotated text within unrotated rectangular bounds, similar to how MS Excel draws rotated text inside borderless cells. DrawRotatedText facilitates the drawing of text at an angle within a specified rectangle, while MeasureRotatedText calculates the bounds for accurate text placement. DsPdf/DsImaging also enables a user to set the alignment of the rotated text using RotatedTextAlignment enumeration, which is used as one of the parameters in the above methods. These new methods are applicable to all classes derived from GcGraphics, including those involved in drawing to PDF, SVG, and bitmaps. 

The following code draws rotated text at a negative angle within unrotated rectangular bounds with the following parameters:

Rotation angle: -45°, Text alignment: Leading, Rotated text alignment: BottomLeft, Is vertical stacking: False

var doc = new GcPdfDocument();
var page = doc.Pages.Add();
var g = page.Graphics;
Draw(g, new RectangleF(10,10,100,100), angle: -45, false, RotatedTextAlignment.BottomLeft, TextAlignment.Leading);

static void Draw(GcGraphics g, RectangleF rect, int angle, bool verticalStacking, RotatedTextAlignment rotatedAlign, TextAlignment textAlign)
            // Draw a legend stating the current DrawRotatedText arguments' values:
            var tlLegend = g.CreateTextLayout();
            // The target rectangle for the DrawRotatedText call:
            var d = tlLegend.ContentHeight + 12;
            rect.Y += d;
            rect.Height -= d;
            // Text layout to draw:
            var tl = g.CreateTextLayout();
            tl.DefaultFormat.FontName = "Calibri";
            tl.DefaultFormat.FontSize = 12;
            tl.Append("The quick brown fox jumps over the lazy dog. ");
            tl.Append("The quick brown fox jumps over the lazy dog.");
            tl.TextAlignment = textAlign;
            // Outline the target rectangle in green:
            g.DrawRectangle(rect, new GCDRAW::Pen(Color.PaleGreen, 3));
            // Outline the actual text rectangle in red:
            var tlCopy = tl.Clone(true);
            var tlRect = g.MeasureRotatedText(tlCopy, angle, verticalStacking, rect, rotatedAlign);
            g.DrawRectangle(tlRect, new GCDRAW::Pen(Color.Red, 1));
            // Draw rotated text:
            g.DrawRotatedText(tl, angle, verticalStacking, rect, rotatedAlign);

When saved as an image, the above code generates the following output (find full code here).

Draw rotated text within unrotated rectangular bounds in images and PDFs using C#

Drawing Text in Slanted Rectangles

Text can also be rotated within slanted rectangles, similar to how MS Excel draws rotated text in cells with borders. To achieve this layout, DsPdf/DsImaging also added a special method: the DrawSlantedText method, which is very similar to the DrawRotatedText method except for the last parameter of the SlantedTextAlignment type that specifies the alignment of slanted text within the target rectangle. There are six modes for this enum type: BelowRotatedInside, BelowRotatedOutside, AboveRotatedInside, AboveRotatedOutside, CenterInsideOutside, and CenterOutsideInside. 

The following is a basic code on using the DrawSlantedText method to draw text in a slanted rectangle (see the following image) in a PDF document (find full source code here)—the SlantedTextAlignment.CenterInsideOutside enum option makes the text appear at the center between the rectangle sides rotated at the same angle as the text. The side above the text is rotated inside the rectangle.

static void RText(GcGraphics g, int angle, float x1, float y1, float x2, float y2, string s)
    var tl = g.CreateTextLayout();
    tl.TextAlignment = TextAlignment.Center;
    tl.Append(s, new TextFormat
        FontName = "Segoe UI",
        FontSize = 27,
        FontSizeInGraphicUnits = true,
        FontBold = true
    var rc = new RectangleF(x1, y1, x2 - x1, y2 - y1);
    g.DrawSlantedText(tl, angle, false, rc, SlantedTextAlignment.CenterInsideOutside);

Programmatically Draw Text in Slanted Rectangles in PDFs and Image files using C#

Look at our Demos to see how to draw rotated text within unrotated rectangular bounds or within slanted rectangles. Use the various options of the DrawRotatedText and the SlantedTextAlignment enum.

Help DsPdf | Help DsImaging

Document Solutions PDF Viewer (DsPdfViewer)

Select Text and Add Comments 

DsPdfViewer enhances the comment functionality to align with a user-friendly approach to adding comments. The new "Add comment" option in the context menu will help users select any text and add comments to the selection. The Reply Tool now activates automatically when a markup annotation or text comment is added via the context menu, focusing on the new comment in the list. This approach facilitates quick collaboration, feedback collection, and effective communication among multiple users, thereby contributing to a more efficient user interface for reviewing documents.

Allow users to select text and add comments to PDFs in JavaScript Apps

Additional enhancements to the Reply Tool include:

  1. Temporary highlighting of a selected annotation on the PDF page is now featured when the annotation is chosen in the comments list within the Reply Tool.
  2. Users can now delete a comment item using the Delete key and navigate through comment items using the TAB and Arrow keys.
  3. The functionality to resize the right sidebar element has been incorporated.
  4. The color has been removed from Reply Tool icons, resulting in improved annotation icons.

An additional option, 'showContextMenuOnSelection,' has been added to programmatically control the context menu behavior when text is selected. The option has the following values:

  • "Auto": Automatically determines whether to show the context menu based on the device type.
  • "On": Always shows the context menu when text is selected.
  • "Off": Never shows the context menu when text is selected.
    The default value is "Auto".

Help | Demo

Work with Rich Media Annotations (audio/video) in PDF Documents

DsPdfViewer now facilitates the playback of embedded media resources, such as audio and video, providing users with a more immersive experience and direct interaction with multimedia content embedded within PDF documents. This enhancement is achieved by integrating multimedia support through rich media annotations, aligning with the PDF specification. In the v7.1 release, the Annotation editor and Quick edit toolbar under 'Attachments and stamps' now feature a newly added toolbar button labeled "Add rich media". This button helps to add media files (audio/video) to the PDF document. 

Just click on the “Add rich media” button and browse for the media file you want to add to the PDF document, which will be embedded in the PDF document.

Allow users to work with rich media annotations (audio/video) in PDFs in JavaScript apps

Not only can you add media files, but you can also remove the media files or modify their properties within the viewer. The property panel allows editing various RichMedia annotation properties, including Media, Poster, Activation/Deactivation, Presentation Style, and Controls (navigation) settings. You can also download the Media and Poster files from the properties panel. 

Users can set PDF rich media presentation style using JavaScript PDF Viewer Control The PDF Viewer extends this support to various video formats, including MP4, SWF, FLV, and WebM, while also covering audio formats such as MP3, OGG, and WAV.

 Please take a look at the following resources for more info.

Help | Demo

Document Solutions for Word (DsWord)

Add Online Video in Word Documents

Integrating online videos into Word documents enhances dynamic visual elements, making complex concepts clearer. Additionally, it facilitates versatile content creation, promoting interactive and informative documentation for diverse purposes, from educational materials to business reports. DsWord presents the WebVideoProperties class, empowering users to customize the video player's HTML content and define its dimensions. This facilitates the seamless integration of online videos into Word documents, enabling direct playback within the document for a richer multimedia experience. The class offers the SetUrl method with three overloads, allowing users to specify the video's input URL, title, height, and width. This method generates the appropriate EmbeddedHTML string internally, providing a convenient way for users to define these parameters that may be challenging to write directly.

The following code adds an online video to the Word document:

var dsdoc = new GcWordDocument();
var pic = dsdoc.Body.Paragraphs[3].AddRun().AddPicture();
// Poster frame image.
byte[] imageBytes = File.ReadAllBytes("Wetlands.jpg");
pic.ImageData.SetImage(imageBytes, contentType: "image/jpeg");
pic.ImageData.WebVideoProperties.SetUrl("", "title", 60, 60);

Programmatically add online video in Word documents using C#

Help | Demo

Document Solutions Image Viewer (DsImageViewer)

Save an Image in JavaScript Image Viewer to Different Format

Converting images from one format to another is pivotal in empowering users to customize their visual content to adhere to various requirements and standards. Users can now transform images into alternative formats in DsImageViewer, ensuring compatibility across various devices, platforms, and applications. The enhanced "Save" button now includes the "Save As" feature, presenting a convenient "Save As" dropdown menu, which will be available by default in the Viewer. This dropdown menu enables users to effortlessly convert and save images in alternative formats, enhancing the overall user experience.

Allow users to convert images in JavaScript app with DsImageViewer

The save method allows users to programmatically save images in various formats using the convertToFormat option. The supported image formats for conversion include PNG, JPEG, WEBP, BMP, and GIF (image/png, image/jpeg, image/webp, image/bmp, image/gif).

// Example: Save the modified image in PNG format.
const viewer = DsImageViewer.findControl("#root");{ convertToFormat: "image/png" });

Users can also now utilize the saveButton option to customize the behavior and appearance of the save button or to enable or disable the Save button drop-down menu. The following code restricts "Save As" Image Formats to PNG and BMP.

var viewer = new DsImageViewer("#root", { saveButton: { saveAsMenu: { availableFormats: ["image/png", "image/bmp"] } } });

 Help | Demo

Ready to Check Out the Release? Download Document Solutions Today!



comments powered by Disqus