CustomXmlPrint  0.1.0.25
CustomXmlPrint.h File Reference

Go to the source code of this file.

Macros

#define CUSTOM_XMLPRINT_SEPARATOR   0x1E
 

Typedefs

typedef enum _CustomXmlPrintResult CustomXmlPrintResult
 
typedef enum _CustomPrintOrientation CustomPrintOrientation
 

Enumerations

enum  _CustomXmlPrintResult {
  CUSTOM_XMLPRINT_SUCCESS = 0, CUSTOM_XMLPRINT_GENERIC_FAILURE = 1, CUSTOM_XMLPRINT_INVALID_ARGUMENT = 2, CUSTOM_XMLPRINT_NOT_VALID_PRINTER = 3,
  CUSTOM_XMLPRINT_INTERNAL_LIBRARY_ERROR = 4, CUSTOM_XMLPRINT_LIBRARY_ERROR = 5, CUSTOM_XMLPRINT_NOT_CONNECTED_ERROR = 6, CUSTOM_XMLPRINT_SECURITY_ERROR = 7
}
 
enum  _CustomPrintOrientation { CUSTOM_ORIENTATION_PORTRAIT = 0, CUSTOM_ORIENTATION_LANDSCAPE = 1 }
 

Functions

CUSTOMXPEXTERN void * GetXmlPrintHandle (char *printerName)
 Get handle for the printer identified by its name
Use this function to select the desired printer. It is necessary to call this function before performing the actual print operation with PrintXml()
Notes:
It is necessary to install the proper custom cups printer driver, in order to print using CPT library. More...
 
CUSTOMXPEXTERN void * GetXmlPrintHandleFromDialog (void)
 Get handle for the printer identified by its name, using QT dialog box
Use this function to select the desired printer using a QT system dialog Box. It is necessary to call this function before performing the actual print operation with PrintXml()
Notes:
It is necessary to install the proper custom cups printer driver, in order to print using CPT library. More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetMargins (void *xmlPrintHandle, int left, int top, int right, int bottom)
 Set printer margins in hundred of an inch More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetMarginsMM (void *xmlPrintHandle, int left, int top, int right, int bottom)
 Set printer margins in hundred of a millimiter More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetOrientation (void *xmlPrintHandle, CustomPrintOrientation orientation)
 Set print page orientation More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetPageSize (void *xmlPrintHandle, int width, int height)
 Set page size in hundred of an inch More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetPageSizeMM (void *xmlPrintHandle, int width, int height)
 Set page size in hundred of a millimiter More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetPageSizeName (void *xmlPrintHandle, char *name)
 Set page size by name More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetNumCopies (void *xmlPrintHandle, int copies)
 Set the number of copies to be printed More...
 
CUSTOMXPEXTERN CustomXmlPrintResult PrintImage (void *xmlPrintHandle, char *filename)
 Print image from file More...
 
CUSTOMXPEXTERN char ** GetAvailablePrinters (int *len)
 Get the list of all available printers in the system
Notes:
The returned pointer must be freed using FreeInfoPtrMemory More...
 
CUSTOMXPEXTERN char ** GetXmlAvailableFontList (void *xmlPrintHandle, int *len)
 Get the list of the fonts available in the system, together with the fonts included in the opened xml project
Notes:
A "fonts" directory is included in the project generated by CPT Editor: this directory contains all the local fonts saved inside the projects.
This function call returns the list of system fonts and add also all the local fonts inside the "fonts" project directory.
The returned pointer must be freed using FreeInfoPtrMemory. More...
 
CUSTOMXPEXTERN char ** GetPageSizeNames (void *xmlPrintHandle, int *len)
 Get the list of page formats available for the printer
Notes:
The returned pointer must be freed using FreeInfoPtrMemory More...
 
CUSTOMXPEXTERN CustomXmlPrintResult FreeInfoPtrMemory (char **ptr, int len)
 Free memory allocated by a previous API
