WPCubed Product Support

WPTools 6.2.8 "forgets" page breaks

After upgrading from WPTools 6.2.7 to Version 6.2.8 I suddenly experience bad misbehavior:

I create a document with dynamically inserted graphics at runtine. With the new version WPTools sometimes "forgets" to insert a pagebreak when a graphics doesn't fit on a page anymore.

Here is some code dempnstrating the problem:
(Just create a fresh empty project and wire the code to a button-OnClick-Event.

When you look at the resulting printout: After the 1st graphic there's a pagebreak but after the 2nd graphic the pagebreak is missing and therefore the 3rd graphic is half-clipped.

The 4th graphic is printed fine again...

Please HELP!!!! It's utterly urgent.

uses WPCTRRich, WPOBJ_Image;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var richText : TWPRichText;
    i : integer;
    gra : TMetafile;
    canv : TMetafileCanvas;
    aktsizex, aktsizey : integer; // in mm
    wpImg : TWPOImage;
    sizeX, sizeY : integer;       // in pixel
begin
     richText := TWPRichText.CreateDynamic;
     try
        // VERY strange - without text WPTools doesn't print anything
        // (but this is not my actual problem)
        richText.InputString('Remove this call for a complete fail');

        for i:=0 to 3 do
        begin
             AktSizeX := 190;
             AktSizeY := 240;

             gra := TMetafile.Create;
             sizex := MulDiv(AktSizeX, 960, 254);
             sizey := MulDiv(AktSizeY, 960, 254);
             gra.SetSize(sizex, sizey);

             canv := TMetafileCanvas.Create(gra, 0);
             try
                canv.Brush.Color := clWhite;
                canv.FillRect(Rect(0, 0, sizex, sizey));
                canv.Pen.Width := 2;
                canv.MoveTo(0, 0);
                canv.LineTo(sizex, sizey);
                canv.MoveTo(0, sizey);
                canv.LineTo(sizex, 0);
                canv.Font.Height:=25;
                canv.TextOut(sizex div 2, 10, 'Strip #'+IntToStr(i+1));
                canv.TextOut(sizex div 2, sizey - canv.TextHeight('X'), 'Strip #'+IntToStr(i+1)+' end');
             finally
                    canv.Free;
             end;

             wpimg:=TWPOImage.CreateImage(richText.Memo.RTFData, gra);
             wpimg.WidthTW :=MulDiv(AktSizeX, 14400, 254);
             wpimg.HeightTW:=MulDiv(AktSizeY, 14400, 254);
             RichText.TextObjects.Insert(wpimg);
        end;

        RichText.ReformatAll;
        richText.Print;
     finally
            richText.Free;
     end;
end;
#1 ♥ 0
4.1k Views 2 users read 2 min
This category is archived. No new posts are possible.