Label Functions |
ddoc Print and Preview Mailing Label API ddoc contains a very easy to use mailing label generator. It frees the programmer from having to worry about the specifics of printing mailing labels. ddoc reads a template for the mailing labels (description of rows and columns that make up a label) from an .ini file. The programmer needs to indicate which template to use (e.g. Avery5260) and the engine handles the details. After telling ddoc which template to use, the programmer simply makes calls to print lines on a label (Using dpLabelText). After finishing printing on the first label, s/he just calls dpNextLabel to go to the next label. The engine keeps track of where each line needs to be printed and even creates the next page for the programmer. Ddoc only comes with a couple of predefined labels in ddocml.ini, but you are free to edit this file and define as many mailing labels as you wish. If you would like to share your label definitions with others, please email them to me as I will be adding them to the default ddocml.ini file and posting it on my web-site. Thanks for your help in this area as I just don't have time to sit down and define all of the mailing labels that Avery makes!
dpLabelLines
This function returns the number of lines that fit on a single label in the currently selected label template.
dpLabelsPerPage
This function returns the number of labels that fit on a page for
the currently selected label template.
dpLabelText
This function prints a line of text on the current label. The mailing label
engine knows exactly where to put the text on the label.
dpLabelX
This function fills the sngX variable with the X coordinate of the upper-left hand
corner of the current label. This function can be used if you want to print on a label
(a logo for instance) without using the dpLabelText function.
dpLabelY
This function fills the sngY variable with the Y coordinate of the upper-left hand
corner of the current label.
dpMailInit
This function tells the ddoc engine which label template you wish to use.
You need to tell it the file where the label definition is contained
(usually ddocml.ini) , the section in the file where the label definition is
(e.g. "Avery5260"), and how to align the label text (DDOC_CENTER, DDOC_LEFT, etc.)
dpNextLabel
This function tells the engine that you want to skip to the next label.
The engine moves its internal position pointers appropriately and creates
new pages as needed. In actuality, there may be instances where you don't
need to call this at all. Ddoc will call it for you if you have exceeded the
number of lines that fit on a label. Suppose you have a label that holds 6
lines of text. After you have added 6 lines to this label and you call a 7th
line, ddoc will call dpNextLabel automatically for you.
dpPrintTemplate
dpPrintTemplate is a wrapper function that prints out what the currently label
definition looks like when printed. It can be used in your applications to give
the user an idea of what each available label description looks like.
dpSetLabel
This routine tells the engine to print the next label on a specific label number.
Labels are numbered vertically on the page. For example, Avery5260 labels have 3
columns of 10 labels each - total 30 labels on the page. Label number 1 is in the
upper-left hand corner, label #10 is in the lower-left, label 11 is in the top-middle,
label 20 is in the bottom/middle, label 21 is in the upper-right, and label 30 is in
the bottom-right. If you would like to start printing on the second column of labels,
you call:
dpSetLabelLine
This routine tells the label engine on which line in the current label you
would like to start printing. For example, if you want to start printing on
the 2nd line, call:
|