WPForm

Top  Previous  Next

WPForm is a component set to provide a tool to create labels and forms with ease. It has the ability to create lists as well. Its user interface is intuitive and cusomizable - you dont have to provide the enduser a tool which provides too many features to explain - in WPForm you can customize everything!

 

To create metafiles with WPForm you can use this code:

 

var meta : TMetafile;

   i : Integer;

begin

  Init;

  WPPDFPrinter1.BeginDoc;

  meta := nil;

  for i:=1 to WPFormEditor1.PageCount do

  try

    meta :=  WPFormEditor1.GetMetafile(i);

    WPPDFPrinter1.DrawMetafile(0,0,meta.handle);

  finally

    meta.Free;

  end;

  WPPDFPrinter1.EndDoc;

end;

 

If you need to redirect the printing of the preview dialog (such as a report or labels) you can set the property TWPPreviewDlg.CustomPrinting to true and use the three printing events to create output:

 

// WPFPreviewDlg1.CustomPrinting muse be TRUE

 

procedure TForm1.WPFPreviewDlg1CustomPrintEnd(Sender: TWPFReportEngine;

FormEditor: TWPFormEditor);

begin

WPPDFPrinter1.EndDoc;

end;

 

procedure TForm1.WPFPreviewDlg1CustomStartPrint(Sender: TWPFReportEngine;

FormEditor: TWPFormEditor; var Abort: Boolean);

begin

WPPDFPrinter1.Filename := 'c:\testwpform.pdf';

WPPDFPrinter1.AutoLaunch := TRUE;

WPPDFPrinter1.BeginDoc;

end;

 

procedure TForm1.WPFPreviewDlg1CustomPrintPage(Sender: TWPFReportEngine;

FormEditor: TWPFormEditor; PageNo: Integer; var Abort: Boolean);

var res : Integer;

begin

res := Screen.PixelsPerInch;

WPPDFPrinter1.StartPage(

   MulDiv(FormEditor.Page.PageWidthTW,res,1440),

   MulDiv(FormEditor.Page.PageHeightTW,res,1440),

   res,res,0);  

try

FormEditor.PrintPageOnCanvasZoom(WPPDFPrinter1.Canvas, PageNo, 0, 0, 100);

finally

   WPPDFPrinter1.EndPage;

end;

end;

 

It is also possible to create the PDF without first showing the the preview.

Please use the above code but instead of showing the report with

 

// Create report/labels and show it

WPFPreviewDlg1.PreviewReport(WPFReportEngine1); 

 

Print it at once with

 

// Create report/labels and PRINT

WPFPreviewDlg1.PrintReport(WPFReportEngine1);