Render metafiles to pages

<< Click to Display Table of Contents >>

Navigation:  Tasks > Draw Shapes / Text objects on PDF >

Render metafiles to pages

The commands

  COMPDF_StampMetafile and COMPDF_StampMetafileUnder can be used to apply metafiles to pages.  

 

The expect a metafile handle which will be rendered under or over the page contents. This requires the PLUS edition of WPViewPDF.

 

The string parameter is a page list "1..x" which contains the pages the metafile should be applied to.

 

In case you want to stamp a bitmap please us AddImage and UseImage.

 

Please call command COMPDF_StampMetafile_Scaling with parameter 72 before you use the stamping.

 

 

COMPDF_StampMetafile = 495:  

     StrParam = page list, for example 1-2,

     IntParam = Metafile Handle  - over page

 

COMPDF_StampMetafileUnder = 496;

 

COMPDF_StampMetafile_Scaling = 614 : Set the scaling resolution for the commands  COMPDF_StampMetafile and COMPDF_StampMetafileUnder. Default is the screen resolution. We recommend to set it to 0 to select the resolution automatically.

 

 

Example:

 

   if WPViewPDF1.LoadFromFile(background.pdf') then

   begin

              Metafile1 := WPViewPDF1.GetMetafile(0);

   end

   else Metafile1 := nil;

 

 

   if WPViewPDF1.LoadFromFile(any.pdf') then

   begin

          WPViewPDF1.Command( COMPDF_StampMetafile_Scaling, 0 );

          if Metafile1<>nil then

          begin

              WPViewPDF1.CommandStrEx (COMPDF_StampMetafileUnder,

                        '1', MetaFile1.Handle)

              WPViewPDF1.Plus.SaveToFile('test_modified.pdf');

        end;

   end;

   MetafileS1.Free;