TAdvPDFLib landscape...

Hello,

First time using TAdvPDFLib. The user manual needs some attention. Page 18&19 have a few...issues, my2c.
Attempting to save a bitmap to PDF. Saving the bitmap to a file, the image is correct for size and orientation.

No joy with TAdvPDFLib.
I did figure out the TBitMap (in the user manual) needs to be a TPicture and the version is 1.0.2.0 in the properties of the debugger.
Nothing I tried (many things) would get it to save to landscape.
And it prints the word "header" and "footer" no matter what I do.
Perhaps I totally miss what needs to be done.

procedure SaveScreenToPDF(bMap:TBitmap; const fName:string);
var
 p:TAdvPDFLib;
 aPicture:TPicture;
begin
 p:=TAdvPDFLib.Create;
 aPicture:=TPicture.Create;
 try
  aPicture.Assign(bMap);
  p.BeginDocument(fName);
  p.NewPage;
  p.PageOrientation:=poLandscape;
  p.PageSize:=psCustom;
  p.PageWidth:=bMap.width;
  p.PageHeight:=bMap.height;
  p.Graphics.Fill.Color:=gcNull;

  p.Header:='';
  p.HeaderSize:=0;
  p.Footer:='';
  p.FooterSize:=0;

  p.Graphics.DrawImage(aPicture,
                       gcNull,
                       RectF(0,0,bMap.width,bMap.height),
                       false,
                       false,
                       itOriginal,
                       1.0,
                       false);

  p.EndDocument(true);
 finally
  p.Free;
  aPicture.Free
 end;
end;

Ideas?

Thanks,

Mark

OK, I took a break, then worked on it more and found the correct settings order. Not the order in the user manual.
Here you go.
procedure SaveScreenToPDF(bMap:TBitmap; const fName:string);
var
 p:TAdvPDFLib;
 aPicture:TPicture;
begin
 p:=TAdvPDFLib.Create;
 aPicture:=TPicture.Create;
 try
  aPicture.Assign(bMap);

  p.PageWidth:=bMap.width;
  p.PageHeight:=bMap.height;
  p.PageSize:=psCustom;
  p.Header:='';
  p.HeaderSize:=0;
  p.Footer:='';
  p.FooterSize:=0;

  p.BeginDocument(fName);
  p.NewPage;

  p.Graphics.Fill.Color:=gcNull;
  p.Graphics.DrawImage(aPicture,
                       gcNull,
                       RectF(0,0,bMap.width,bMap.height),
                       false,
                       false,
                       itOriginal,
                       1.0,
                       false);

  p.EndDocument(true);
 finally
  p.Free;
  aPicture.Free
 end;
end;

This is possibly due to underlying structural changes in the PDF lib handling, where the pages where generated at the end, and now they are generated with each NewPage call. Thank you for your feedback.