Problem with printing resized image

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
prosoft
Posts: 24
Joined: Tue Jul 11, 2006 8:51 am

Problem with printing resized image

Post by prosoft » Thu Oct 02, 2008 8:37 am

I insert image from clipboard to document. (printscreen 1024x800). I change this size to 100x100 pixels by property page. Image is showen right. Now I do print document and image is printed with height 100 px but width is original (1024 pix).

Thanks Josef.

Sergey Tkachenko
Site Admin
Posts: 14648
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko » Thu Oct 02, 2008 6:18 pm

This problem will be fixed in the next TRichView update.

If you have TRichView source code, this is a quick fix:

Open CRVFData.pas, and change the procedure PaintAsBitmap:

Code: Select all

  procedure PaintAsBitmap(X, Y: Integer; DrawItem: TRVDrawLineInfo;
    Item: TCustomRVItemInfo);
  var bmp: TBitmap;
  begin
    bmp := TBitmap.Create;
    try
      bmp.Width := Item.GetImageWidth(RVStyle);
      bmp.Height := Item.GetImageHeight(RVStyle);
      Item.PrintToBitmap(bmp, False, GetParentControl as TCustomRichView, DrawItem,
        -1, rvcmColor);
      RV_PictureToDevice(Canvas, X+Item.GetBorderWidth, Y+Item.GetBorderHeight,
        Item.GetImageWidth(RVStyle), Item.GetImageHeight(RVStyle), nil, bmp, False);
    finally
      bmp.Free;
    end;
  end;

Post Reply