#include "l_bitmap.h"
L_LTFIL_API L_INT L_IsSvgFile(pszFile, pbIsSvg, pLoadOptions, pFileInfo)
Quickly determines whether the file contains an SVG image.
Character string containing the name of the file to be checked.
Pointer to a variable to be updated. TRUE if the file is SVG, otherwise, FALSE.
Pointer to a structure that contains the options used for loading SVG files. This can be NULL to use the default options.
Pointer to optional extended load options. Pass NULL to use the default load options.
Value | Meaning |
---|---|
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.
Note: More options are available in the LOADFILEOPTION structure.
Use this function to determine whether the file contains an SVG image.
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.
This example will save input to svg and check the result file.
L_INT IsSvgFileExample(L_VOID)
{
L_INT ret = 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_TCHAR outFilename[L_MAXPATH] = MAKE_IMAGE_PATH(TEXT("Leadtools.svg"));
ret = L_LoadSvg(filename, &options, NULL);
if(ret != SUCCESS)
return ret;
L_SvgSaveOptions saveOptions;
memset(&saveOptions, 0, sizeof(L_SvgSaveOptions));
saveOptions.StructSize = sizeof(L_SvgSaveOptions);
saveOptions.Formatted = TRUE;
ret = L_SvgSaveDocument(outFilename, options.SvgHandle, &saveOptions);
L_FreeSvg(options.SvgHandle);
if(ret != SUCCESS)
return ret;
L_BOOL isSvgFile = FALSE;
ret = L_IsSvgFile(outFilename, &isSvgFile, NULL, NULL);
wprintf(L_TEXT("Is Svg File: %s"), isSvgFile ? L_TEXT("true") : L_TEXT("false"));
return ret;
}