CustomXmlPrint  0.1.0.25
CustomXmlPrint.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2013 by Marco Gaibazzi,,, *
3  * marco@marco-desktop *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 #ifndef _CUSTOMXMLPRINT__H_
21 #define _CUSTOMXMLPRINT__H_
22 
25 #define CXP_SUCCESS 0
26 #define CXP_FAILURE -1
27 
28 
29 
30 #define CUSTOMXPLIB_WINAPI
31 
32 #if defined(WINDOWS) || defined(WIN32)
33  /* If building or using lib as a DLL, define CUSTOMLIB_DLL.
34  * This is not mandatory, but it offers a little performance increase.
35  */
36 # ifdef CUSTOMXPLIB_DLL
37 # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
38 # ifdef CUSTOMXPLIB_INTERNAL
39 # define CUSTOMXPEXTERN extern __declspec(dllexport)
40 # else
41 # define CUSTOMXPEXTERN extern __declspec(dllimport)
42 # endif
43 # endif
44 # endif /* CUSTOMLIB_DLL */
45  /* If building or using zlib with the WINAPI/WINAPIV calling convention,
46  * define CUSTOMLIB_WINAPI.
47  * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
48  */
49 #ifdef CUSTOMXPLIB_WINAPI
50 # include <windows.h>
51  /* No need for _export, use .DEF instead. */
52  /* For complete Windows compatibility, use WINAPI, not __stdcall. */
53 # define CUSTOMXPEXPORT WINAPI
54 #endif
55 
56 #endif /* WINDOWS || WIN32 */
57 
58 #ifndef CUSTOMXPEXTERN
59 # define CUSTOMXPEXTERN extern
60 #endif
61 
65 {
66 
99 };
101 
103 {
112 };
114 
115 
116 #ifdef __cplusplus
117 extern "C" {
118 #endif
119 
120 
121 #define CUSTOM_XMLPRINT_SEPARATOR 0x1E
122 
123 
124 
133 CUSTOMXPEXTERN void * GetXmlPrintHandle(char * printerName);
134 
142 CUSTOMXPEXTERN void * GetXmlPrintHandleFromDialog(void);
143 
157 CUSTOMXPEXTERN CustomXmlPrintResult SetMargins(void * xmlPrintHandle, int left, int top, int right, int bottom);
158 
172 CUSTOMXPEXTERN CustomXmlPrintResult SetMarginsMM(void * xmlPrintHandle, int left, int top, int right, int bottom);
173 
184 CUSTOMXPEXTERN CustomXmlPrintResult SetOrientation(void * xmlPrintHandle, CustomPrintOrientation orientation);
185 
198 CUSTOMXPEXTERN CustomXmlPrintResult SetPageSize(void * xmlPrintHandle, int width, int height);
199 
212 CUSTOMXPEXTERN CustomXmlPrintResult SetPageSizeMM(void * xmlPrintHandle, int width, int height);
213 
225 CUSTOMXPEXTERN CustomXmlPrintResult SetPageSizeName(void * xmlPrintHandle, char * name);
226 
237 CUSTOMXPEXTERN CustomXmlPrintResult SetNumCopies(void * xmlPrintHandle, int copies);
238 
250 CUSTOMXPEXTERN CustomXmlPrintResult PrintImage(void * xmlPrintHandle, char * filename);
251 
252 
264 CUSTOMXPEXTERN char ** GetAvailablePrinters(int * len);
265 
266 
280 CUSTOMXPEXTERN char ** GetXmlAvailableFontList(void * xmlPrintHandle, int * len);
281 
294 CUSTOMXPEXTERN char ** GetPageSizeNames(void * xmlPrintHandle, int * len);
295 
304 CUSTOMXPEXTERN CustomXmlPrintResult FreeInfoPtrMemory(char ** ptr, int len);
305 
321 CUSTOMXPEXTERN CustomXmlPrintResult SetXmlFileName(void * xmlPrintHandle, char * filename);
322 
338 CUSTOMXPEXTERN CustomXmlPrintResult SetXmlFileNameAndDirs(void * xmlPrintHandle, char * filename, char * imagesDir, char * fontsDir);
339 
343 CUSTOMXPEXTERN CustomXmlPrintResult SetXmlTag(void * xmlPrintHandle, char * tag, char * value);
344 
372 CUSTOMXPEXTERN CustomXmlPrintResult SetXmlObjectTag(void * xmlPrintHandle, char * tag, char * value);
373 
403 CUSTOMXPEXTERN CustomXmlPrintResult GetXmlObjectTag(void * xmlPrintHandle, char * tag, char * value, int valuesize);
404 
409 CUSTOMXPEXTERN CustomXmlPrintResult SetXmlObjectLink(void * xmlPrintHandle, char * tag, char * value);
410 
415 CUSTOMXPEXTERN CustomXmlPrintResult GetXmlObjectLink(void * xmlPrintHandle, char * tag, char * value, int valuesize);
416 
447 CUSTOMXPEXTERN CustomXmlPrintResult SetXmlObjectsFromParamFile(void * xmlPrintHandle, char * xmlParamFileName);
448 
483 CUSTOMXPEXTERN CustomXmlPrintResult GetXmlObjectsFromParamFile(void * xmlPrintHandle, char * xmlParamFileName, char * tag, int tagsize, char * value, int valuesize);
484 
498 CUSTOMXPEXTERN CustomXmlPrintResult GetXmlCheckCorrectParsing(void * xmlPrintHandle, char * info, int size);
499 
515 CUSTOMXPEXTERN CustomXmlPrintResult GetXmlFontProperty(void * xmlPrintHandle, char * name, int * isBoldAvailable, int * isItalicAvailable);
516 
517 
518 
525 CUSTOMXPEXTERN CustomXmlPrintResult FreeXmlPrintHandle(void * xmlPrintHandle);
526 
541 CUSTOMXPEXTERN CustomXmlPrintResult PrintXml(void * xmlPrintHandle, int automaticPageSize);
542 
549 CUSTOMXPEXTERN CustomXmlPrintResult GetLibraryApiVersion(char * info, int size);
550 
554 CUSTOMXPEXTERN CustomXmlPrintResult SetCustomResolutionRounding(int enable);
555 
561 CUSTOMXPEXTERN CustomXmlPrintResult SetEmbeddedFontKeepFlag(int enable);
562 
576 
577 CUSTOMXPEXTERN CustomXmlPrintResult FillXmlObjArray(void * xmlPrintHandle, int ticket_num, char * tag, char * value);
578 
579 
585 CUSTOMXPEXTERN CustomXmlPrintResult ClearXmlObjArray(void * xmlPrintHandle);
586 
604 CUSTOMXPEXTERN CustomXmlPrintResult PrintXmlObjArray(void * xmlPrintHandle, int automaticPageSize);
605 
606 
607 #ifdef __cplusplus
608 }
609 #endif
610 
611 #endif
CUSTOMXPEXTERN CustomXmlPrintResult SetNumCopies(void *xmlPrintHandle, int copies)
Set the number of copies to be printed
CUSTOMXPEXTERN CustomXmlPrintResult SetMarginsMM(void *xmlPrintHandle, int left, int top, int right, int bottom)
Set printer margins in hundred of a millimiter
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 use...
CUSTOMXPEXTERN void * GetXmlPrintHandleFromDialog(void)
Get handle for the printer identified by its name, using QT dialog box Use this function to select th...
CUSTOMXPEXTERN CustomXmlPrintResult SetEmbeddedFontKeepFlag(int enable)
Keep project embedded fonts for future reuse when library handler is released
enum _CustomXmlPrintResult CustomXmlPrintResult
Definition: CustomXmlPrint.h:100
Definition: CustomXmlPrint.h:74
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 ins...
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
Definition: CustomXmlPrint.h:111
CUSTOMXPEXTERN CustomXmlPrintResult SetCustomResolutionRounding(int enable)
Not documented, internal use only
CUSTOMXPEXTERN CustomXmlPrintResult GetLibraryApiVersion(char *info, int size)
Get the current library API version
_CustomXmlPrintResult
Definition: CustomXmlPrint.h:64
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...
CUSTOMXPEXTERN CustomXmlPrintResult SetXmlTag(void *xmlPrintHandle, char *tag, char *value)
Superseded Function ( replaced by SetXmlObjectTag)
Definition: CustomXmlPrint.h:86
Definition: CustomXmlPrint.h:98
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 ele...
Definition: CustomXmlPrint.h:78
CUSTOMXPEXTERN CustomXmlPrintResult GetXmlCheckCorrectParsing(void *xmlPrintHandle, char *info, int size)
Parse Xml project file performing a syntax/correctness check Notes: After a call to SetXmlFileName...
Definition: CustomXmlPrint.h:82
CUSTOMXPEXTERN void * GetXmlPrintHandle(char *printerName)
Get handle for the printer identified by its name Use this function to select the desired printer....
CUSTOMXPEXTERN CustomXmlPrintResult SetXmlObjectLink(void *xmlPrintHandle, char *tag, char *value)
Set the value of the element specified by "link" tag. Undocumented: internal use only
Definition: CustomXmlPrint.h:90
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...
CUSTOMXPEXTERN CustomXmlPrintResult SetPageSize(void *xmlPrintHandle, int width, int height)
Set page size in hundred of an inch
CUSTOMXPEXTERN CustomXmlPrintResult SetOrientation(void *xmlPrintHandle, CustomPrintOrientation orientation)
Set print page orientation
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 d...
CUSTOMXPEXTERN CustomXmlPrintResult PrintXmlObjArray(void *xmlPrintHandle, int automaticPageSize)
Print xml project file as a multi page document Notes: This function is used to perform the render...
CUSTOMXPEXTERN CustomXmlPrintResult FreeInfoPtrMemory(char **ptr, int len)
Free memory allocated by a previous API Notes: GetPageSizeNames() GetXmlAvailableFontList() GetAva...
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 fo...
CUSTOMXPEXTERN CustomXmlPrintResult ClearXmlObjArray(void *xmlPrintHandle)
Clear the list of tag/values created using FillXmlObjArray().
CUSTOMXPEXTERN char ** GetAvailablePrinters(int *len)
Get the list of all available printers in the system Notes: The returned pointer must be freed usi...
CUSTOMXPEXTERN CustomXmlPrintResult PrintXml(void *xmlPrintHandle, int automaticPageSize)
Print xml project file Notes: This function is used to perform the rendering of the xml project an...
enum _CustomPrintOrientation CustomPrintOrientation
Definition: CustomXmlPrint.h:113
CUSTOMXPEXTERN CustomXmlPrintResult SetPageSizeName(void *xmlPrintHandle, char *name)
Set page size by name
CUSTOMXPEXTERN CustomXmlPrintResult SetMargins(void *xmlPrintHandle, int left, int top, int right, int bottom)
Set printer margins in hundred of an inch
CUSTOMXPEXTERN CustomXmlPrintResult SetPageSizeMM(void *xmlPrintHandle, int width, int height)
Set page size in hundred of a millimiter
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,...
Definition: CustomXmlPrint.h:94
Definition: CustomXmlPrint.h:70
CUSTOMXPEXTERN char ** GetPageSizeNames(void *xmlPrintHandle, int *len)
Get the list of page formats available for the printer Notes: The returned pointer must be freed u...
CUSTOMXPEXTERN CustomXmlPrintResult FreeXmlPrintHandle(void *xmlPrintHandle)
Free handle previously allocated Handle is returned by GetXmlPrintHandle() or GetXmlPrintHandleFromD...
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 elem...
_CustomPrintOrientation
Definition: CustomXmlPrint.h:102
Definition: CustomXmlPrint.h:107
CUSTOMXPEXTERN CustomXmlPrintResult PrintImage(void *xmlPrintHandle, char *filename)
Print image from file