PrintWizard Tip 01

Now the task is to marry the empty form with some data. Let’s have a look at what the end result will look like and then see how we get there. If you want to see the image more clearly you can right click and save it to your system then open it with Paint or a similar utility.

Data populates the template

 

 

 

 

I used red text just to show that we can change the text color. I’ll show examples of changing text styles later but here I just wanted to highlight the difference between template and data.

Let’s jump right into it and now I’ll show you one way that PrintWizard allows us to control exactly where data is going to print on a page.

<goto x=1.6in y=1.2in> Tom Jones <goto x=6in y=1.2in> 12345
<goto x=1.6in y=1.46in> moc.ruonull@jt <goto x=6in y=1.46in> Sales
<goto x=1.6in y=1.7in> Meet with client <goto X=6in y=1.7in> D.A. Bloss
<goto x=1.2in y=2.2in> 3.0 <goto x=2.3in y=2.2in> 3/mar-6/mar

PrintWizard will parse instructions out of data. Those instructions are provided in XML called PWML. Perhaps not suprisingly PWML looks a lot like HTML, but it’s really like HTML on steroids in some ways because HTML doesn’t know anything about pagination, and without CSS it’s not very good about positioning data either. Rather than having my data and markup generated from a program I cheated, opened up a text editor, and started typing.

The <goto> tag provides for several attributes, the X and Y coordinates tell PW to position the cursor at a given location in the printed page. For MV programmers this is just like using:
   PRINT @(16,12) : NAME : @(60,12) : ID
But think about it – we’re doing this on a printer! And no, you don’t need to build a printed page from the top-down, you can build it any way you want. Just provide coordinates and data and tell it to page-break whenever you’re done. I could have built the above data from the bottom-up and it would still render properly on the printed form … err, uh, page.

I used "in" for inches as the Unit Of Measure, but other possible UOM units include px for pixels, cm for centimeters, and others.

So that data is really no-brainer kind of stuff and it wouldn’t be hard to copy and modify an existing report program to insert positioning tags in addition to the data. Programs that can be used like this include those that print purchase orders, sales orders, quotes, invoices, shipping manifests, etc. You can even print checks with bar codes and MICR data, etc, but I don’t want to get into that now.

Leave a Reply