Notes:
GetPageSizeNames() GetXmlAvailableFontList() GetAvailablePrinters() return a pointer that must be freed with this function call. More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetXmlFileName (void *xmlPrintHandle, char *filename)
 Set the name of the xml project file
To be done as the first step, in order to load the project inside the library.
Notes:
This is the name of the project file created with CustomPowerTool (CPT) Editor (it has .xml extension)
In fact, you must initialize CPT library with the project file that you want to print.
More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetXmlFileNameAndDirs (void *xmlPrintHandle, char *filename, char *imagesDir, char *fontsDir)
 Set the name of the xml project file, "images" and "fonts" directories
To be done as the first step, in order to load the project inside the library.
Notes:
This function should be used instead of SetXmlFileName() if "images" and "fonts" directories are in a different location with respect to xml project file.
xml project file, "images" and "fonts" directories are generated by CPT Editor. More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetXmlTag (void *xmlPrintHandle, char *tag, char *value)
 Superseded Function ( replaced by SetXmlObjectTag) More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetXmlObjectTag (void *xmlPrintHandle, char *tag, char *value)
 Set the value of the element specified by tag (format Id.Property)
In the xml file identify an element with the specified tag and overwrite the value with the supplied one.
Notes:
The xml project file contains the description of the layout to print in the form of xml nodes.
Each node is identified by an Id, and has many properties.
You can change the value of a property, and the document will be printed with this new value.
More...
 
CUSTOMXPEXTERN CustomXmlPrintResult GetXmlObjectTag (void *xmlPrintHandle, char *tag, char *value, int valuesize)
 Get the value of the element specified by tag (format Id.Property).
In the xml file identify an element with the specified tag and return its value.
Notes:
This is the Get function, while SetXmlObjectTag() is the equivalent Set function. The xml project file contains the description of the layout to print in the form of xml nodes.
Each node is identified by an Id, and has many properties.
You can retrieve (get) the value of a property.
More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetXmlObjectLink (void *xmlPrintHandle, char *tag, char *value)
 Set the value of the element specified by "link" tag. Undocumented: internal use only More...
 
CUSTOMXPEXTERN CustomXmlPrintResult GetXmlObjectLink (void *xmlPrintHandle, char *tag, char *value, int valuesize)
 Get the value of the element specified by "link" tag. Undocumented: internal use only More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetXmlObjectsFromParamFile (void *xmlPrintHandle, char *xmlParamFileName)
 Create a list of tag/value using the supplied xml parameter file and apply it to the xml project file (see SetXmlObjectTag() for tag/value meaning).
The parameter file must be in the format produced by CPT Editor
Notes:
The xml parameter file is generated by CPT Editor, and has extension ".param.xml".
The xml parameter file contains the description of the "variable" part of the layout to print, in the form of xml nodes.
This file can be interpreted as a subset of the xml project file, containing only the "variable" properties.
Each node is identified by an Id and can have one or more properties.
It can be modifed manually by the user. More...
 
CUSTOMXPEXTERN CustomXmlPrintResult GetXmlObjectsFromParamFile (void *xmlPrintHandle, char *xmlParamFileName, char *tag, int tagsize, char *value, int valuesize)
 Get the list of tag/value from the supplied xml parameter file.
The parameter file must be in the format produced by CPT Editor
Notes:
The xml parameter file is generated by CPT Editor, and has extension ".param.xml".
For a description of the xml parameter file see SetXmlObjectFromParamFile() This function parses the xml parameter file and generates a list of objects, with tag and value. More...
 
CUSTOMXPEXTERN CustomXmlPrintResult GetXmlCheckCorrectParsing (void *xmlPrintHandle, char *info, int size)
 Parse Xml project file performing a syntax/correctness check
Notes:
After a call to SetXmlFileName() or SetXmlFileNameAndDirs(), the project is loaded inside the library.
With this function call it is possible to verify if the syntax of the project is correct: in case of syntax error, a message is returned. More...
 
