L_SvgLoadDocumentMemory

#include "l_bitmap.h"

L_LTSVG_API L_INT L_SvgLoadDocumentMemory(buffer, bufferSize, docHandle, options)

const L_UCHAR* buffer;

pointer to the file in memory to be loaded

L_UINT bufferSize;

size of the file in memory (in bytes)

L_SvgNodeHandle* docHandle;

address of SVG document handle

const L_SvgLoadOptions* options;

pointer to load options

Loads an SVG document from an SVG file from memory.

Parameter

Description

buffer Pointer to the file in memory to be loaded.
bufferSize Size of the file in memory (in bytes).
docHandle Pointer to the L_SvgNodeHandle referencing the target SVG document.
options Optional pointer to a structure containing SVG load options. Pass NULL to use the default options.

Returns

SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

Support for SVG is available in Document and Medical Imaging toolkits.

To get and set information on the document bounds and resolution refer to SVG Size, Bounds and Flat.

When the SVG document data is no longer needed, you must call L_SvgFreeNode to free storage allocated for the SVG document.

Required DLLs and Libraries

LTSVG
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.

Platforms

Win32, x64, Linux.

See Also
Functions: L_SvgCreateDocument, L_LoadSvg, L_SvgLoadDocument, L_SvgFreeNode
Topics: Working with SVG

Example

This example will save an SVG document to a memory buffer and reload it.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT SvgLoadDocumentMemoryExample(L_VOID) 
{ 
   L_INT nRet = SUCCESS; 
   L_TCHAR srcFileName[L_MAXPATH] = MAKE_IMAGE_PATH(TEXT("Leadtools.doc")); 
   L_TCHAR dstFileName[L_MAXPATH] = MAKE_IMAGE_PATH(TEXT("Output.svg")); 
   L_TCHAR msg[1024] = {0}; 
   // Load as SVG from source document 
   wsprintf(msg, L_TEXT("Loading: %s\n"), srcFileName); 
   wprintf(msg); 
   LOADSVGOPTIONS svgOptions = {0}; 
   svgOptions.uStructSize = sizeof(LOADSVGOPTIONS); 
   nRet = L_LoadSvg(srcFileName, &svgOptions, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   // Save it to memory as SVG 
   wsprintf(msg, L_TEXT("Saving to memory\n")); 
   wprintf(msg); 
   L_UCHAR* buffer = NULL; 
   L_UINT bufferSize = 0; 
   nRet = L_SvgSaveDocumentMemory(svgOptions.SvgHandle, &buffer, &bufferSize, NULL); 
   // Free the source SVG document 
   L_SvgFreeNode(svgOptions.SvgHandle); 
   svgOptions.SvgHandle = NULL; 
   if(nRet == SUCCESS) 
   { 
      // Load from memory 
      wsprintf(msg, L_TEXT("Loading from memory\n")); 
      wprintf(msg); 
      L_SvgNodeHandle docHandle = NULL; 
      nRet = L_SvgLoadDocumentMemory(buffer, bufferSize, &docHandle, NULL); 
      // Free the memory allocated by L_SvgSaveDocumentMemory 
      L_SvgFreeMemory(buffer); 
      if(nRet == SUCCESS) 
      { 
         // Save it to file on disk as SVG 
         wsprintf(msg, L_TEXT("Saving: %s\n"), dstFileName); 
         wprintf(msg); 
         nRet = L_SvgSaveDocument(dstFileName, docHandle, NULL); 
      } 
      // Free the SVG document 
      L_SvgFreeNode(docHandle); 
   } 
   return nRet; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS SVG C API Help