Examples

Top  Previous  Next

 

Please also see chapter "Linking with other products".

 

A) DrawMetafile

  WPPDFPrinter1.BeginDoc;

  try

    WPPDFPrinter1.DrawMetafile(0,0,Image1.Picture.Metafile.Handle);

    WPPDFPrinter1.DrawMetafile(0,0,Image2.Picture.Metafile.Handle);

    WPPDFPrinter1.DrawMetafile(0,0,Image3.Picture.Metafile.Handle);

    WPPDFPrinter1.DrawMetafile(0,0,Image4.Picture.Metafile.Handle);

  finally

    WPPDFPrinter1.EndDoc;

  end;

 

B) Canvas  

 WPPDFPrinter1.BeginDoc;

 WPPDFPrinter1.StartPage( w,h, res, res, 0);

 SaveDC(WPPDFPrinter1.Canvas.Handle);

 WPPDFPrinter1.Canvas.StretchDraw(

     Rect(0,0,w , h ), Image1.Picture.Graphic );

 RestoreDC(WPPDFPrinter1.Canvas.Handle,-1);

 WPPDFPrinter1.Canvas.Font.Color := clBlue;

 WPPDFPrinter1.Canvas.Font.Name := 'Arial';

 WPPDFPrinter1.Canvas.Font.Height := -13;

 WPPDFPrinter1.Canvas.TextOut(10,h-22,'Example');

 WPPDFPrinter1.EndPage;

 WPPDFPrinter1.EndDoc;

 

C) WPTools

  WPPDFExport1.Source := WPRichText1;

  WPPDFExport1.Print;

 

   Note: If you need to export multiple RTF texts into the same PDF file use BeginDoc/EndDoc.

 

  Please continue to read here...

 

 

D) Export from RichView

 

  WPPDFPrinter1.BeginDoc;

  try

    for I := PageF to PageT do

    begin

      WPPDFPrinter1.StartPage(

         Round(RichView1.PageProperty.PageWidth), 

         Round(RichView1.PageProperty.PageHeight), 

         Res, Res, 0);

   

      RichView1.DrawPage(I, 

         Round(RichView1.PageProperty.PageWidth), 

         Round(RichView1.PageProperty.PageHeight), 

        0, 0, WPPDFPrinter1.Canvas, False, False, False);

      pdf.EndPage;

    end;

  finally

    WPPDFPrinter1.EndDoc;

  end;

 

 

E) WPForm

var meta : TMetafile;

   i : Integer;

begin

  WPPDFPrinter1.BeginDoc;

  meta := nil;

  for i:=1 to WPFormEditor1.PageCount do

  try

    meta :=  WPFormEditor1.GetMetafile(i);

    WPPDFPrinter1.DrawMetafileEx(0,0,0,0,meta.handle,

           Screen.PixelsPerInch,Screen.PixelsPerInch);

  finally

    meta.Free;

  end;

  WPPDFPrinter1.EndDoc;

end;