CUSTOMXPEXTERN CustomXmlPrintResult GetXmlFontProperty (void *xmlPrintHandle, char *name, int *isBoldAvailable, int *isItalicAvailable)
 Get bold and italic properties for the font identified by fontname
Notes:
This function can be used to retrieve information about a font present in the system or included in the loaded project.
With GetAvailableSystemFontList() it is possible to retrieve all the fonts available.
With this fuction call it is possible to retrieve bold and italic information for all the avalable fonts.
More...
 
CUSTOMXPEXTERN CustomXmlPrintResult FreeXmlPrintHandle (void *xmlPrintHandle)
 Free handle previously allocated
Handle is returned by GetXmlPrintHandle() or GetXmlPrintHandleFromDialog() More...
 
CUSTOMXPEXTERN CustomXmlPrintResult PrintXml (void *xmlPrintHandle, int automaticPageSize)
 Print xml project file
Notes:
This function is used to perform the rendering of the xml project and to send it to the printer.
Prerequistes are loding the project (using SetXmlFileNameAndDirs() or SetXmlFileName()) and selecting the printer (using SetPrinterName()) More...
 
CUSTOMXPEXTERN CustomXmlPrintResult GetLibraryApiVersion (char *info, int size)
 Get the current library API version More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetCustomResolutionRounding (int enable)
 Not documented, internal use only More...
 
CUSTOMXPEXTERN CustomXmlPrintResult SetEmbeddedFontKeepFlag (int enable)
 Keep project embedded fonts for future reuse when library handler is released More...
 
CUSTOMXPEXTERN CustomXmlPrintResult FillXmlObjArray (void *xmlPrintHandle, int ticket_num, char *tag, char *value)
 Set the value of the element specified by tag (format Id.Property)
See SetXmlObjectTag() for more details.

Notes:
This function is very similar to SetXmlObjectTag() and should be used together with PrintXmlObjArray().
It gives the possibility to identify more than one ticket in a single print job, using the parameter ticket_num.
You can change the value of a property, and the ticket will be printed with this new value, but this change will affect only the ticket identified by ticket_num
More...
 
CUSTOMXPEXTERN CustomXmlPrintResult ClearXmlObjArray (void *xmlPrintHandle)
 Clear the list of tag/values created using FillXmlObjArray(). More...
 
CUSTOMXPEXTERN CustomXmlPrintResult PrintXmlObjArray (void *xmlPrintHandle, int automaticPageSize)
 Print xml project file as a multi page document
Notes:
This function is used to perform the rendering of the xml project and to send it to the printer.
Prerequistes are loding the project (using SetXmlFileNameAndDirs() or SetXmlFileName()) and selecting the printer (using SetPrinterName()).
This function call is available only for Windows and Linux.
This function is similar to PrintXml() but gives the possibility to print many pages/tickets in a single document, that is in a single print job.
The number of pages that will be printed depends on the number of tickets specified using multiple calls to FillXmlObjArray().
More...
 

Macro Definition Documentation

◆ CUSTOM_XMLPRINT_SEPARATOR

#define CUSTOM_XMLPRINT_SEPARATOR   0x1E

Typedef Documentation

◆ CustomPrintOrientation

◆ CustomXmlPrintResult

Enumeration Type Documentation

◆ _CustomPrintOrientation

Enumerator
CUSTOM_ORIENTATION_PORTRAIT 

Portrait

CUSTOM_ORIENTATION_LANDSCAPE 

Landscape

◆ _CustomXmlPrintResult

Enumerator
CUSTOM_XMLPRINT_SUCCESS 

Success

CUSTOM_XMLPRINT_GENERIC_FAILURE 

Generic failure

CUSTOM_XMLPRINT_INVALID_ARGUMENT 

Invalid argument

CUSTOM_XMLPRINT_NOT_VALID_PRINTER 

Printer name is not valid

CUSTOM_XMLPRINT_INTERNAL_LIBRARY_ERROR 

Internal engine library error

CUSTOM_XMLPRINT_LIBRARY_ERROR 

Library error

CUSTOM_XMLPRINT_NOT_CONNECTED_ERROR 

