#1 2014-12-05 13:33:15

RomekAtomek
Member
Registered: 2014-12-05
Posts: 2

Is TPDFForm.Create correct?

Hi,

I have a problem with the constructor of TPDFForm.

constructor TPdfForm.Create(aDoc: TPdfDocumentGDI; aMetaFile: TMetafile);
(...)
  P := TPdfPageGDI.Create(nil);                     // 1
  try
    oldPage := FPage;
    FPage := P;
    with aDoc.FCanvas do
    begin
      try
        (...)
        FPage.SetPageHeight(H);                        // 2
        (..)
      finally
        if oldPage <> nil then
          SetPage(oldPage);
      end;
    end;

1. TPdfPageGDI.Create(nil) don't initialize FMediaBox (from TPdfPage);
2. in method

procedure TPdfPage.SetPageHeight(AValue: integer);
begin
  TPdfNumber(FMediaBox.Items[3]).Value := AValue
end;

attempts to an uninitialized variable FMediaBox raise exception.



If this constructor is correct?

Romek

Offline

Board footer

Powered by FluxBB