Current task at hand is to develop Adobe Forms for the price tags at retail stores. I've implemented this via XFT templates as a custom "Z" class. Pipeline as follows:
1) Compose XFT template for the PDF (via SAXFT package)
2) Compose XFD temlate for the PDF
3) Create PDF and feed XFT and XFD templates, accordingly
4) Save PDF file to local PC
5) Print PDF
The only issue that is left is font size. For instance, if a price has up to 4 digits before the decimals, then it fits the field in PDF with the font size of 14 (font type is Verdana). But if the price of item goes up to 5 or 6 digits before the decimals, 5th and 6th digits are forced below the price field, spoiling the whole PDF file.
I was wondering is there robust method to convert info of the length of string and its font size into pixels or mm, and in case of overflow of the length of string over the length of the field to readjust the font-size.
For instance, we have a price for item - "1234.56". 4 digits before the decimals, a period character, and 2 digits after the period. Length of string is 7 characters. So, the line of reasoning then is as follows:
1) I multiply 7 by <some proportional to the font size variable measure in mm>, get the total length of string in mm
2) Compare the length of string with the length of the field. If length of string > length of the field, reduce the font size. Repeat steps 1 & 2