![]() |
CustomXmlPrint
0.1.0.25
|
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... | |
#define CUSTOM_XMLPRINT_SEPARATOR 0x1E |
typedef enum _CustomPrintOrientation CustomPrintOrientation |
typedef enum _CustomXmlPrintResult CustomXmlPrintResult |
CUSTOMXPEXTERN CustomXmlPrintResult ClearXmlObjArray | ( | void * | xmlPrintHandle | ) |
Clear the list of tag/values created using FillXmlObjArray().
xmlPrintHandle | handle |
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
xmlPrintHandle | handle |
ticket_num | Id that identify the ticket (in a multi page document) |
tag | Xml Tag (in the form Id.Property) to identify an element |
value | Value assigned to the element identified by tag |
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.
ptr | pointer returned by a previous API |
len | len array to be freed |
CUSTOMXPEXTERN CustomXmlPrintResult FreeXmlPrintHandle | ( | void * | xmlPrintHandle | ) |
Free handle previously allocated
Handle is returned by GetXmlPrintHandle() or GetXmlPrintHandleFromDialog()
xmlPrintHandle | handle |
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
len | len of returned array (output value) |
CUSTOMXPEXTERN CustomXmlPrintResult GetLibraryApiVersion | ( | char * | info, |
int | size | ||
) |
Get the current library API version
info | Pointer to an array of char used to store library version string(outut value) |
size | Size of the array of char |
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
xmlPrintHandle | handle |
len | len of returned array (output value) |
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()
xmlPrintHandle | handle |
len | len of returned array (output value) |
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()
xmlPrintHandle | handle |
info | >Pointer to an array of char used to store error information string in case of errors(output value) |
size | Size of the array of char |
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()
xmlPrintHandle | handle |
name | Font family name |
isBoldAvailable | Pointer to int variable that can assume the vaules:0(bold not available) 1(bold available) (output value) |
isItalicAvailable | Pointer to int variable that can assume the vaules:0(italic not available) 1(italic available) (output value) |
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
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" }
xmlPrintHandle | handle |
xmlParameterFileName | File path of xml parameter file |
tag | List of tag in the parameter file (separator is 0x1E) (output value) |
tagsize | Size of the buffer pointed by tag parameter |
value | List of values in the parameter file (separator is 0x1E) (output value) |
valuesize | Size of the buffer pointed by value parameter |
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".
xmlPrintHandle | handle |
tag | Xml Tag (in the form Id.Property) to identify an element |
value | Value of the element identified by tag (output value) |
valuesize | Size of the buffer pointed by value parameter |
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.
printerName | Printer name |
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.
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
xmlPrintHandle | handle |
filename | File path of the image to be printed |
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()
xmlPrintHandle | handle |
automaticPageSize | Use custom page size. If different from 0, use printer page width and height taken from xml prject file |
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)
xmlPrintHandle | handle |
automaticPageSize | Use custom page size. Printer page width and height taken from xml prject file (default value is true) |
CUSTOMXPEXTERN CustomXmlPrintResult SetCustomResolutionRounding | ( | int | enable | ) |
Not documented, internal use only
CUSTOMXPEXTERN CustomXmlPrintResult SetEmbeddedFontKeepFlag | ( | int | enable | ) |
Keep project embedded fonts for future reuse when library handler is released
enable | Enable/Disable feature |
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
xmlPrintHandle | handle |
left | Left margin |
top | Top margin |
right | Right margin |
bottom | Bottom margin |
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
xmlPrintHandle | handle |
left | Left margin |
top | Top margin |
right | Right margin |
bottom | Bottom margin |
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()
xmlPrintHandle | handle |
copies | Number of copies |
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
xmlPrintHandle | handle |
orientation | Type of orientation(Portrait or Landscape) |
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()
xmlPrintHandle | handle |
width | Page width |
height | Page height |
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()
xmlPrintHandle | handle |
width | Page width |
height | Page height |
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()
xmlPrintHandle | handle |
name | Page name (as returned by GetPageSizeNames) |
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()
xmlPrintHandle | handle |
filename | File path of the xml project file |
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()
xmlPrintHandle | handle |
filename | File path of the xml project file |
imagesDir | Absoulute path of the directory containing images |
fontsDir | Absoulute path of the directory containing fonts |
CUSTOMXPEXTERN CustomXmlPrintResult SetXmlObjectLink | ( | void * | xmlPrintHandle, |
char * | tag, | ||
char * | value | ||
) |
Set the value of the element specified by "link" tag. Undocumented: internal use only
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");
xmlPrintHandle | handle |
xmlParameterFileName | File path of xml parameter file |
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".
xmlPrintHandle | handle |
tag | Xml Tag (in the form Id.Property) to identify an element |
value | Value assigned to the element identified by tag |
CUSTOMXPEXTERN CustomXmlPrintResult SetXmlTag | ( | void * | xmlPrintHandle, |
char * | tag, | ||
char * | value | ||
) |
Superseded Function ( replaced by SetXmlObjectTag)