L_IsSvgFile

#include "l_bitmap.h"

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

L_TCHAR *pszFile;

name of the file to be checked

L_BOOL *pbIsSvg;

pointer to a variable

pLOADFILEOPTION pLoadOptions;

pointer to optional extended load options

pFILEINFO pFileInfo;

pointer to a structure

Quickly determines whether the file contains an SVG image.

Parameter Description
pszFile Character string containing the name of the file to be checked.
pbIsSvg Pointer to a variable to be updated. TRUE if the file is SVG, otherwise, FALSE.
pLoadOptions Pointer to a structure that contains the options used for loading SVG files. This can be NULL to use the default options.
pFileInfo Pointer to optional extended load options. Pass NULL to use the default load options.

Returns

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:

L_LoadSvg, L_LoadSvg2, L_LoadSvgMemory

Topics: Working With SVG

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.2019.3.12
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS SVG C API Help