procedure AddPicture(Picture: TPicture; X, Y: Double);
| Picture | TPicture. embedded할 source picture object입니다. Picture 안의 graphic은 변환되어 page에 natural size로 배치됩니다(picture의 pixel 크기인 Picture.Width / Picture.Height를 PDF user unit으로 환산) |
procedure AddPicture(Picture: TPicture; X, Y, Width, Height: Double);
| Picture | TPicture. embedded할 source picture object입니다. graphic은 page의 지정한 Width × Height rectangle에 맞게 축소 또는 확대됩니다 |
AddPicture는 TPicture object에 들어 있는 graphic을 현재 PDF page에 embedded합니다. 두 가지 overload가 있습니다. 세 좌표 형태는 picture를 natural size로 배치하고, 다섯 좌표 형태는 명시한 Width × Height rectangle에 맞게 축소 또는 확대합니다
TPicture는 등록된 모든 graphic format을 담는 표준 VCL/LCL container입니다. format에 종속되지 않으므로 bitmap, PNG image, JPEG image 또는 TPicture instance에 로드된 다른 graphic을 넘길 수 있습니다. 단순한 TBitmap을 직접 배치하려면 대신 AddImage를 고려하세요. raw JPEG stream data에는 AddJpegImage를 사용하세요
X와 Y 매개변수는 PDF user unit 기준 image의 왼쪽 아래 모서리를 정의합니다(원점은 page 왼쪽 아래, Y는 위로 증가). Width와 Height를 생략하면 배치 크기는 picture의 pixel 크기에서 72 DPI를 가정해 계산합니다
var
Pic: TPicture;
begin
Pic := TPicture.Create;
try
Pic.LoadFromFile('C:\Images\chart.png');
// Place at natural size, lower-left at (72, 500)
Pdf1.AddPicture(Pic, 72, 500);
// Or scale to an explicit 300 x 200 pt rectangle
Pdf1.AddPicture(Pic, 72, 200, 300, 200);
finally
Pic.Free;
end;
end;