getSvg Method

Summary

Gets a URL to this page as an SVG document with the specified options.

Syntax

JavaScript Syntax
DocumentPage.prototype.getSvg = function(options) 
TypeScript Syntax
getSvg(options: DocumentGetSvgOptions): string; 

Parameters

options

The options to use when loading the SVG for the page.

Return Value

A URL that represents the SVG image for this page if available or null.

Remarks

This method will be deprecated. Use GetSvgUrl instead.

GetSvgUrl is used to get an SVG document representation of this page. Not all document types support this method, this depends on the value of DocumentImages.IsSvgSupported.

The options parameter controls how the SVG document is generated. A common use is to load the SVG without any image elements that may contain large embedded data. This data is Base64 encoded which result in even bigger memory size for the SVG data. One workaround for this is to use DocumentGetSvgOptions. The result SVG document will only contain the text and vector shapes and will a small memory footprint. Then, GetSvgBackImageUrl can be called to return a raster image that contain the dropped image elements separately.

This method works as follows:

  1. If this document does not support SVG (the value of DocumentImages.IsSvgSupported is false), then this method will return null.

  2. If an item was found in the cache, it is returned right away.

  3. If this is an original page in the source document file (the value of OriginalPageNumber is not -1), then the SVG document to loaded from the original page.

  4. If this is not an original page in the source document file (the value of OriginalPageNumber is not 1), then a new SVG document is created based on the page size and resolution and the default values in DocumentImages.

  5. The SVG document is saved to the cache before it is returned. Next time this method is called, the SVG will be returned from the cache directly without loading it from the file or creating a new instance.

If the value of ImageScale is a value greater than 1, then the result SVG document will have a size that is equal to Size / ImageScale.

The LEADTOOLS Document Viewer uses this method to obtain the SVG document for the page when the view mode is "SVG".

The LEADTOOLS Document Converter uses this method to obtain the SVG document for the page when converting without using OCR.

Refer to Loading Using LEADTOOLS Documents Library for more information.

Example

For an example, refer to LoadFromUri.

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Documents Assembly