SavePageAsMetafile Method

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

Declaration

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

Description

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

 

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

 

Parameters:

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

 

Example:

// 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";

 try

 {

     // Format the text, othewise SavePageAsMetafile does not work

     Memo.ReformatAll(true,false);

     // save this page as image

     Memo.SavePageAsMetafile(0,emf_tempfile,8,0);

     // and insert it here

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

     TextCursor.InputImage(emf_tempfile,0);

     Memo.CurrObj.Frame = 1;

     // Scale to 30 % of the original size

     Memo.CurrObj.ScaleSize(0,0,30);

 

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

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

     Memo.ReformatAll(false,false);

     Memo.SavePageAsMetafile(0,emf_tempfile,8,0);

     Memo.CurrObj.Contents_LoadFromFile(emf_tempfile);

 }

 finally

 {

     // Delete the temporary files

     System.IO.File.Delete(emf_tempfile);

     System.IO.File.Delete(tempfile);

 }

image_in_Image

 

Category

Load and Save


[idh_iwpmemo_savepageasmetafile.htm]    Copyright © 2007 by WPCubed GmbH