#include "l_bitmap.h"
L_LTSVG_API L_INT L_SvgAddElementIDs(docHandle)
L_SvgNodeHandle docHandle; |
SVG document handle |
Adds unique IDs to the elements of the specified SVG document.
Parameter | Description | |
docHandle | The SVG document handle to update. |
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.
SVG specifications do not require the use of uniqe IDs for the elements. Unique IDs may be desirable when connecting SVG elements to external data structures or to quickly perfrom search using XML methods such as XPATH.
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 loads a PDF file as SVG and then adds IDs to elements
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT SvgAddElementIDsExample(L_VOID)
{
L_INT nRet = ERROR_FILE_FORMAT;
LOADSVGOPTIONS options;
memset(&options, 0, sizeof(LOADSVGOPTIONS));
options.uStructSize = sizeof(LOADSVGOPTIONS);
options.uFlags = L_LOADSVGOPTIONS_NONE;
options.SvgHandle = NULL;
/* Load the document as SVG */
L_TCHAR filename[L_MAXPATH] = MAKE_IMAGE_PATH(TEXT("Leadtools.pdf"));
L_BOOL canLoad = FALSE;
nRet = L_CanLoadSvg(filename, &canLoad, NULL);
if (canLoad)
{
nRet = L_LoadSvg(filename, &options, NULL);
if (nRet != SUCCESS)
return nRet;
nRet = L_SvgAddElementIDs(options.SvgHandle);
L_SvgFreeNode(options.SvgHandle);
}
return nRet;
}