name of the file to load
pointer to a structure
pointer to optional extended load options
Loads a page from an image, document or vector file as an SVG file.
|pszFile||Character string containing the name of the file to load.|
|pOptions||Pointer to a structure that contains the options used for loading SVG files. This can be NULL to use the default options.|
|pLoadOptions||Pointer to optional extended load options. Pass NULL to use the default load options.|
|SUCCESS||The function was successful.|
|<1||An error occurred. Refer to Return Codes.|
Support for loading as SVG is only available in Document and Medical Imaging toolkits.
Before calling this function, you may need to get or set file information, such as the page number of a multi-page file or the resolution of a PCD file. Refer to Getting and Setting File Information.
Note: More options are available in the LOADFILEOPTION structure.
Use this function to load a page from any supported image, document or vector file as SVG (Scalable Vector Graphics). The following conditions must be met to load a page from a file as SVG:
|The file format is SVG||SVG can be loaded as SVG (SVG files can also be loaded using L_SvgLoadDocument).|
|The file format is document||The file is in one of the document file formats supported by LEADTOOLS such as DOC/DOCX, PPT/PPTX, XLS/XLSX, RTF, TXT, AFP, ICA, etc. These formats will set the FILEINFO.bIsDocFile member to TRUE when calling L_FileInfo.|
|The file format is vector||The file is in one of of the vector file formats supported by LEADTOOLS such as DXF, DWG, etc. These formats will set the FILEINFO.bIsVectorFile member to TRUE when calling L_FileInfo.|
|The file format is PDF||And the PDF file contains more than pure raster data (for example, not scanned PDF file).|
To find out if an input file can be loaded as SVG, use L_CanLoadSvg.
In addition to LTFIL, the following additional DLLs may be required to support loading as SVG:
|LTSVG||SVG support. Always required.|
|LVKRN||Required if the input document is a vector file.|
|LTPDF||Required if the input document is a PDF file.|
The SVG loaded by this function will be returned in the LOADSVGOPTIONS structure.
You must check the resulting SVG document flatness and perform the necessary operation before continuing.
For more information, refer to Working With SVG.
Required DLLs and Libraries
File format DLLs For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.
|Functions:||L_CanLoadSvg, L_SvgLoadDocument, L_LoadBitmap, L_SetRasterizeDocOptions|
|Topics:||Raster Image Functions: Loading Files|
|Raster Image Functions: Redirecting Input and Output|
|Loading and Saving Images|
|Working With SVG|
|SVG Size, Bounds and Flat|
This example loads a PDF file as SVG and then saves the document out as SVG.
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT nRet = ERROR_FILE_FORMAT;
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);
docOptions.uXResolution = 300;
docOptions.uYResolution = 300;
nRet = L_LoadSvg(filename, &options, NULL);
if(nRet != SUCCESS)
memset(&saveOptions, 0, sizeof(L_SvgSaveOptions));
saveOptions.StructSize = sizeof(L_SvgSaveOptions);
saveOptions.Encoding = L_SvgEncoding_UTF16;
saveOptions.Formatted = TRUE;
nRet = L_SvgSaveDocument(MAKE_IMAGE_PATH(TEXT("Leadtools.pdf.svg")), options.SvgHandle, &saveOptions);