SavePageAsMetafile Method

[Top]  [Chapter]  [Previous]  [Next]


bool SavePageAsMetafile(int PageNr, string : Filename, int Options, int BackgroundColor);


Creates a EMF file from a certain page. Also see method GetPageAsMetafile.


Also see the commands to create bitmap files (BMP, PNG and TIFF).



PageNr :        The number of the page to be saved. The first is 0.

Filename:        The enhanced metafile (*.EMF) file to be created.

Options:        a bit field:

4: display a frame for the page margins

8: optimized for PDF export. We recommend to always set this bit!

16: also print selection marker

32: do not print watermarks

64: do not print header and footer

128: do not print images

256: print table grid lines.

512: Export embedded meta-files as bitmaps

BackgroundColor: A background color as RGB value



// Create a preview (thumbnail) of the document INSIDE the

 // document. We use a temporary file.

 string tempfile = System.IO.Path.GetTempFileName();

 string emf_tempfile = tempfile + ".EMF";



     // Format the text, othewise SavePageAsMetafile does not work


     // save this page as image


     // and insert it here

     TextCursor.InputText("Preview of this page :");


     Memo.CurrObj.Frame = 1;

     // Scale to 30 % of the original size



     // The preview does not contain the image which jsut has been inserted

     // so recreate the image file and load it in the image aian







     // Delete the temporary files







Load and Save

[idh_iwpmemo_savepageasmetafile.htm]    Copyright © 2007 by WPCubed GmbH