GetPageAsBitmap |
[Top] [Chapter] [Previous] [Next] |
Declaration int GetPageAsBitmap( int PageNr; string filename; int Xres; int Yres; int Mode); Description
This API controls the RTF to Bitmap conversion of TextDynamic. It is possible to save certain pages as BMP or PNG files.
There is also the option to export to multipage TIFF files - with TextDynamic this requires the "Premium" or "Server" License, with wRTF2PDF TextDynamic Server it requires "Server" License!
Usually this method is used to create monochrome TIFF files for storage and fax. Those files can also be dithered, to make colored text and images better visible.
Note: When the operation fails a negative value is returned.
Parameters:
PageNr - an Integer. This is the page which should be exported.
filename - a string. The name of the fiel which should be created. (In TIFF mode it has to be "last" when the last page was added)
Xres, Yres - two integers. The resolution for the created bitmap.
Mode - a bitfield.
The first 4 bits are reserved to store the bit depth. Currently only 1 and 24 are supported
the next bits select the export mode
A) - Format Selection 256 - select PNG format 512 - select TIFF format (requires special license). Create a new file if the filename is <> "". Otherwise add a new page. otherwise a BMP filer is written
B) Options for TIFFS 1024 - used with TIFF, close the open TIFF file. You can also pass "last" as filename with Options = 0 . 2048 - used for monochrome TIFF files only. Switch on dithering. (new in V1.61)
C) Rendering options 4096 - also display selection 8192 - do not print watermarks 16384 - do not print header and footer 32768 - do not print images 65536 - display grid lines for tables
Example - Create multipage TIFF file:
IWPMemo Memo = wpdllInt1.Memo;
// Open Tiff (Mode=512). Bit depth=1 Memo.GetPageAsBitmap(0, "c:\\rtftotiff.tif", 300, 300, 512+1);
// add all pages (convert until result is negative), select dithering (Mode 2048) int i = 0; while (Memo.GetPageAsBitmap(i, "", 300, 300, 512+2048+1)>0) i++;
// Close the file Memo.GetPageAsBitmap(0, "last", 300, 300, 1024);
|