![]() |
CPTiOSApi
1.25
|
Factory class to open a Custom Xml Layout project and print it More...
Instance Methods | |
(NSString *) | - GetAPIVersion |
Returns current library API version More... | |
(int) | - SetXmlFilePath:error: |
Set the name of the xml project file and create the xml project parser. 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. More... | |
(int) | - SetXmlZipFilePath:::error: |
Set the path of the zipped xml project (to be done as FIRST STEP), unzip the project inside the destination folder in Document and create the xml project parser. This function call is alternative to SetXmlFilePath() as it creates the xml project parser. More... | |
(int) | - SetXmlObjectTag::error: |
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... | |
(NSString *) | - GetXmlObjectTag:error: |
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... | |
(int) | - SetXmlObjectFromParamFile:error: |
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... | |
(NSArray *) | - GetXmlTagValListFromParamFile:error: |
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... | |
(UIImage *) | - PreviewXml: |
Get a preview image Notes: This function is used to perform the rendering of the xml project and to return a preview image. Prerequiste is loding the project (using SetXmlFilePath() or SetXmlZipFilePath()) More... | |
(NSString *) | - GetXmlParsingErrors: |
Parse Xml project file performing a syntax/correctness check Notes: After a call to SetXmlFilePath() or SetXmlZipFilePath(), 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... | |
(int) | - SetXmlLinkFeatureEnable: |
Enable link feature (internal use only, this may slow down xml parsing and printing) More... | |
(int) | - SetXmlTag::error: |
Superseded Function ( replaced by SetXmlObjectTag) More... | |
(int) | - SetXmlObjectLink::error: |
Set the value of the element specified by "link" tag (internal use only) More... | |
(NSString *) | - GetXmlObjectLink:error: |
Get the value of the element specified by "link" tag (internal use only) More... | |
(int) | - PrintXml:error: |
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 SetXmlFilePath() or SetXmlZipFilePath()) and selecting the printer (using CustomiOSApi library) More... | |
(int) | - PrintXml::::error: |
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 SetXmlFilePath() or SetXmlZipFilePath()) and selecting the printer (using CustomiOSApi library) More... | |
(int) | - GetFontProperty::::error: |
Get bold and italic properties for the font identified by fontname. More... | |
Factory class to open a Custom Xml Layout project and print it
- (NSString *) GetAPIVersion |
Returns current library API version
- (int) GetFontProperty: | (NSString *) | fontname | |
: | (BOOL *) | isBoldAvailable | |
: | (BOOL *) | isItalicAvailable | |
: | (BOOL *) | isBoldItalicAvailable | |
error: | (NSError **) | error | |
Get bold and italic properties for the font identified by fontname.
fontname | Font family name |
isBoldAvailable | Pointer to a bool variable to indicate if bold is available: false[bold not available] true[bold available] (output value) |
isItalicAvailable | Pointer to a bool variable to indicate if italic is available: false[italic not available] true[italic available] (output value) |
isBoldItalicAvailable | Pointer to a bool variable to indicate if bold-italic is available: false[bold-italic not available] true[bold-italic available] (output value) |
error | Error pointer |
- (NSString *) GetXmlObjectLink: | (NSString *) | tag | |
error: | (NSError **) | error | |
Get the value of the element specified by "link" tag (internal use only)
tag | Xml Tag (in the form ID.LINK) to identify an element |
error | Error pointer |
- (NSString *) GetXmlObjectTag: | (NSString *) | tag | |
error: | (NSError **) | error | |
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.
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: [api GetXmlObjectTag:"TextBox0.text" error:&error]; \n
it will return "original string".
tag | Xml Tag (in the form Id.Property) to identify an element |
error | Error pointer |
- (NSString *) GetXmlParsingErrors: | (NSError **) | error |
Parse Xml project file performing a syntax/correctness check
Notes:
After a call to SetXmlFilePath() or SetXmlZipFilePath(), 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.
error | Error pointer |
- (NSArray *) GetXmlTagValListFromParamFile: | (NSString *) | xmlParameterFileName | |
error: | (NSError **) | error | |
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.
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 a list of CustomXmlDictionaryItem objects like this:
{ Tag:"TextBox1.text", Value:"new string 1" }
{ Tag:"TextBox2.text", Value:"new string 2" }
xmlParameterFileName | Absolute file path of xml parameter file or value: nil |
error | Error pointer |
- (UIImage *) PreviewXml: | (NSError **) | error |
Get a preview image
Notes:
This function is used to perform the rendering of the xml project and to return a preview image.
Prerequiste is loding the project (using SetXmlFilePath() or SetXmlZipFilePath())
error | Error pointer |
- (int) PrintXml: | (CustomPrinter *) | prnDevice | |
: | (NSInteger) | leftAlign | |
: | (enum ImageScale) | widthOption | |
: | (NSInteger) | imgWidth | |
error: | (NSError **) | error | |
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 SetXmlFilePath() or SetXmlZipFilePath()) and selecting the printer (using CustomiOSApi library)
prnDevice | Printing device, as returned by CustomiOSApi library |
leftAlign | Left alignment behavior, see PrintImage in CustomiOSApi library documentation |
widthOption | Scaling options, see PrintImage in CustomAndroidAPI library documentation |
imgWidth | Printed image width in pixel/dots in case of "Scale to Width" option selected, see PrintImage in CustomiOSApi library documentation |
error | Error pointer |
- (int) PrintXml: | (CustomPrinter *) | prnDevice | |
error: | (NSError **) | error | |
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 SetXmlFilePath() or SetXmlZipFilePath()) and selecting the printer (using CustomiOSApi library)
prnDevice | Printing device, as returned by CustomiOSApi library |
error | Error pointer |
- (int) SetXmlFilePath: | (NSString *) | filepath | |
error: | (NSError **) | error | |
Set the name of the xml project file and create the xml project parser.
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.
filepath | Absoulute file path of the xml project file |
error | Error pointer |
- (int) SetXmlLinkFeatureEnable: | (NSError **) | error |
Enable link feature (internal use only, this may slow down xml parsing and printing)
error | Error pointer |
- (int) SetXmlObjectFromParamFile: | (NSString *) | xmlParameterFileName | |
error: | (NSError **) | error | |
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.
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:
[api SetXmlObjectTag:"TextBox1.text" :@"new string 1" error:&error]; \n
[api SetXmlObjectTag:@"TextBox2.text" :@"new string 2" error:&error];
xmlParameterFileName | Absolute file path of xml parameter file or value: nil |
error | Error pointer |
- (int) SetXmlObjectLink: | (NSString *) | tag | |
: | (NSString *) | value | |
error: | (NSError **) | error | |
Set the value of the element specified by "link" tag (internal use only)
tag | Xml Tag (in the form ID.LINK) to identify an element |
value | Value assigned to the element identified by tag |
error | Error pointer |
- (int) SetXmlObjectTag: | (NSString *) | tag | |
: | (NSString *) | value | |
error: | (NSError **) | error | |
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.
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: [api SetXmlObjectTag:"TextBox0.text" :@"new string" error:&error]; \n
In the printed document, the TextBox0 field will be printed with "new string" instead of "original string".
tag | Xml Tag (in the form Id.Property) to identify an element |
value | Value assigned to the element identified by tag |
error | Error pointer |
- (int) SetXmlTag: | (NSString *) | tag | |
: | (NSString*) | value | |
error: | (NSError **) | error | |
Superseded Function ( replaced by SetXmlObjectTag)
- (int) SetXmlZipFilePath: | (NSString *) | zipfilepath | |
: | (NSString *) | destinationDocumentFolder | |
: | (BOOL) | deleteOnDealloc | |
error: | (NSError **) | error | |
Set the path of the zipped xml project (to be done as FIRST STEP), unzip the project inside the destination folder in Document and create the xml project parser.
This function call is alternative to SetXmlFilePath() as it creates the xml project parser.
zipfilepath | Absolute file path of the zipped xml project |
destinationDocumentFolder | Name of the folder (inside Document) to be used to unzip the project |
deleteOnDealloc | Delete destination folder when deallocating the object |
error | Error pointer |