WPCubed Product Support

Extra blank page appears in PDF document

support

WPE.Print(); exports the text in the attached TWPCustomRTFEdit.

Apparently you do not have text in there, so you do not need a TWPCustomRTFEdit or a TWPPDFExport.

Just use the TWPPDFPrinter, not the TWPPDFExport.

#2 ♥ 0
5k Views 2 users read 1 min

I use the following code to export a TBitmap image to PDF file.

var WP: TWPCustomRTFEdit; WPDF: TWPPDFExport; res: word;
begin
  WP:=   TWPCustomRTFEdit.CreateDynamic;
  WPDF:= TWPPDFExport.Create(nil);
 wpe.Source:= wp;
 wpe.AutoLaunch := TRUE;
 wpe.Filename:= fn;

 res:= Screen.PixelsPerInch;
 wpe.BeginDoc();

 wpe.StartPage(Bmp.Width, Bmp.Height, res, res, 0);
 wpe.Canvas.StretchDraw(Rect(0, 0, Bmp.Width, Bmp.Height), Bmp);
 wpe.EndPage();

 WPE.Print();
 wpe.endDoc();
end;

The code works fine except a blank page is added to resulting document every time. How to get rid of that?
Component versions are WPTools 6 and WPDF 2

#1 ♥ 0