FastReports right align issue

Viewed 120

I have a problem with generated pdf when text in textbox is aligned right. I have following example report:

<?xml version="1.0" encoding="utf-8"?>
  <Report ScriptLanguage="CSharp" ReportInfo.CreatorVersion="2021.4.0.0">
    <Dictionary/>
    <ReportPage Name="Demo" Watermark.Font="Arial, 60pt">
      <ReportTitleBand Name="Demo" Width="718.2" Height="500">
        <TextObject Name="Text1" Left="50" Top="31.1" Width="300" Height="48.9" Text="0000000001" HorzAlign="Right" VertAlign="Center" Font="Arial, 36pt"/>
        <TextObject Name="Text1" Left="50" Top="90.55" Width="300" Height="39.45" Text="1" HorzAlign="Right" VertAlign="Center" Font="Arial, 36pt"/>
        <TextObject Name="Text2" Left="50" Top="150" Width="300" Height="30" Text="0000000001" HorzAlign="Right" VertAlign="Center" Font="Arial, 24pt"/>
        <TextObject Name="Text2" Left="50" Top="200" Width="300" Height="30" Text="1" HorzAlign="Right" VertAlign="Center" Font="Arial, 24pt"/>
        <TextObject Name="Text3" Left="50" Top="250" Width="300" Height="30" Text="0000000001" HorzAlign="Right" VertAlign="Center" Font="Arial, 14pt"/>
        <TextObject Name="Text3" Left="50" Top="300" Width="300" Height="30" Text="1" HorzAlign="Right" VertAlign="Center" Font="Arial, 14pt"/>
        <TextObject Name="Text4" Left="50" Top="350" Width="300" Height="30" Text="0000000001" HorzAlign="Right" VertAlign="Center" Font="Arial, 8pt"/>
        <TextObject Name="Text4" Left="50" Top="400" Width="300" Height="30" Text="1" HorzAlign="Right" VertAlign="Center" Font="Arial, 8pt"/>
        <LineObject Name="Line1" Left="350" Height="450"/>
      </ReportTitleBand>
    </ReportPage>
  </Report>

Which is displayed in designer like this: Report in designer As you can see, the text is already not properly aligned right, although the text boxes are correctly placed. In my application I generate pdf with following code:

using var report = new Report();
var reportSettings = FastReport.Utils.Config.ReportSettings;
report.Load("test.frx");
report.Prepare();
            
using var memoryStream = new MemoryStream();
using var pdfExport = new PDFExport
{
    EmbeddingFonts = true,                   
};
report.Export(pdfExport, memoryStream);

After that I save the pdf from memory stream to file and when I open the generated report, it is like this: Generated pdf

You can clearly see, that the numbers are not aligned right nicely - compare right "padding" of first row with right "padding" of fifth row and so on. Also the generated report differs slightly when its generated on various OS (linux and windows) - on one system some of the rows are more to the right and some of them are more to the left.

0 Answers
Related