not connected error

CUSTOM_XMLPRINT_SECURITY_ERROR 

security error

Function Documentation

◆ ClearXmlObjArray()

CUSTOMXPEXTERN CustomXmlPrintResult ClearXmlObjArray ( void *  xmlPrintHandle)

Clear the list of tag/values created using FillXmlObjArray().

Parameters
xmlPrintHandlehandle
Returns
Operation result (success or error type)

◆ FillXmlObjArray()

CUSTOMXPEXTERN CustomXmlPrintResult FillXmlObjArray ( void *  xmlPrintHandle,
int  ticket_num,
char *  tag,
char *  value 
)

Set the value of the element specified by tag (format Id.Property)
See SetXmlObjectTag() for more details.

Notes:
This function is very similar to SetXmlObjectTag() and should be used together with PrintXmlObjArray().
It gives the possibility to identify more than one ticket in a single print job, using the parameter ticket_num.
You can change the value of a property, and the ticket will be printed with this new value, but this change will affect only the ticket identified by ticket_num

Parameters
xmlPrintHandlehandle
ticket_numId that identify the ticket (in a multi page document)
tagXml Tag (in the form Id.Property) to identify an element
valueValue assigned to the element identified by tag
Returns
Operation result (success or error type)

◆ FreeInfoPtrMemory()

CUSTOMXPEXTERN CustomXmlPrintResult FreeInfoPtrMemory ( char **  ptr,
int  len 
)

Free memory allocated by a previous API
Notes:
GetPageSizeNames() GetXmlAvailableFontList() GetAvailablePrinters() return a pointer that must be freed with this function call.

Parameters
ptrpointer returned by a previous API
lenlen array to be freed
Returns
Pointer to an array of string that must be freed

◆ FreeXmlPrintHandle()

CUSTOMXPEXTERN CustomXmlPrintResult FreeXmlPrintHandle ( void *  xmlPrintHandle)

Free handle previously allocated
Handle is returned by GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()

Parameters
xmlPrintHandlehandle
Returns
Operation result (success or error type)

◆ GetAvailablePrinters()

CUSTOMXPEXTERN char** GetAvailablePrinters ( int *  len)

Get the list of all available printers in the system
Notes:
The returned pointer must be freed using FreeInfoPtrMemory

Use this fucntion to get a list of all availabale printers in the system
Remeber to install custom printer driver, in order to use custom printer with CPT

Parameters
lenlen of returned array (output value)
Returns
Pointer to an array of string containing the names of available printers in the system

◆ GetLibraryApiVersion()

CUSTOMXPEXTERN CustomXmlPrintResult GetLibraryApiVersion ( char *  info,
int  size 
)

Get the current library API version

Parameters
infoPointer to an array of char used to store library version string(outut value)
sizeSize of the array of char
Returns
Operation result (success or error type)

◆ GetPageSizeNames()

CUSTOMXPEXTERN char** GetPageSizeNames ( void *  xmlPrintHandle,
int *  len 
)

Get the list of page formats available for the printer
Notes:
The returned pointer must be freed using FreeInfoPtrMemory

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()
Use this function to get the list of all standard pages supported by selected printer

Parameters
xmlPrintHandlehandle
lenlen of returned array (output value)
Returns
Pointer to an array of string containing the names of pages for current printer

◆ GetXmlAvailableFontList()

CUSTOMXPEXTERN char** GetXmlAvailableFontList ( void *  xmlPrintHandle,
int *  len 
)

Get the list of the fonts available in the system, together with the fonts included in the opened xml project
Notes:
A "fonts" directory is included in the project generated by CPT Editor: this directory contains all the local fonts saved inside the projects.
This function call returns the list of system fonts and add also all the local fonts inside the "fonts" project directory.
The returned pointer must be freed using FreeInfoPtrMemory.

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()

Parameters
xmlPrintHandlehandle
lenlen of returned array (output value)
Returns
Pointer to an array of string containing the names of available fonts in the system

