#1 2014-04-22 11:56:00

TDelphiProgrammer
Member
Registered: 2014-04-01
Posts: 2

canvas.brush.style are not visible in generated PDF-files

Hello,

I'm using this PDF-Engine and it works great.

Only by filling a rectangle with a brushstyle, I found a problem.

I have tried to fill a rectangle with a green structure or better, a brush style, for example bsDiaCross.
At first I only create a PDF-file, but all I could see was a completely filled green rectangle.
After this I have saved the Metafile in "a.wmf" file to control the structure. And I saw the correct result.

here the code to generate both files:

procedure TForm28.Button1Click(Sender: TObject);
var Meta: TMetafile;
    doc : TPDFDocument;
    Page: TPdfPage;
    R: TRect;
begin
Meta := TMetafile.Create;
meta.SetSize(500,500);

Canvas := TMetafileCanvas.Create(Meta, GetDC(0));

R := ClientRect;
InflateRect(R, -10, -10);
Canvas.Brush.Color := clgreen;
Canvas.Brush.Style := bsDiagCross;
Canvas.Pen.Color := clRed;
Canvas.Rectangle(R);

Canvas.Free;

//in this file, the result is the prefered one, the brushstyles are shown and it's what I need.
meta.SaveToFile('c:\Temp\a.wmf');

Doc := TPdfDocument.Create;
Doc.DefaultPaperSize := psA4;
Page := Doc.AddPage;
Page.PageLandscape := true;
Doc.canvas.RenderMetaFile(meta);

//but if i save the same Metafile in a PDF-Document, 
//the rectangle with the brushstyle is completely filled with the brush.color. 
//and no style is visible
Doc.SaveToFile('c:\Temp\a.pdf');

end;

I hope someone can help me to print structures in the PDF-file.

Thanks in advance.

Offline

Board footer

Powered by FluxBB