revprintfield and RIGHT tabalign?
mark at livecode.com
Fri Feb 14 13:13:47 EST 2020
On 2020-02-14 17:32, Klaus major-k via use-livecode wrote:
>> revPrintField formats the content of the field you specify to fill a
>> new field
>> which fits within the printMargins of the page.
>> 'print this card' starts printing the card *as it is* with the
>> top-corner at
>> the left-print-margin,top-print-margin.
>> Try choosing 'A4 Borderless' as the page size (this has 0 print
> As I wrote, then it works as exspected, but this is not practical,
> who has a marginless printer?
Most people these days in fact! Most (even cheap) inkjets can print to
the edge of an A4 page :D
[ Of course, the need for margins when printing is not actually really
related to what could be printed, but what is comfortable for the user
to hold and read! ]
The revPrintField command is written to make it easy to print the
contents of a field, over multiple pages to fit to the page setup and
printer options provided by the user. This means it computes the width
of the field based on those options.
The issue here is that your field layout is width sensitive - as are
most documents which use tabStops. If you'd typed your content into
word, and then changed the page setup / margin options from the settings
in effect when you set the tabStops then you'd get exactly the same
effect as you are seeing with revPrintField.
Your stack appears to already be laid out assuming an A4 page size -
which is why you get the effect you want when using 'print this card'.
Assuming you don't need to accommodate user-chosen page sizes, then all
you should need to do is:
1) use revShowPrintDialog to turn off showing the page setup dialog
2) set the printMargins to those you already have in your stack (the
distance of each edge of the field from the card boundary)
3) set the printPaperSize to the width and height of your stack (which
is A4 size in points - I think at least)
4) call (modified) revPrintField
This should mean that revPrintField will use a field of the same width
and height of that in the stack, but do the pagination for you.
If you do need to account for different (user chosen) page widths, then
you will need to adjust the tabStops appropriately:
1) answer page setup to get the user's chosen options
2) use revShowPrintDialog to turn off showing the page setup dialog
3) interrogate the printPaperSize and printMargins to work out the
printable width (pageWidth - leftMargin - rightMargin)
4) adjust the tabStops of your field so that the right tabStop is at
the printable width
5) call (modified) revPrintField
Hope this helps!
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode