How To Convert SVG To PNG | Telerik Reporting

skip navigation
  • Telerik Reporting

    Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI UI for Xamarin

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Test Studio Dev Edition Telerik JustMock

    CMS

    Sitefinity

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic FiddlerCap FiddlerCore

    Free Tools

    VB.NET to C# Converter Testing FrameworkView all products
  • Overview
  • Demos
  • Roadmap
    • What's New
    • Roadmap
    • Release History
  • Docs & Support

    Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Use Reports in Applications
    • System Requirements
    • Forums
    • Videos
    • Blogs
    • Submit a Ticket
    • FAQs
  • Pricing
  • Shopping cart
  • Your Avatar Your Account
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now
close mobile menu menu
  • Search in Documentation
  • Search in Knowledge Base
  • Search in API Reference
  • API Reference

New to Telerik Reporting? Download free 30-day trial

Convert SVG graphics to PNG picture

Environment

Product Version 13.0.19.222
Product Progress® Telerik® Reporting

Description

Currently, the PictureBox can hold only the formats supported by GDI+ (BMP, GIF, JPEG, EXIF, PNG, and TIFF). This KB article demonstrates how to convert SVG graphics to PNG picture and to set it as a value of the picturebox. Note that a NuGet package called Svg should be added to the project. The approach is approperiate for reports which are designed in the Standalone Designer, as well as in the Visual Studio Report Designer.

Solution

  1. A UserFunction should be implemented through the code snippet below

    public static Bitmap ConvertToBitmap(string url) { var svgDocument = Svg.SvgDocument.Open(url); svgDocument.ShapeRendering = SvgShapeRendering.Auto; Bitmap bmp = svgDocument.Draw(120, 120); // Draw Bitmap in any Size you need - for example 120px x 120px return bmp; }
  2. Register the user function as explained in Extending Report Designer article. A reference to the Svg.dll should be also attached.

  3. Then the value of the picture box should be set to the following expression:

    = UserFunctionClassName.ConvertToBitmap(Parameters.url.Value)

    Note that the report parameter holds the URL for the picture.

In this article Related articles Not finding the help you need? Contact Support Improve this article
Getting Started
  • Install Now
  • Demos
Support Resources
  • Contact Support
Community
  • Forums
  • Blogs
  • Feedback Portal

Copyright © 2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.

  • Terms of Use
  • Privacy Center
  • Security Center
  • Trademarks
  • License Agreements
  • Code of Conduct
  • Doc Copyright
DO NOT SELL MY PERSONAL INFORMATION

Từ khóa » Svg To Png C#