You are not logged in.
Pages: 1
Salut Arnaud,Hello
Is there any possibility to set PrinterCanvas or printerobject to SynPdf?
var
p:TPrinter;
lPdf : TPdfDocumentGDI;
begin
lPdf := TPdfDocumentGDI.Create;
p:=TPrinter.Create;
p.BeginDoc;
p.Canvas.TextOut(0,0,'Salut');
{--------------------------------}
lPdf.Canvas:=p.Canvas?
{--------------------------------}
OR
lPdf := TPdfDocumentGDI.Create(p);
{-----------------------------------------------------}
lpdf.SaveToFile('c:\cafaitplaisir.pdf');
lpdf.Free;
p.EndDoc;
p.Free;
end;
Because I've thousand of lines with the printercanvas, and I'could not change it so easy.
Regards,
Loris
Offline
A TPrinterCanvas is just a thin layer over TCanvas, introducing printer-dependent work.
Please change in your code your variables or fields into a generic TCanvas.
Then it will work as expected with your legacy code.
And you will be able to change this TPrinterCanvas into a TPDfDocumentGDI canvas.
Offline
Thanks for the answer,
I made I interface with TCanvas, but how can I set canv
to PDFCanvas? Its necessary that I use tcanvas.
var
lPdf : TPdfDocumentGDI;
canv:TCanvas;
begin
lPdf := TPdfDocumentGDI.Create;
dosome(canv);
this is not going:
false
lPdf.Canvas:=canv; because property.
Could you help me witht a peace of code?
Thanks a lot
loris
Offline
Thanks for fast answer
Now I reveive a pdf, empty unfortunately.
The parameter of dosome(...) is TCanvas -->procedure printPDF(destination: tcanvas;outputnr:Integer);
dosome(lPdf.VCLCanvas);
lPdf.SaveToFile('c:\hallo.pdf');
lpdf.Free;
Do you thinks there must happen something in the code, or...
Regards, merci bc
Offline
Pages: 1