#1 PDF Engine » How to use TPDFForm class? » 2014-12-05 15:37:17

RomekAtomek
Replies: 1

Is there an example in which was used TPDFForm class?


Romek

#2 PDF Engine » Is TPDFForm.Create correct? » 2014-12-05 13:33:15

RomekAtomek
Replies: 0

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

Board footer

Powered by FluxBB