◆ GetXmlCheckCorrectParsing()

CUSTOMXPEXTERN CustomXmlPrintResult GetXmlCheckCorrectParsing ( void *  xmlPrintHandle,
char *  info,
int  size 
)

Parse Xml project file performing a syntax/correctness check
Notes:
After a call to SetXmlFileName() or SetXmlFileNameAndDirs(), the project is loaded inside the library.
With this function call it is possible to verify if the syntax of the project is correct: in case of syntax error, a message is returned.

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()

Parameters
xmlPrintHandlehandle
info>Pointer to an array of char used to store error information string in case of errors(output value)
Returns
Operation result (success or error type)
Parameters
sizeSize of the array of char

◆ GetXmlFontProperty()

CUSTOMXPEXTERN CustomXmlPrintResult GetXmlFontProperty ( void *  xmlPrintHandle,
char *  name,
int *  isBoldAvailable,
int *  isItalicAvailable 
)

Get bold and italic properties for the font identified by fontname
Notes:
This function can be used to retrieve information about a font present in the system or included in the loaded project.
With GetAvailableSystemFontList() it is possible to retrieve all the fonts available.
With this fuction call it is possible to retrieve bold and italic information for all the avalable fonts.

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()

Parameters
xmlPrintHandlehandle
nameFont family name
isBoldAvailablePointer to int variable that can assume the vaules:0(bold not available) 1(bold available) (output value)
isItalicAvailablePointer to int variable that can assume the vaules:0(italic not available) 1(italic available) (output value)
Returns
Operation result (success or error type)

◆ GetXmlObjectLink()

CUSTOMXPEXTERN CustomXmlPrintResult GetXmlObjectLink ( void *  xmlPrintHandle,
char *  tag,
char *  value,
int  valuesize 
)

Get the value of the element specified by "link" tag. Undocumented: internal use only

Returns
Operation result (success or error type)

◆ GetXmlObjectsFromParamFile()

CUSTOMXPEXTERN CustomXmlPrintResult GetXmlObjectsFromParamFile ( void *  xmlPrintHandle,
char *  xmlParamFileName,
char *  tag,
int  tagsize,
char *  value,
int  valuesize 
)

Get the list of tag/value from the supplied xml parameter file.
The parameter file must be in the format produced by CPT Editor
Notes:
The xml parameter file is generated by CPT Editor, and has extension ".param.xml".
For a description of the xml parameter file see SetXmlObjectFromParamFile() This function parses the xml parameter file and generates a list of objects, with tag and value.

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog().
Example:
This is a part of a xml parameter file:
....
<CustomParam class="text" id="TextBox1">
<text>new string 1</text>
</CustomParam>

<CustomParam class="text" id="TextBox2">
<text>new string 2</text>
</CustomParam>
.....
A call to GetXmlObjectFromParamFile() will produce the following result:

tag=TextBox1.text[0x1E]TextBox2.text
value=new string 1[0x1E]new string 2
that can be represented as a list of objects like this:

{ Tag:"TextBox1.text", Value:"new string 1" }
{ Tag:"TextBox2.text", Value:"new string 2" }

Parameters
xmlPrintHandlehandle
xmlParameterFileNameFile path of xml parameter file
tagList of tag in the parameter file (separator is 0x1E) (output value)
tagsizeSize of the buffer pointed by tag parameter
valueList of values in the parameter file (separator is 0x1E) (output value)
valuesizeSize of the buffer pointed by value parameter
Returns
Operation result (success or error type)

◆ GetXmlObjectTag()

CUSTOMXPEXTERN CustomXmlPrintResult GetXmlObjectTag ( void *  xmlPrintHandle,
char *  tag,
char *  value,
int  valuesize 
)

Get the value of the element specified by tag (format Id.Property).
In the xml file identify an element with the specified tag and return its value.
Notes:
This is the Get function, while SetXmlObjectTag() is the equivalent Set function. The xml project file contains the description of the layout to print in the form of xml nodes.
Each node is identified by an Id, and has many properties.
You can retrieve (get) the value of a property.

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog().
Example:
This is a part of the xml project file describing a textbox field:
<CustomItem class="text" id="TextBox0">
....
<text>original string</text>
<fontname>Arial</fontname>
<fontsize>8</fontsize>
.....
</CustomItem>

