DevExpress.Drawing Graphics Library — Early Access Preview (v23.1) — Office File API, Reporting, and Dashboard-related Enhancements

News
17 April 2023

As you may already know, we introduced our new DevExpress.Drawing graphics library in v22.2 release cycle (and have already introduced a series of enhancements in subsequent minor updates).

This new graphics library was released as a Community Technical Preview (CTP). Like all CTPs, the library had known limitations (which we outlined last year). In this blog post, I will summarize what we’ve addressed in our v23.1 release and what capabilities are available in our EAP build for the following DevExpress products:

  • Office File API
  • Reporting
  • BI Dashboard

If you own an active Universal Subscription, feel free to download this Early Access Preview (EAP) build at your convenience. We welcome your feedback – should you encounter any issues when using the EAP, please submit a DevExpress Support Center ticket.

Early Access and CTP builds are provided solely for early testing purposes and are not ready for production use. This build can be installed side by side with other major versions of DevExpress products. Please backup your project and other important data before installing Early Access and CTP builds.
This EAP may not include all features/products we expect to ship in our v23.1 release cycle. As its name implies, the EAP offers an early preview of what we expect to ship in two months.

If you’re unfamiliar with this topic, please refer to the following post published earlier this year:
DevExpress.Drawing Graphics Library — v22.2.4 Update — Package Dependencies and Font Libraries

Reporting and BI Dashboard

The following drawing library-related capabilities/features are now available in non-Windows environments when using DevExpress Reports and BI Dashboard:

  • Render justified text in labels
  • Respect source image resolution (dpi) within XRPictureBox
  • Embed PDFs into report documents using the XRPdfContent report control
  • Display and print gauges within report documents using the XRGauge report control
  • Use the ImageExportOptions.Resolution property to specify resulting image resolution
  • Export all report pages to a single TIFF image (SingleFile export mode)
  • Automatically replace missing font glyphs for report documents exported to PDF files
  • Gauges and Treemaps can be exported when using BI Dashboards

To improve the overall developer experience, we also replaced all System.Drawing enumerations in our public API with cross-platform counterparts. Please refer to the following breaking change for a complete API list:
Office-Inspired Products, Barcode Generation API, Reporting, and Printing - Members changed their types and signatures

Office File API

Shapes in Word Processing and Spreadsheet Document API

v23.1 addresses limitations associated with the use of our Shape API (in both the Spreadsheet and Word Processing Document API). Word and Excel documents (with shapes) are now exported to PDF and other available formats in non-Windows environments. You can use the Shape API as you did previously to manage shapes as needed. While we’ve solved a number of issues in this release, some work remains. We do not yet support/export shapes with semi-transparent images and shapes that contain metafiles. Once we complete work in this area, we will announce this enhancement in a separate blog post.

PDF Graphics API

The PDF Graphics API is a subset of our PDF Document API. It allows you to create graphics content in PDF files. This feature is closely connected to the System.Drawing.Graphics namespace and implements similar functionality to the GDI+ API. The Graphics API is a comprehensive subset, so we put a lot of effort into making it work with our new graphics library. And we are happy to report that this feature is now available in non-Windows environments. All methods include overloads that use our DevExpress.Drawing classes and enumerations. For example, you can now draw an image on a PDF page as follows (this code will function correctly regardless of the target operating system):

using (var processor = new PdfDocumentProcessor()) {
    processor.LoadDocument("Documents//Document.pdf");

    using (PdfGraphics graphics = processor.CreateGraphics()) {
        
      // Obtain the first document page
      PdfPage page = processor.Document.Pages[0];
      PdfRectangle rect = page.CropBox;
      
      // Specify the image to draw
      using (var stream =
          new FileStream("Documents//DevExpress.png", FileMode.Open, FileAccess.Read)) {
        using (DXImage image = DXImage.FromStream(stream)) {
          
          // Calculate image position
          RectangleF pageCenter =
             new RectangleF((float)rect.Width / 2 - image.Width / 2,
                 (float)rect.Height / 2 - image.Height / 2, image.Width, image.Height);
          
          // Draw an image into the calculated area
          graphics.DrawImage(image, pageCenter);
         
          // Add graphics content to the page foreground
          graphics.AddToPageForeground(page, 72, 72);
        }
      }
    }
    processor.SaveDocument("result.pdf");
}

Export to Bitmap and Image Extraction

v23.1 includes a new PdfDocumentProcessor.CreateDXBitmap method that returns a DXBitmap object. You can also use the PdfDocumentSigner.CreateDXBitmap method to generate a signature image.

Our PDF Document API includes a GetImages method (allows you to retrieve all images from a PDF file). This method returns a list of Bitmap objects. As such, this functionality is unavailable in non-Windows environments. Much like the CreateBitmap-CreateDXBitmap pair, we added a GetDXImages method to return a list of DXBitmap objects.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.