#1 Re: PDF Engine » Question and possible bug (or installation problem?)?? » 2013-08-29 07:16:58

I had exactly the same problem as Martin.

It's nothing to do with loading pdf's...


I downloaded the latest source and build with Delphi 2010

Add a TGDIPages to an empty form and it crashes with the error message:
List Index out of bounds(0).

TGDIPages is not a visual component!
But then, it shouldn't even appear on the component palette.


I did a bit of searching to find the reason (actually, it was even pointed out on this page but I didn't click at the time).


Here is the example I found

procedure TForm2.Button3Click(Sender: TObject);
var
  i: integer;
begin
  with TGDIPages.Create(self) do
  try

    // the title of the report
    Caption := self.Caption;

    // now we add some content to the report
    BeginDoc;

    // header and footer
    AddTextToHeader(paramstr(0));

    SaveLayout;

    Font.Style := [fsItalic];
    TextAlign := taRight;
    AddTextToFooterAt('footnote',RightMarginPos);
    RestoreSavedLayout;
    AddTextToFooter(DateTimeToStr(Now));

    // main content (automaticaly split on next pages)
    NewHalfLine;

    DrawTitle('Sample Report', true);
    for i := 1 to 10 do
      DrawText('This is some text '+IntToStr(i));
    NewLine;

    AddColumns([10,20,50]);
    AddColumnHeaders(['#','Two','Three'],true,true);
    for i := 1 to 100 do
      DrawTextAcrossCols([IntToStr(i),'Row '+IntToStr(i),'Some text here']);
    NewLine;

    DrawTitle('This is your text:');
    DrawText(memo1.text);

    EndDoc;

    // this method will show a preview form, and allow basic actions
    // by using the right click menu
    ShowPreviewForm;

  finally
    Free;
  end;
end;

Board footer

Powered by FluxBB