WPCubed Product Support

Export to JPG

Please

Can I export a single page to JPG?

How can I do this!

Thanls

#1 ♥ 0
3.3k Views 2 users read 1 min
wpsupport

Sure, this would work like the export to a bitmap or EMF.

var bit: TBitmap;
  w, h: Integer;
const pagno = 0;
begin
  bit := TBitmap.Create;

  w := MulDiv(WPRichText1.Header.PageWidth, WPScreenPixelsPerInch, 1440);
  h := MulDiv(WPRichText1.Header.PageHeight-5, WPScreenPixelsPerInch, 1440);;

  bit.Width := w;
  bit.Height := h;

  bit.Canvas.Brush.Color := clWhite;
  bit.Canvas.FillRect(Rect(0, 0, w, h));

  WPRichText1.PrintPageOnCanvas(bit.Canvas,
    Rect(0, 0, w, h), pagno, [ppmPaintTransparent, // ppmPrintFrame,
    ppmStretchWidth, ppmStretchHeight, ppmIgnoreSelection, ppmUseEvents], 0);
  // Now assign that bitmap to a JPEG or PNG object to save compressed
  bit.Free;
end;
#2 ♥ 0
This category is archived. No new posts are possible.