Use: GetXmlObjectTag("TextBox0.text", str_val);
str_val will contain "original string".

Parameters
xmlPrintHandlehandle
tagXml Tag (in the form Id.Property) to identify an element
valueValue of the element identified by tag (output value)
Parameters
valuesizeSize of the buffer pointed by value parameter
Returns
Operation result (success or error type)

◆ GetXmlPrintHandle()

CUSTOMXPEXTERN void* GetXmlPrintHandle ( char *  printerName)

Get handle for the printer identified by its name
Use this function to select the desired printer. It is necessary to call this function before performing the actual print operation with PrintXml()
Notes:
It is necessary to install the proper custom cups printer driver, in order to print using CPT library.

Parameters
printerNamePrinter name
Returns
Handle for the printer

◆ GetXmlPrintHandleFromDialog()

CUSTOMXPEXTERN void* GetXmlPrintHandleFromDialog ( void  )

Get handle for the printer identified by its name, using QT dialog box
Use this function to select the desired printer using a QT system dialog Box. It is necessary to call this function before performing the actual print operation with PrintXml()
Notes:
It is necessary to install the proper custom cups printer driver, in order to print using CPT library.

Returns
Handle for the printer

◆ PrintImage()

CUSTOMXPEXTERN CustomXmlPrintResult PrintImage ( void *  xmlPrintHandle,
char *  filename 
)

Print image from file

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()
Not necessary for CPT printing
Utility fucntion to print a standard image (bmp, jpg, ..) on the selected printer

Parameters
xmlPrintHandlehandle
filenameFile path of the image to be printed
Returns
Operation result (success or error type)

◆ PrintXml()

CUSTOMXPEXTERN CustomXmlPrintResult PrintXml ( void *  xmlPrintHandle,
int  automaticPageSize 
)

Print xml project file
Notes:
This function is used to perform the rendering of the xml project and to send it to the printer.
Prerequistes are loding the project (using SetXmlFileNameAndDirs() or SetXmlFileName()) and selecting the printer (using SetPrinterName())

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog().
"automaticPageSize": set to 1 (true) in order to create a custom page size according to the width and height specified int the project. Otherwise use predefined pages, see SetPageSizeName()

Parameters
xmlPrintHandlehandle
automaticPageSizeUse custom page size. If different from 0, use printer page width and height taken from xml prject file
Returns
Operation result (success or error type)

◆ PrintXmlObjArray()

CUSTOMXPEXTERN CustomXmlPrintResult PrintXmlObjArray ( void *  xmlPrintHandle,
int  automaticPageSize 
)

Print xml project file as a multi page document
Notes:
This function is used to perform the rendering of the xml project and to send it to the printer.
Prerequistes are loding the project (using SetXmlFileNameAndDirs() or SetXmlFileName()) and selecting the printer (using SetPrinterName()).
This function call is available only for Windows and Linux.
This function is similar to PrintXml() but gives the possibility to print many pages/tickets in a single document, that is in a single print job.
The number of pages that will be printed depends on the number of tickets specified using multiple calls to FillXmlObjArray().

"automaticPageSize": set to true in in order to create a custom page size according to the width and height specified int the project. Otherwise use predefined pages, see SetPageSizeName()
"adaptMarginsToPrinter" : set to false in order to leave default printer margins (suggested choice)

Parameters
xmlPrintHandlehandle
automaticPageSizeUse custom page size. Printer page width and height taken from xml prject file (default value is true)
Returns
Operation result (success or error type)

◆ SetCustomResolutionRounding()

CUSTOMXPEXTERN CustomXmlPrintResult SetCustomResolutionRounding ( int  enable)

Not documented, internal use only

◆ SetEmbeddedFontKeepFlag()

