L_SvgSetBounds

#include "l_bitmap.h"

L_LTSVG_API L_INT L_SvgSetBounds(flatDocHandle, bounds)

L_SvgNodeHandle flatDocHandle;

SVG document handle

const L_SvgBounds* bounds;

pointer to a structure

Sets the physical (pixel) bounds of the specified SVG document manually.

Parameter

Description

flatDocHandle The SVG document handle for which the bounds should be updated.
bounds Pointer to a structure containing the bounds to use.

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.

For more information on flat SVG documents and bounds and resolution, refer to SVG Size, Bounds and Flat.

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_SvgCalculateBounds, L_SvgGetBounds, L_SvgFlatDocument, L_SvgSetFlatDocument
Topics: Working with SVG
SVG Size, Bounds and Flat

Example

This example loads a PDF file as SVG and then gets and sets the physical (pixel) bounds and resolution of the document

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT SvgSetBoundsExample(L_VOID) 
{ 
   L_INT nRet = 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_BOOL canLoad = FALSE; 
   nRet = L_CanLoadSvg(filename, &canLoad, NULL); 
   if (canLoad) 
   { 
      nRet = L_LoadSvg(filename, &options, NULL); 
      if (nRet != SUCCESS) 
         return nRet; 
      L_SvgNodeHandle flatDocHandle = options.SvgHandle; 
      // Check if we need to flat it 
      L_BOOL isFlat = FALSE; 
      nRet = L_SvgIsFlatDocument(options.SvgHandle, &isFlat); 
      if (nRet != SUCCESS) 
      { 
         L_SvgFreeNode(options.SvgHandle); 
         return nRet; 
      } 
      if (!isFlat) 
         nRet = L_SvgFlatDocument(options.SvgHandle, &flatDocHandle, NULL); 
      if (nRet != SUCCESS) 
      { 
         L_SvgFreeNode(options.SvgHandle); 
         return nRet; 
      } 
      L_SvgBounds bounds = { 0 }; 
      nRet = L_SvgGetBounds(flatDocHandle, &bounds, sizeof(L_SvgBounds)); 
      if (nRet != SUCCESS) 
      { 
         L_SvgFreeNode(options.SvgHandle); 
         if (!isFlat) 
            L_SvgFreeNode(flatDocHandle); 
         return nRet; 
      } 
      nRet = L_SvgSetBounds(flatDocHandle, &bounds); 
      L_SvgFreeNode(options.SvgHandle); 
      if (!isFlat) 
         L_SvgFreeNode(flatDocHandle); 
   } 
   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