getSvgElement Method


Gets an SVG document for this page with the specified options.


JavaScript Syntax
DocumentPage.prototype.getSvgElement = function(options, imageLoader) 
TypeScript Syntax
getSvgElement(options: DocumentGetSvgOptions, imageLoader: ImageLoader): JQueryPromise<any>; 



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


An optional ImageLoader instance to use instead of the internally-created one.

Return Value

A Promise object that may resolve successfully to an HTML or SVG Element. If IsSvgSupported is false, the request will fail.


To only get the URL instead of loading the image, see GetSvgUrl.

Not all document types support this method; if IsSvgSupported is false, an error will be returned from the service.

The options parameter controls how the SVG document is generated. Since images embedded in the SVG may contain large embedded Base64 data, the DocumentGetSvgOptions.DropImages option can be used to remove those images. The result SVG document will only contain the text and vector shapes and will have a small memory footprint. Then, GetSvgBackImageElement can be called to return a raster image that contains the dropped image elements separately. This strategy is employed in the LEADTOOLS Document Viewer.

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.

This method takes an optional imageLoader parameter for additional image load configuration. If an ImageLoader is provided, Run will not be called and it is the responsibility of the application to call it when needed. If an ImageLoader is not supplied, one is created internally and Run is called before this method exits. See Documents Image Loading for more information.

This request can pass arbitrary user data through ServiceUserData.

Refer to Image Loading Using LEADTOOLS Documents Library and Document Loading Using LEADTOOLS Documents Library for more information.


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