diff --git a/components/lazreport/source/addons/pdfexport/lr_e_pdf.pas b/components/lazreport/source/addons/pdfexport/lr_e_pdf.pas index 8d0d121fab..35248d2f2b 100644 --- a/components/lazreport/source/addons/pdfexport/lr_e_pdf.pas +++ b/components/lazreport/source/addons/pdfexport/lr_e_pdf.pas @@ -438,25 +438,29 @@ end; procedure TfrTNPDFExportFilter.OnText(X, Y: Integer; const Text: string; View: TfrView); var - PRTLabel: TPRText; + PRTLabel: TPRLabel; nx, ny, ndx, ndy: Integer; + gapx, gapy: integer; begin - nx := Round(x * PDFEscx) + 1; - ny := Round(y * PDFEscy) + 1; - ndx := Round(View.dx * PDFEscx); - ndy := Round(View.dy * PDFEscy); + gapx := Round(View.FrameWidth / 2) + 2; + gapy := Round(View.FrameWidth / 2) div 2 + 1; + nx := Round((x+gapx) * PDFEscx) + 1; + ny := Round((y+gapy) * PDFEscy) + 1; + ndx := Round((View.dx-gapx) * PDFEscx); + ndy := Round((View.dy-gapy) * PDFEscy); - PRTLabel := TPRText.Create(PRPanel); + PRTLabel := TPRLabel.Create(PRPanel); PRTLabel.Parent := PRPanel; try - PRTLabel.Text := Text; + PRTLabel.Caption := Text; PRTLabel.Left := nx; PRTLabel.Top := ny; PRTLabel.Width := ndx; PRTLabel.Height := ndy; if View is TfrMemoView then begin + PRTLabel.Alignment := TfrMemoView_(View).Alignment; if Pos('Arial', TfrMemoView_(View).Font.Name) > 0 then PRTLabel.FontName := fnArial else if Pos('Courier', TfrMemoView_(View).Font.Name) > 0 then @@ -475,6 +479,8 @@ begin end; end; + + initialization frRegisterExportFilter(TfrTNPDFExportFilter, 'Adobe Acrobat PDF ' + ' (*.pdf)', '*.pdf'); diff --git a/components/lazreport/source/lr_class.pas b/components/lazreport/source/lr_class.pas index 3fc13043ad..7c2fda51e8 100644 --- a/components/lazreport/source/lr_class.pas +++ b/components/lazreport/source/lr_class.pas @@ -3109,8 +3109,8 @@ var if not Exporting then Canvas.TextRect(DR, CurX, CurY, St) else - CurReport.InternalOnExportText(curx, cury, St, Self); - + CurReport.InternalOnExportText(X, CurY, St, Self); + Inc(CurStrNo); Result := False; end @@ -3162,7 +3162,7 @@ var if not Exporting then canvas.TextOut(curx,cury,str) else - CurReport.InternalOnExportText(curx, cury, str, Self); + CurReport.InternalOnExportText(CurX, Y, str, Self); Inc(CurStrNo); curx := curx + th; end;