#1 2011-12-18 14:06:38

Papy214
Member
Registered: 2011-12-18
Posts: 2

PageSize on TPdfDocument GDI

HI,

I use the code :

procedure TForm1.btnPDFClick(Sender: TObject);
var
  fichier: string;
  testpdf:TPdfDocumentGDI;
  page: TPdfPage;
  bmp: TBitmap;
begin

  if not PromptForFilename(fichier) then
    Exit;

  testpdf := TPdfDocumentGDI.Create;
  try
    testpdf.NewDoc;
    testpdf.DefaultPaperSize := psA4;
    try
      page := testpdf.AddPage;
      testpdf.ForceJPEGCompression := 75;
      bmp := TBitmap.Create;
      bmp.LoadFromFile(fichier);
      testpdf.VCLCanvas.StretchDraw(Rect(10, 10, page.PageWidth - 20, page.PageWidth - 20), bmp);
      bmp.free;

    finally
      testpdf.SaveToFile('d:\test.pdf');
    end;
  finally
    testpdf.Free;
  end;

end;

But the pageSize is not correct. The margins are not good. The image is only on a half part of page.

How can I get the real pagesize to adjust the picture to the page please ?

Papy

Offline

#2 2011-12-29 21:03:09

Papy214
Member
Registered: 2011-12-18
Posts: 2

Re: PageSize on TPdfDocument GDI

Great help here !

Thanks !

Offline

#3 2012-01-23 07:23:45

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: PageSize on TPdfDocument GDI

Papy214 wrote:

Great help here !

Thanks !

Your question was already answered here: http://synopse.info/forum/viewtopic.php?id=525
smile

Offline

Board footer

Powered by FluxBB