#include "l_bitmap.h"
L_LTSVG_API L_INT L_SvgGetDocumentVersion(docHandle, version)
const L_SvgNodeHandle docHandle; |
SVG document handle |
L_SvgVersion* version; |
pointer to a variable |
Gets the SVG version of the document.
Parameter |
Description |
| docHandle | The SVG document handle to test. |
| 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. |
| SUCCESS | The function was successful. |
| < 1 | An error occurred. Refer to Return Codes. |
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
| LTSVG For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64, Linux.
| Functions: | L_SvgFlatDocument, L_SvgSetFlatDocument, L_SvgCreateDocument, L_LoadSvg, L_SvgLoadDocument, L_SvgFreeNode |
| Topics: | Working with SVG |
| SVG Size, Bounds and Flat |
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.
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileNameL_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 documentwsprintf(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 versionL_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 versionversion = 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 versionnRet = L_SvgSetDocumentVersion(docHandle, version);if (nRet != SUCCESS){L_SvgFreeNode(docHandle);return nRet;}// Save it to file on disk as SVGwsprintf(msg, L_TEXT("Saving: %s\n"), dstFileName);wprintf(msg);nRet = L_SvgSaveDocument(dstFileName, docHandle, NULL);// Free the source SVG documentL_SvgFreeNode(docHandle);return nRet;}