Command IDs 21-27 Export Pages as BMP, PNG and TIFF.

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

New:

 

We added the new API Memo.GetPageAsBitmap which handles this functionality.

 

So this commands are obsolete.

 

TextDynamic is able to export certain pages into bitmap files. With the premium or server license it even allows the export into a multipage TIFF file!

 

Note: Please call Memo.ReformatAll(false,false) if the editor was dynamically created.

 

Commands to control the bitmap export:

 

21: Set the export resolution to the value of param. The default is 200 dpi. Please avoid too large values if you war exporting color images. The memory consumption of the working bitmap is huge. (The string parameter is ignored)

 

If you need different resolutions for X and Y values, please multiply the Y resolution with 10000 and add it:

 

 wpdllInt1.Memo.TextCommandStr(24, XResolution + YResolution * 10000"");

 

22: Select the bit count. param=1 select monochrome (=default), param=2 selects 24 bit color. (The string parameter is ignored)

 

Note: when exporting monochrome images colored text will be rendered black, shading will be ignored unless dithering mode is selected.

 

The string parameter can be used to select additional options. Please pass a number, for example "1024". It will be interpreted as bitfield

4: draw a page frame

8: show the selection

32: do not display watermarks

64: don't print header and footer

128: don't export images

256: display gridlines for tables

512: export metafiles as bitmaps

1024: for monochrom bitmaps: select dither mode

 

23: Export one page to a BMP file. param=page number (0..), the string param is the filename

 

24: Export one page to a PNG file. param=page number (0..), the string param is the filename

 

      private void button1_Click1(object sender, System.EventArgs e)

      {

         wpdllInt1.Memo.TextCommandStr(240, @"c:\Page_one.png");

      }

 

TIFF Export:

 

TextDynamic: requires "Premium" or "Server" License!

wRTF2PDF TextDynamic Server: requires "Server" License!

 

25: Start a new TIFF file - the string parameter contains the file name. Result = "OK" if successful, otherwise an error message.

 

26: Closes the current TIFF file. If successful, the page count is returned.

 

27: Exports one page in the current TIFF file. If successful "OK" is returned. Otherwise the result string is empty or an error message. It uses the parameters defined with the commands 21 and 22. By default the resolution is 200 dpi, monochrome.

 

This example exports the complete document into a single TIFF file.

 

      private void button1_Click1(object sender, System.EventArgs e)

      {

            if ( wpdllInt1.Memo.TextCommandStr(250, @"c:\multipage.tif")=="OK" )

            {

                     for(int i=0;

                         wpdllInt1.Memo.TextCommandStr(27, i, "")=="OK";

                         i++);

 

                      MessageBox.Show(

                         wpdllInt1.Memo.TextCommandStr(260"") + " page(s) were exported");     

            };

      }

 

Note: It is possible to load a different document and export pages into the already opened TIFF file.

 

 


[rtf_to_tiff__and__html_to_tiff.htm]    Copyright © 2007 by WPCubed GmbH