Loads a page from an image, document or vector file as an SVG file.
Character string containing the name of the file to load.
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.
|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, it may be necessary to get or set file information, such as the page number of a multipage file or the resolution of a PCD file. Refer to Getting and Setting File Information.
Use this function to load a page from any supported image, document, or vector format as SVG (Scalable Vector Graphics). All of the following conditions must be met in order for L_LoadSvg 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.|
|A document file can also be loaded as SVG by calling L_SvgLoadDocument.|
|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).|
|A completely raster PDF file will return an error.|
The SVG loaded by this function will be returned in the LOADSVGOPTIONS structure.
Be sure to check the resulting SVG document for flatness and perform any necessary operations before continuing.
For more information, refer to Working With SVG.
Note: More options are available in the LOADFILEOPTION structure.
Required DLLs and Libraries
LTFIL 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. In addition to LTFIL, the following additional DLLs may be required to support loading a file 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.|
This example loads a PDF file as SVG and then saves the document out as SVG.
L_INT ret = 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;
ret = L_CanLoadSvg(filename, &canLoad, NULL);
docOptions.uXResolution = 300;
docOptions.uYResolution = 300;
ret = L_LoadSvg(filename, &options, NULL);
if(ret != SUCCESS)
memset(&saveOptions, 0, sizeof(L_SvgSaveOptions));
saveOptions.StructSize = sizeof(L_SvgSaveOptions);
saveOptions.Encoding = L_SvgEncoding_UTF16;
saveOptions.Formatted = TRUE;
ret = L_SvgSaveDocument(MAKE_IMAGE_PATH(TEXT("Leadtools.pdf.svg")), options.SvgHandle, &saveOptions);