L_SvgGetDocumentVersion

Summary

Gets the SVG version of the document.

Syntax

#include "l_bitmap.h"

L_LTSVG_API L_INT L_SvgGetDocumentVersion(docHandle, version)

Parameters

const L_SvgNodeHandle docHandle

The SVG document handle to test.

L_SvgVersion* version

Pointer to a variable to be updated with the version.
The version of the SVG document depends on the original data and is read from the SVG data directly.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

Support for SVG is only available in the Document and Medical Imaging toolkits.

To change the version of the SVG document, use L_SvgSetDocumentVersion.

For more information on flat SVG documents and bounds and resolution, refer to SVG Size, Bounds and Flat.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example will load a DOC file as SVG, set the SVG document version, and then save the document as an SVG file on disk.

L_INT SvgGetDocumentVersionExample(L_VOID) 
{ 
   L_INT nRet = SUCCESS; 
   L_TCHAR srcFileName[L_MAXPATH] = MAKE_IMAGE_PATH(TEXT("Leadtools.doc")); 
   L_TCHAR dstFileName[L_MAXPATH] = MAKE_IMAGE_PATH(TEXT("Output.svg")); 
   L_TCHAR msg[1024] = {0}; 
 
   // Load as SVG from source document 
   wsprintf(msg, L_TEXT("Loading: %s\n"), srcFileName); 
   wprintf(msg); 
   LOADSVGOPTIONS svgOptions = {0}; 
   svgOptions.uStructSize = sizeof(LOADSVGOPTIONS); 
   nRet = L_LoadSvg(srcFileName, &svgOptions, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   L_SvgNodeHandle docHandle = svgOptions.SvgHandle; 
 
   // Get the version 
   L_SvgVersion version; 
   nRet = L_SvgGetDocumentVersion(docHandle, &version); 
   if (nRet != SUCCESS) 
   { 
      L_SvgFreeNode(docHandle); 
      return nRet; 
   } 
   switch(version) 
   { 
      case L_SvgVersion_1_0: 
      lstrcpy(msg, L_TEXT("Version: 1.0")); 
      // Set the version 
      version = L_SvgVersion_1_1; 
      break; 
      case L_SvgVersion_1_1: 
      lstrcpy(msg, L_TEXT("Version: 1.1")); 
      version = L_SvgVersion_1_0; 
      break; 
      default: 
      lstrcpy(msg, L_TEXT("Version: Unknown")); 
      version = L_SvgVersion_1_0; 
      break; 
   } 
   wprintf(msg); 
 
   // Set the version 
   nRet = L_SvgSetDocumentVersion(docHandle, version); 
   if (nRet != SUCCESS) 
   { 
      L_SvgFreeNode(docHandle); 
      return nRet; 
   } 
 
   // Save it to file on disk as SVG 
   wsprintf(msg, L_TEXT("Saving: %s\n"), dstFileName); 
   wprintf(msg); 
   nRet = L_SvgSaveDocument(dstFileName, docHandle, NULL); 
 
   // Free the source SVG document 
   L_SvgFreeNode(docHandle); 
 
   return nRet; 
} 

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

LEADTOOLS SVG C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.