L_IsSvgFile

#include "l_bitmap.h"

L_LTFIL_API L_INT L_IsSvgFile(pszFile, pbIsSvg, pLoadOptions, pFileInfo)

Quickly determines whether the file contains an SVG image.

Parameters

L_TCHAR *pszFile

Character string containing the name of the file to be checked.

L_BOOL *pbIsSvg

Pointer to a variable to be updated. TRUE if the file is SVG, otherwise, FALSE.

pLOADFILEOPTION pLoadOptions

Pointer to a structure that contains the options used for loading SVG files. This can be NULL to use the default options.

pFILEINFO pFileInfo

Pointer to optional extended load options. Pass NULL to use the default load options.

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.

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.

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

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; 
} 

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

LEADTOOLS SVG C API Help