Forum > Lazarus Extra Components

Printer4Lazarus Printing question.

(1/1)

asmx:
Very strange, Printer4Lazarus will reverse left and right when printing content containing numbers and /.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var TextStyle: TTextStyle;...TextStyle.Layout := tlTop;TextStyle.SingleLine := False;TextStyle.Clipping := False;TextStyle.EndEllipsis := False;TextStyle.Wordbreak := True;TextStyle.SystemFont := False;TextStyle.Alignment := taLeftJustify; Printer.Canvas.TextRect(TRect.Create(0, 0, Printer.PaperSize.Width, Printer.PaperSize.Height), 0, 0, '5.6/X', TextStyle); 

wp:
If the code show is all that you do with the TextStyle variable then you did not initialize it properly. There is also the field RightToLeft which you did not fill, and thus might have the value 'true' which exactly causes this effect.

The best way to initialize TextStyle is first to assign to it the currently used values of the Canvas.TextStyle, and then to modifiy the fields that you want to:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  TextStyle: TTextStyle;...  TextStyle := Printer.Canvas.TextStyle;  TextStyle.SingleLine := false;  TextStyle.WordBreak := true;  Printer.Canvas.TextRect(TRect.Create(0, 0, Printer.PaperSize.Width, Printer.PaperSize.Height), 0, 0, '5.6/X', TextStyle);

asmx:
@wp

Thank you very much! this is indeed the problem.

Navigation

[0] Message Index

Go to full version