CUSTOMXPEXTERN CustomXmlPrintResult SetEmbeddedFontKeepFlag ( int  enable)

Keep project embedded fonts for future reuse when library handler is released

Parameters
enableEnable/Disable feature
Returns
Operation result (success or error type)

◆ SetMargins()

CUSTOMXPEXTERN CustomXmlPrintResult SetMargins ( void *  xmlPrintHandle,
int  left,
int  top,
int  right,
int  bottom 
)

Set printer margins in hundred of an inch

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()
Use this function only to change the default printer margins

Parameters
xmlPrintHandlehandle
leftLeft margin
topTop margin
rightRight margin
bottomBottom margin
Returns
Operation result (success or error type)

◆ SetMarginsMM()

CUSTOMXPEXTERN CustomXmlPrintResult SetMarginsMM ( void *  xmlPrintHandle,
int  left,
int  top,
int  right,
int  bottom 
)

Set printer margins in hundred of a millimiter

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()
Use this function only to change the default printer margins

Parameters
xmlPrintHandlehandle
leftLeft margin
topTop margin
rightRight margin
bottomBottom margin
Returns
Operation result (success or error type)

◆ SetNumCopies()

CUSTOMXPEXTERN CustomXmlPrintResult SetNumCopies ( void *  xmlPrintHandle,
int  copies 
)

Set the number of copies to be printed

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()
Use this function to set the number of copies of the same document that will be printed using PrintXml()

Parameters
xmlPrintHandlehandle
copiesNumber of copies
Returns
Operation result (success or error type)

◆ SetOrientation()

CUSTOMXPEXTERN CustomXmlPrintResult SetOrientation ( void *  xmlPrintHandle,
CustomPrintOrientation  orientation 
)

Set print page orientation

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()
Use this function only to change the default printer margins

Parameters
xmlPrintHandlehandle
orientationType of orientation(Portrait or Landscape)
Returns
Operation result (success or error type)

◆ SetPageSize()

CUSTOMXPEXTERN CustomXmlPrintResult SetPageSize ( void *  xmlPrintHandle,
int  width,
int  height 
)

Set page size in hundred of an inch

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()
Use this function to select a custom page, specifying width and height of the desired page
To select a standard page use GetPageSizeNames() and SetPageSizeName()

Parameters
xmlPrintHandlehandle
widthPage width
heightPage height
Returns
Operation result (success or error type)

◆ SetPageSizeMM()

CUSTOMXPEXTERN CustomXmlPrintResult SetPageSizeMM ( void *  xmlPrintHandle,
int  width,
int  height 
)

Set page size in hundred of a millimiter

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()
Use this function to select a custom page, specifying width and height of the desired page
To select a standard page use GetPageSizeNames() and SetPageSizeName()

Parameters
xmlPrintHandlehandle
widthPage width
heightPage height
Returns
Operation result (success or error type)

◆ SetPageSizeName()

CUSTOMXPEXTERN CustomXmlPrintResult SetPageSizeName ( void *  xmlPrintHandle,
char *  name 
)

Set page size by name

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()
Use this function to select a standard page, specifying the name of the desired page
To get the list of all pages supported by selected printer use GetPageSizeNames()

Parameters
xmlPrintHandlehandle
namePage name (as returned by GetPageSizeNames)
Returns
Operation result (success or error type)

◆ SetXmlFileName()

CUSTOMXPEXTERN CustomXmlPrintResult SetXmlFileName ( void *  xmlPrintHandle,
char *  filename 
)

Set the name of the xml project file
To be done as the first step, in order to load the project inside the library.
Notes:
This is the name of the project file created with CustomPowerTool (CPT) Editor (it has .xml extension)
In fact, you must initialize CPT library with the project file that you want to print.

In the same location it is necessary to find "images" and "fonts" directories, as created by CPT Editor.
If "images" and "fonts" directories are in a different location, use SetXmlFileNameAndDirs() function.

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()

Parameters
xmlPrintHandlehandle
filenameFile path of the xml project file
Returns
Operation result (success or error type)

