Page 1 of 1
Splitting a Metafile

Posted:
August 2nd, 2006, 9:53 am
by Feike
Hello,
I need to split a metafile.
It has an a3 format and I want to split the file in two a4 metafiles so I can print it on two pages.(I use Printpreview) How can I do this?
I know how to do this with a bitmap, but not with a metafile.

Posted:
August 2nd, 2006, 3:07 pm
by Johnny_Bit
it's scallable vector graphics, meaning that it would scale itself to proper width and height. but spit in in two pages? only some grahics programs came to my mind, eg corel or inkscape

Posted:
August 3rd, 2006, 7:33 pm
by Feike
but spit in in two pages? only some grahics programs came to my mind, eg corel or inkscape
So it can't be done in Delphi?

Posted:
August 4th, 2006, 5:47 am
by Johnny_Bit
And you know how hard it's done? Sime way wouldbe draw metafile on bitmap then split bitmap, as I am no expert when it commes to metafiles i think that best wa to do it without bitmap wouldbe fixed-point scale and then place virtual ruller on middle, then cut objects along it. but how, I don't know

Posted:
August 4th, 2006, 12:39 pm
by Kambiz
There's no need to physically split the metafile.
- Devide the metafile to some logical sections. For example to print an A3 size metafile, you should consider two A4 size sections.
- For each section, offset origion of the destination canvas to top-left corner of the section.
- Stretch draw the metafile on the canvas, as you print on an A3 paper. However, your actual canvas size should be A4 size.
That's all.

Posted:
August 8th, 2006, 11:42 am
by Feike
There's no need to physically split the metafile.
1. Devide the metafile to some logical sections. For example to print an A3 size metafile, you should consider two A4 size sections.
2. For each section, offset origion of the destination canvas to top-left corner of the section.
3. Stretch draw the metafile on the canvas, as you print on an A3 paper. However, your actual canvas size should be A4 size.
How can I devide a canvas in sections?
Can you give some more info?
Thanks in advance

Posted:
August 11th, 2006, 4:02 pm
by Kambiz
Feike wrote:How can I devide a canvas in sections?
In the same way you divide a paper; by measuring and locating the right coordinates.

Posted:
August 11th, 2006, 8:17 pm
by Feike
Is this what you mean?
- Code: Select all
procedure split metafile(Index:Integer);
var
BWidth, BHeight : Integer;
SrcRect, DestRect : TRect;
BlzCanvas:TCanvas;
begin
BWidth := Picture.Width div 2;
BHeight := Picture.Height div 2;
DestRect := pa4; // a4 papersize
SrcRect.Left := (Index mod 2) * BWidth;
SrcRect.Top := (Index div 2) * BHeight;
SrcRect.Right := SrcRect.Left + BWidth;
SrcRect.Bottom := SrcRect.Top + BHeight;
try
BlzCanvas := TMetafileCanvas.Create(FPicture.Metafile,0);
BlzCanvas.Draw(0 - (SrcRect.Left ),0 - (SrcRect.Top ),Picture.Metafile);
finally
BlzCanvas.Free;
end;
PreviewPrinter1.Canvas.StretchDraw(pa4,BlzCanvas);
end;

Posted:
August 12th, 2006, 4:54 am
by Kambiz
Yes!
You do not need BlzCanvas.

Posted:
August 12th, 2006, 7:39 am
by Feike
I tried this and it works!
Thanks for your help!