| View previous topic :: View next topic |
| Author |
Message |
Feike Member
Joined: 02 Aug 2006 Posts: 6 Location: Netherlands
|
Posted: 02/08/06 09:53 Post subject: Splitting a Metafile |
|
|
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.
|
|
| Back to top |
|
 |
Johnny_Bit Moderator
Joined: 15 Jun 2003 Posts: 274
|
Posted: 02/08/06 15:07 Post subject: |
|
|
| 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
|
|
| Back to top |
|
 |
Feike Member
Joined: 02 Aug 2006 Posts: 6 Location: Netherlands
|
Posted: 03/08/06 19:33 Post subject: |
|
|
| Quote: | | 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?
|
|
| Back to top |
|
 |
Johnny_Bit Moderator
Joined: 15 Jun 2003 Posts: 274
|
Posted: 04/08/06 05:47 Post subject: |
|
|
| 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
|
|
| Back to top |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1044 Location: Tehran, Iran
|
Posted: 04/08/06 12:39 Post subject: |
|
|
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.
_________________ Kambiz |
|
| Back to top |
|
 |
Feike Member
Joined: 02 Aug 2006 Posts: 6 Location: Netherlands
|
Posted: 08/08/06 11:42 Post subject: |
|
|
| Quote: | 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
|
|
| Back to top |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1044 Location: Tehran, Iran
|
Posted: 11/08/06 16:02 Post subject: |
|
|
| 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.
_________________ Kambiz |
|
| Back to top |
|
 |
Feike Member
Joined: 02 Aug 2006 Posts: 6 Location: Netherlands
|
Posted: 11/08/06 20:17 Post subject: |
|
|
Is this what you mean?
| Code: | 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; |
|
|
| Back to top |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1044 Location: Tehran, Iran
|
Posted: 12/08/06 04:54 Post subject: |
|
|
Yes!
You do not need BlzCanvas.
_________________ Kambiz |
|
| Back to top |
|
 |
Feike Member
Joined: 02 Aug 2006 Posts: 6 Location: Netherlands
|
Posted: 12/08/06 07:39 Post subject: |
|
|
I tried this and it works!
Thanks for your help!
|
|
| Back to top |
|
 |
|