You are not logged in.
Pages: 1
Hi, I'm using this code to create simple PDF:
gdip := TGDIPages.Create(self);
try
gdip.BeginDoc;
gdip.Caption := 'HBSS Log Parser Document';
gdip.Font.Size := 10;
gdip.Font.Name := 'Calibri';
gdip.SaveLayout;
gdip.Font.Style := [fsItalic];
gdip.TextAlign := taLeft;
gdip.AddTextToHeaderAt('HBSS Log Parser', gdip.LeftMargin);
gdip.TextAlign := taRight;
gdip.AddTextToHeaderAt('HIPS', gdip.RightMarginPos);
gdip.AddLineToHeader(false);
gdip.AddLineToFooter(false);
gdip.TextAlign := taLeft;
gdip.AddTextToFooterAt(DateTimeToStr(Now), gdip.LeftMargin);
gdip.TextAlign := taRight;
gdip.AddPagesToFooterAt('Page %d/%d', gdip.RightMarginPos);
gdip.RestoreSavedLayout;
gdip.TextAlign := taCenter;
gdip.Font.Style := [fsBold];
gdip.AddColumns([20, 40, 20, 40]);
gdip.AddColumnHeaders(['Date/Time', 'Computer Name', 'Signature ID', 'Signature Name']);
gdip.Font.Style := [];
gdip.DrawTextAcrossCols(['1', '2', '3', '4']);
gdip.NewLine;
gdip.DrawTextAcrossCols(['5', '6', '7', '8']);
gdip.EndDoc;
gdip.ExportPDF(ReportSaveDialog.FileName, TRUE, TRUE);
finally
gdip.Free;
end;
As a result, I get this: http://i47.tinypic.com/2vt4gnk.png
Can anyone give me hint what am I doing wrong, and how to fix header? Footer looks fine.
Thanks!
Offline
Try
gdip.Font.Style := [fsItalic];
gdip.TextAlign := taRight;
gdip.AddTextToHeaderAt('HIPS', gdip.RightMarginPos);
gdip.TextAlign := taLeft;
gdip.AddTextToHeader('HBSS Log Parser');
gdip.AddLineToHeader(false);
As stated by its documentation, AddTextToHeaderAt() does not change the Y position to the next line.
So using AddTextToHeader() will move the cursor to the next line, so AddLineToHeader() should be drawn at the expected position.
Offline
Thanks, will try.
Offline
Pages: 1