You are not logged in.
Pages: 1
Hi!
I have created pdf with text, but i cannot find how to add picture (any format). I am looking for the easiest source code to do this. It would be nice if anyone could add all the implementation uses and etc too.
I am using the method with canvas and tried this:
with TPdfDocument.Create do
try
AddPage;
Canvas.DrawXObject(10,10,10,10, 'Picture.bmp');
Canvas.SetFont('Times new roman',30,[{fsItalic,}{fsBold}]);
This is not working. Can someone help me?
Last edited by delphi_prog (2012-06-21 11:53:18)
Offline
It won't work: you'll have to define the XObject before drawing it!
See TPDFDocument.CreateOrGetImage method.
Search for "TPDFDocument" in this forum, and you will find out some samples and discussion.
Not so easy.
So IMHO you would better use TPDFDocumentGDI class, and its standard Canvas parameter.
Then you'll be able to assign any picture to it, just as usual, without the internal PDF plumbing.
Or even easier use a TGDIPages report generator (which handles pictures easily).
Offline
Tryed to follow your instructions (not sure if i found the right thing). But i found procedure in SQLite3Pages:
procedure TGDIPages.DrawBMP(rec: TRect; bmp: TBitmap);
begin
if self=nil then exit; // avoid GPF
if not fHeaderDone then
DoHeader;
PrintBitmap(fCanvas, MmToPrinter(rec), bmp);
end;
Cant understand what is Trec and how do i have do declare rec and bmp to use them in my program?
Offline
Ive got it. Thanks for your help!
Offline
Pages: 1