revprintfield and RIGHT tabalign?

Klaus major-k klaus at major-k.de
Fri Feb 14 13:27:33 EST 2020


Hi Mark,

> Am 14.02.2020 um 19:13 schrieb Mark Waddingham via use-livecode <use-livecode at lists.runrev.com>:
> 
> 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 margins).
>> 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

oh boy, has been some time since I have printed out something or even owned a printer. :-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'.

Yes, (DIN) A4 (595*842 Pixels) is pretty standard over here in Europe (cough, cough 8-))

> 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

OK

>  2) set the printMargins to those you already have in your stack (the distance of each edge of the field from the card boundary)

OK

>  3) set the printPaperSize to the width and height of your stack (which is A4 size in points - I think at least)

OK

>  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.

Thanks a lot, will try that.
A4 is all I need to supply.

Hm, did take all the above mentioned stape but there are still parts that are not printed
and the TOTAL lines are still wrapped.

> 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!

Thank you very much!

OK, I spent too much time on this already, I will use "print cd xyz" for now...

> Warmest Regards,
> 
> Mark

Best

Klaus

--
Klaus Major
https://www.major-k.de
klaus at major-k.de





More information about the use-livecode mailing list