◆ SetXmlFileNameAndDirs()

CUSTOMXPEXTERN CustomXmlPrintResult SetXmlFileNameAndDirs ( void *  xmlPrintHandle,
char *  filename,
char *  imagesDir,
char *  fontsDir 
)

Set the name of the xml project file, "images" and "fonts" directories
To be done as the first step, in order to load the project inside the library.
Notes:
This function should be used instead of SetXmlFileName() if "images" and "fonts" directories are in a different location with respect to xml project file.
xml project file, "images" and "fonts" directories are generated by CPT Editor.

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()

Parameters
xmlPrintHandlehandle
filenameFile path of the xml project file
imagesDirAbsoulute path of the directory containing images
fontsDirAbsoulute path of the directory containing fonts
Returns
Operation result (success or error type)

◆ SetXmlObjectLink()

CUSTOMXPEXTERN CustomXmlPrintResult SetXmlObjectLink ( void *  xmlPrintHandle,
char *  tag,
char *  value 
)

Set the value of the element specified by "link" tag. Undocumented: internal use only

Returns
Operation result (success or error type)

◆ SetXmlObjectsFromParamFile()

CUSTOMXPEXTERN CustomXmlPrintResult SetXmlObjectsFromParamFile ( void *  xmlPrintHandle,
char *  xmlParamFileName 
)

Create a list of tag/value using the supplied xml parameter file and apply it to the xml project file (see SetXmlObjectTag() for tag/value meaning).
The parameter file must be in the format produced by CPT Editor
Notes:
The xml parameter file is generated by CPT Editor, and has extension ".param.xml".
The xml parameter file contains the description of the "variable" part of the layout to print, in the form of xml nodes.
This file can be interpreted as a subset of the xml project file, containing only the "variable" properties.
Each node is identified by an Id and can have one or more properties.
It can be modifed manually by the user.

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog().
Example:
This is a part of a xml parameter file:
....
<CustomParam class="text" id="TextBox1">
<text>new string 1</text>
</CustomParam>

<CustomParam class="text" id="TextBox2">
<text>new string 2</text>
</CustomParam>
.....
A call to SetXmlObjectFromParamFile() produces the same result of multiple calls to SetXmlObjectTag()
In this example, it is equivalent to:
SetXmlObjectTag("TextBox1.text", "new string 1");
SetXmlObjectTag("TextBox2.text", "new string 2");

Parameters
xmlPrintHandlehandle
xmlParameterFileNameFile path of xml parameter file
Returns
Operation result (success or error type)

◆ SetXmlObjectTag()

CUSTOMXPEXTERN CustomXmlPrintResult SetXmlObjectTag ( void *  xmlPrintHandle,
char *  tag,
char *  value 
)

Set the value of the element specified by tag (format Id.Property)
In the xml file identify an element with the specified tag and overwrite the value with the supplied one.
Notes:
The xml project file contains the description of the layout to print in the form of xml nodes.
Each node is identified by an Id, and has many properties.
You can change the value of a property, and the document will be printed with this new value.

Prerequisite: select printer using GetXmlPrintHandle() or GetXmlPrintHandleFromDialog().
Example:
This is a part of the xml project file describing a textbox field:
<CustomItem class="text" id="TextBox0">
....
<text>original string</text>
<fontname>Arial</fontname>
<fontsize>8</fontsize>
.....
</CustomItem>

Use: SetXmlObjectTag("TextBox0.text", "new string");
In the printed document, the TextBox0 field will be printed with "new string" instead of "original string".

Parameters
xmlPrintHandlehandle
tagXml Tag (in the form Id.Property) to identify an element
valueValue assigned to the element identified by tag
Returns
Operation result (success or error type)

◆ SetXmlTag()

CUSTOMXPEXTERN CustomXmlPrintResult SetXmlTag ( void *  xmlPrintHandle,
char *  tag,
char *  value 
)

Superseded Function ( replaced by SetXmlObjectTag)