←Select platform

GetSvgBackImage(RasterColor,int) Method

Summary

Gets a raster image that contains only the image elements of the SVG document for this page.

Syntax
C#
C++/CLI
Java
Python
public RasterImage GetSvgBackImage( 
   RasterColor backColor, 
   int resolution 
) 
public:  
   RasterImage^ GetSvgBackImage( 
      RasterColor^ backColor, 
      int resolution 
   ) 
public RasterImage getSvgBackImage(RasterColor backColor, int resolution) 
def GetSvgBackImage(self,backColor,resolution): 

Parameters

backColor

Color to fill the background of the image.

resolution

Resolution to use, in dots per inch. If this value is 0, then the current page Resolution value is used.

Return Value

Raster image that contains only the image elements of the SVG document for this page if this page supports SVG, and the SVG data contains image elements; otherwise, null.

Remarks

GetSvgBackImage is used to get a raster image that contains only the image elements of the SVG document for this page. Not all document types support this method: support depends on the value of DocumentImages.IsSvgSupported.

Use SetSvgBackImage to replace the SVG background image of the page. Use IsSvgBackImageModified as a flag that indicates that the SVG background image of this page has been replaced by the user.

GetSvgBackImage works as follows (the "item" is the raster image passed by the user):

  1. If this document does not support SVG (the value of DocumentImages.IsSvgSupported is false), then an exception will be thrown.

  2. If an item was found in the cache, it is returned right away. This is available if the document was created using the cache system, and LEADDocument.CacheOptions contains DocumentCacheOptions.PageSvgBackImage.

  3. The SVG data for this page is loaded with everything dropped except the image elements. If the resulting document is empty (the page does not contain any image elements in its SVG), then null is returned.

  4. Otherwise, a new RasterImage is created and filled with backColor (assuming it is not a transparent color). Then the SVG data containing only the image elements is rendered on the surface of this image. The size of the resulting raster image is the same size as this page.

  5. If this document uses the cache system (LEADDocument.HasCache is true), then theRasterImage object is saved to the cache before it is returned. The next time this method is called, the image will be returned from the cache directly—without loading it from the file or creating a new instance.

GetSvgBackImage will check the cache first, hence, subsequent calls will return the value set by this method.

The value of IsSvgBackImageModified will be set to true after this method returns.

If the value of ImageScale is a value greater than 1, then the resulting image will have a size equal to Size / ImageScale.

For more information, refer to Loading Using LEADTOOLS Document Library.

Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.