Writing and Reading Multipage Files (JavaScript)
Take the following steps to create a multipage file, then load and display the images from the file. Only TIFF (MPT) and PCX (DCX) formats support multipage files:
1. |
Start with the project that you created in Loading and Displaying an Image. |
2. |
Add the following code between the <BODY> </BODY> tags to add another Raster IO object and Raster View control: |
<OBJECT ID="RasterIO2" NAME="RasterIO2"
CLASSID="CLSID:0014070E-B1BA-11CE-ABC6-F5B2E79D9E3F"
CODEBASE="path to CAB file/Ltrio14n.cab">
<P>This is not supported in web browser.</P>
</OBJECT><BR>
<OBJECT ID="LEADRasterView2" NAME="LEADRasterView2"
CLASSID="CLSID:00140708-B1BA-11CE-ABC6-F5B2E79D9E3F"
CODEBASE="path to CAB file/Ltrvw14n.cab"
ALIGN="baseline"
BORDER="0"
WIDTH="50%"
HEIGHT="90%">
<P>This is not supported in the web browser.</P>
</OBJECT><BR>
3. |
Modify the LoadImage() function as follows: |
var FILE_TIF = 3;
var SAVE_OVERWRITE = 0;
var SAVE_APPEND = 1;
//Load the bitmaps. These hard-coded path names may be different on your system.
RasterIO1.Load(LEADRasterView1.Raster, "i:\\a\\pic\\20020816demo2.jpg", 0, 0, 1);
RasterIO2.Load(LEADRasterView2.Raster, "i:\\a\\pic\\20020816demo3.jpg", 0, 0, 1);
//Save the bitmaps to a single multipage TIFF file
RasterIO1.Save(LEADRasterView1.Raster, "c:\\combined.tif", FILE_TIF, 24, 0, SAVE_OVERWRITE);
RasterIO2.Save(LEADRasterView2.Raster, "c:\\combined.tif", FILE_TIF, 24, 0, SAVE_APPEND);
//Load the bitmaps from the multipage TIFF file
RasterIO1.Load(LEADRasterView1.Raster, "c:\\combined.tif", 24, 1, 1);
RasterIO2.Load(LEADRasterView2.Raster, "c:\\combined.tif", 24, 2, 1);
4. |
Run your page to test it. |