RasterMaster® SDK RasterMaster® for the Java™ Platform V13.7 Programmer’s Reference Guide
Note: An online version of this manual contains information on the latest updates to RasterMaster. To find the most recent version of this manual, please visit the online version at www.rastermaster.com or download the most recent version from our website at www.snowbound.com/support/manuals.html.
DOC-0141-06 Copyright Information
While Snowbound® Software believes the information included in this publication is correct as of the publication date, information in this document is subject to change without notice. UNLESS EXPRESSLY SET FORTH IN A WRITTEN AGREEMENT SIGNED BY AN AUTHORIZED REPRESENTATIVE OF SNOWBOUND SOFTWARE CORPORATION MAKES NO WARRANTY OR REPRESENTATION OF ANY KIND WITH RESPECT TO THE INFORMATION CONTAINED HEREIN, INCLUDING WARRANTY OF MERCHANTABILITY AND FITNESS FOR A PURPOSE. Snowbound Software Corporation assumes no responsibility or obligation of any kind for any errors contained herein or in connection with the furnishing, performance, or use of this document. Software described in Snowbound documents (a) is the property of Snowbound Software Corporation or the third party, (b) isfurnished only under license, and (c) may be copied or used only as expressly permitted under the terms of the license. All contents of this manual are copyrighted by Snowbound Software Corporation. The information contained herein is the exclusive property of Snowbound Software Corporation and shall not be copied, transferred, photocopied, translated on paper, film, electronic media, or computer-readable form, or otherwise reproduced in any way, without the express written permission of Snowbound Software Corporation. Microsoft, MS, MS-DOS, Windows, Windows NT, and SQL Server are either trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Adobe, the Adobe logo, Acrobat, and the Acrobat logo are trademarks of Adobe Systems Incorporated. Sun, Sun Microsystems, the Sun Logo, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. iText, the Initial Developers of the Original Code are Bruno Lowagie and Paolo Soares. Portions created by Bruno Lowagie are Copyright (C) 1999-2009 by Bruno Lowagie. Kakadu JPEG2000©, is copyrighted by Dr. David Taubman, and is proprietary to NewSouth Innovations, Pty. Ltd, Australia. Aspose™, Aspose.Cells© (copyrighted 2003), Aspose.Words© (copyrighted 2003), and Aspose.Slides© (copyrighted 2004), are all proprietary to Aspose Software, Pty. Ltd, Australia. United States Government Restricted Rights The Software is provided with RESTRICTED RIGHTS. Use, duplication or disclosure by the United States Government is subject to restrictions as set forth under subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause of DFARS 252.227 –19 or subparagraphs (c)(i) and (2) of the Commercial Computer Software-Restricted Rights at 48 CFR 52.227 – 19 as applicable. The Manufacturer is Snowbound Software Corporation, 309 Waverley Oaks Rd., Suite 401, Waltham, MA 02452, USA. All other trademarks and registered trademarks are the property of their respective holders. Manual Title: Snowbound RasterMaster® Imaging SDK for the Java Platform Programmer’s Reference Guide Part Number: DOC-0141-06 Revision: 06 RasterMaster® for the Java™ Platform Release Number: 13.7 RasterMaster® SDK Release Number: 13.7 Printing Date: January 2014 Published by Snowbound Software Corporation. 309 Waverley Oaks Road Suite 401 Waltham, MA 02452 USA phone: 617-607-2000 fax: 617-607-2002 ©1996 - 2014 by Snowbound Software Corporation. All rights reserved. Table of Contents
Chapter 1 - Quick Start 44
Quickly Getting Started with the Convert Sample 44
Viewing Demos Packaged with the Library 45
Adding RasterMaster Java’s Snowbnd Class to Your Application 46
System Overview 47
Version 13.7 Additions and Improvements 49
Chapter 2 - RasterMaster Java Samples 50
Overview of the Java Samples 50
Running a Sample 50
Running a Sample from the Command Prompt 51
Conversion between Document Formats 51
Simple Conversion: The SimpleConvert Sample 51
Optional Methods 52
Batch Conversion: The BatchConvert Sample 53
Single Conversion: The SingleConversion Sample 54
Simple Conversion with Timeouts: The HangDetector Sample 55
Saving to Searchable PDF: The saveSearchablePDF Sample 56
Printing 56
The Printing Sample 56
The SilentPrint Sample 57
Image Manipulation 57
The Thumbnails Sample 57
iii Watermarks and Redaction: The Watermarks Sample 58
The Manipulation Sample 58
The Color Detection Sample 58
The Save Page to Memory Sample 59
Viewing and Annotating Documents 59
The Viewing and Annotations Sample 59
Working with Vector PDF vs. Raster PDF: The VectorPDF Sample 63
The VectorPDFPageManipulation Sample 63
Scanning 63
The Scanning Sample 63
Chapter 3 - Convert and Save Methods 65
Converting File Formats 65
Automatically Detecting File Formats 65
Supported Pixel Depths 65
Converting Up 8 or 24-bit Pixel Depths 66
File Format Conversion Error Messages 66
Extracting Text 66
Methods Used for File Format Conversion 66
Optional Methods 67
IMG_create_thumbnail(int, int) 68
IMG_decompress_bitmap(String, int) 68
IMG_decompress_bitmap(java.awt.Image, int) 70
IMG_decompress_bitmap(java.io.DataInputStream, int) 70
IMG_decompress_bitmap_fd(String, int, int) 72
iv IMG_decompress_bitmap_stream(String, int) 72
IMG_decompress_bitmap_stream_onthefly(String, int, java.awt.Container) 72
IMG_decompress_fax(java.lang.String, int, int, int, int, int) 73
IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int) 74
IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container) 75
IMG_save_bitmap(byte, int) 76
IMG_save_bitmap(byte, int, int, int) 77
IMG_save_bitmap(int, int, int, int) 78
IMG_save_bitmap(String, int) 79
IMG_save_document(String, byte, int) 80
IMG_save_document(byte, byte, int) 81
IMGLOW_write_tiff_stream(Dib_Head lpbi, byte, int, int, String) 81
Chapter 4 - Input Documents and Images 83
Determining the Document's Format and its Capabilities 83
getInstance() 83
getAvailibleSaveFormats(int) 83
getAvailibleSaveFormats(String) 84
getFormat(int) 84
getFormat(String) 84
getFormatCode(String) 84
getFormatExtension(int) 85
getFormatExtension(String) 85
getFormatName(String) 85
v isValidMultiFormat(int) 86
isValidMultiFormat(String) 86
isVectorFormat(int) 86
Methods Called from the Format Class 87
canSaveBitDepth(int) 87
getDisplayName() 87
getExtension() 87
getFormatCode() 87
getFormatName() 87
isMultipage() 88
isTiff() 88
isVectorFormat() 88
toString() 88
getErrorMessage(int) 88
Working with Document File Formats 89
IMGLOW_set_document_input(int dpi, int bits_pix, int format); 89
IMGLOW_set_pdf_output(int xsize,int ysize); 90
Working with Color Images 90
Reading Multiple Pages 90
Supported Multi-page Formats 90
Decompressing a Multi-page Image 91
Determining Multi-page Page Count 91
Extracting Text for Searchable PDF output 91
Methods Used for Save Searchable PDF 92
vi Working with RasterMaster Java’s Vector Display Technology 92
Information about ’s Vector Display Technology 93
Implementing ’s Vector Display Technology 93
Methods Used for Vector PDF 93
PDF Redaction Support 94
IMGLOW_redact_page(String, String, rarray, int , int) 94
IMGLOW_redact_page(DataInputStream, rarray, int, int) 95
AFP Specific Considerations 96
Format of Font Mapping Data 96
IMGLOW_set_fontmap_path(String) 97
IMGLOW_set_fontmap(byte[], int) 97
IMGLOW_set_overlay_path(String) 98
PDF Specific Considerations 99
Reading or Decompressing a PDF Document 99
Saving to a PDF Document 99
Changing Output Page Size 100
Performance 100
Office 2007 - 2010 Specific Considerations 100
IMGLOW_get_ooxml_license_path() 100
IMGLOW_set_ooxml_license() 101
IMGLOW_set_ooxml_license_input_stream(InputStream) 102
Ensuring Java Reading for Text-based Formats 102
Overview 102
Chapter 5 - Output Documents and Images 104
vii Image Compression 104
Preferred Formats 104
24-Bit Color Images 104
8-Bit Gray Scale Images 104
1-bit Bi-Level Images 104
Saving to a Raster Image Format 104
IMG_save_bitmap(byte, int) 104
IMG_save_bitmap(byte, int, int, int) 105
IMG_save_bitmap(int, int, int, int) 106
IMG_save_bitmap(String, int) 107
Saving to a Vector Format - Searchable PDF 108
IMG_save_document(String, byte, int) 108
IMG_save_document(byte, byte, int) 109
Saving to Multiple Pages 110
Multi-page Images 110
Supported Multi-page Formats 110
Decompressing a Multi-page Image 110
Determining Multi-page Page Count 110
Saving Multi-page File Formats 110
Methods Used for Multi-page Format Methods 111
RasterMaster® SDK Library 111
Changing the DPI in the RasterMaster® SDKLibrary 111
Chapter 6 - RasterMaster® SDK Image Data Format 113
Overview of Data Formats 113
viii MS_Windows DIB Header Format 113
MS_Windows DIB Palette Format 114
MS_Windows DIB Image Data Format 114
RasterMaster® SDK Library 115
Changing the DPI in the RasterMaster® SDK Library 116
Chapter 7 - Snowbound Classes 117
Snow.Snowbnd 117
alias 117
alias_quality 117
decomp_vect 118
dis_crop_xs, dis_crop_ys, dis_crop_xe, dis_crop_ye 118
dis_dib 119
dis_height, dis_width 119
dis_rotate 119
dis_runs_ptrs[] [] 120
dis_xs, dis_ys, dis_xsize, dis_ysize 120
hsb, vsb 121
PrintStack 121
threshold 121
VERSION_MAJOR 121
VERSION_MAJOR 121
Snow.SnowAnn 122
Snow.Defines 124
Snow.ANN_GRAPHIC_STRUCT 124
ix Constructing a New SnowAnn Object 125
Snow.SANN_POINT 126
Snow.SANN_RECT 126
SnbdWarningCode 127
public boolean hasWarnings() 127
public Vector getWarningCodes() 127
public String getWarningMessage(int Index) 127
public int getWarningCode(int Index) 128
Chapter 8 - Improving Performance or Quality 129
Improving Performance 129
Improving Quality 129
Chapter 9 - Image Information Methods 131
getBitsPerPixel(void) 131
getCropboxX(void) 131
getCropboxY(void) 131
get_fit_to_height() 132
get_fit_to_width() 132
getHeight(void) 133
getInitialZoom(int, int) 133
getWidth(void) 134
getXdpi(void) 134
getYdpi(void) 135
IMG_get_bitmap_block(int, int, int, int) 135
IMG_get_deskew_angle(int[], int, int) 136
x IMG_get_version(int[], int[]) 137
IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char) 137
IMGLOW_extract_page(String, int, int) 139
IMGLOW_extract_page(java.io.DataInputStream, int, int) 139
IMGLOW_extract_text(String, int, int, int) 140
IMGLOW_get_bitmap_date() 142
IMGLOW_get_bitmap_name() 142
IMGLOW_get_brightness() 143
IMGLOW_get_contrast() 143
IMGLOW_get_fileinfo(java.io.DataInputStream, int) 143
IMGLOW_get_filetype(String) 144
IMGLOW_get_filetype(java.io.DataInputStream) 144
IMGLOW_get_gamma() 145
IMGLOW_get_image_orientation(void) 145
IMGLOW_get_pages(java.io.DataInputStream) 146
IMGLOW_get_pages(String) 146
IMGLOW_get_raster(int, byte[]) 147
IMGLOW_get_tiff_tag(int, int, int[], java.io.DataInputStream, byte[], int)IMGLOW_ get_tiff_tag(int, int, int[], String, byte[], int) 148
IMGLOW_get_warnings() 149
IMGLOW_search_text(byte[], String, int, int, int[]) 150
internal_extract_text(SnbdFileio, int, int, int) 151
Chapter 10 - Color Manipulation Methods 153
IMG_antique_effect(void) 153
xi IMG_color_gray(void) 153
IMG_deskew_bitmap(int) 154
IMG_despeckle_bitmap(int) 155
IMGLOW_detect_color() 155
IMG_diffusion_mono(void) 157
IMG_histogram_equalize() 157
IMG_invert_bitmap(void) 158
IMG_promote_8(void) 158
IMG_promote_24(void) 159
IMG_remove_red_eye(int, int, int, int) 159
IMG_rgb_to_cmyk(void) 160
IMG_sharpen_bitmap(int) 160
IMG_thresh_mono(int) 161
Chapter 11 - Photo Editing Methods 162
IMG_antique_effect(void) 162
IMG_auto_crop_bitmap(int, int) 162
IMG_despeckle_bitmap(int) 163
IMG_erase_rect(int, int, int, int, int, int, int) 164
IMG_flip_bitmapx(void) 165
IMG_flip_bitmapy(void) 165
IMG_histogram_equalize() 166
IMG_remove_red_eye(int, int, int, int) 166
IMG_resize_bitmap(int, int) 166
IMG_resize_bitmap_bicubic(int, int) 168
xii IMG_rotate_bitmap(int) 169
IMG_sharpen_bitmap(int) 169
IMGLOW_detect_color() 170
Chapter 12 - Image Display Methods 172
display_angle(int) 172
finalize(void) 172
fit_to_height(int) 173
fit_to_width(int) 173
IMG_auto_crop_bitmap(int, int) 174
IMG_auto_orient(Snow.Snowbnd, int) 174
IMG_display_bitmap(java.awt.Graphics, int, int, int, int) 175
IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) 176
IMG_display_bitmap_smooth(java.awt.Graphics, java.awt.Container, int, int, int, int, int) 177
IMG_erase_rect(int, int, int, int, int, int, int) 179
IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[]) 180
IMG_flip_bitmapx(void) 181
IMG_flip_bitmapy(void) 181
IMG_resize_bitmap(int, int) 182
IMG_resize_bitmap_bicubic(int, int) 183
IMG_resize_to_gray(int, int) 184
IMG_rotate_bitmap(int) 185
IMG_scroll_bitmap(java.awt.Container, java.awt.Event) 185
IMG_set_croprect(int, int, int, int) 187
xiii IMG_shift_bitmap(int, int) 187
IMG_window_level(int, int, int) 188
IMGLOW_put_raster(int, byte[]) 189
IMGLOW_set_alias(int) 189
IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, String, int, double) 190
IMGLOW_set_brightness(int) 191
IMGLOW_set_contrast(int) 192
IMGLOW_set_decompsize(int, int) 193
IMGLOW_set_decomp_rect(int, int, int, int) 193
IMGLOW_set_image_orientation(int) 194
IMGLOW_set_pdf_flags(int) 195
IMGLOW_set_pdf_output(int, int) 195
map_image_to_wnd(java.awt.Container, java.awt.Point) 195
map_wnd_to_image(java.awt.Container, java.awt.Point) 196
set_croprect(int, int, int, int) 196
set_croprect_scroll(java.awt.Container, int, int, int, int, int) 197
setFrame(java.awt.Container) 198
Chapter 13 - Image Quality Manipulation 200
IMGLOW_set_comp_quality(int) 200
IMGLOW_set_document_input(int, int, int) 200
IMGLOW_set_document_input(int, int, int, int, int) 202
IMGLOW_set_gamma(int) 203
IMGLOW_set_jpg_interleave(int, int) 204
xiv IIMGLOW_set_pcl_input(int, int) 205
IMGLOW_set_pdf_fontpath(String) 205
IMGLOW_set_pdf_input(int, int) 205
setXdpi(int) 206
setYdpi(int) 207
Chapter 14 - Page Manipulation Functionality and Methods 208
Page Manipulation Functionality 208
IMG_decompress_bitmap(String, int) 209
IMG_rotate_bitmap(int) 210
IMG_save_bitmap(int, int, int, int) 211
IMGLOW_append_page(DataInputStream, byte[], int) 212
IMGLOW_append_page(String, byte, int) 213
IMGLOW_delete_page(String, int, int) 213
IMGLOW_delete_page(DataInputStream, int, int) 214
IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char) 214
IMGLOW_extract_page(java.io.DataInputStream, int, int) 216
IMGLOW_extract_page(String, int, int) 216
IMGLOW_get_pages(java.io.DataInputStream) 217
IMGLOW_get_pages(String) 218
Chapter 15 - Miscellaneous Methods 219
IIMG_merge_block(Snow.Snowbnd, int, int, int) 219
IMGLOW_append_page(DataInputStream, byte[], int) 220
IMGLOW_append_page(String, byte[], int) 220
IMGLOW_set_bitmap_name(String, String) 221
xv IMGLOW_set_fast_convert(int, int) 222
IMGLOW_set_msg_render_preference(int) 222
IMGLOW_set_third_party_use(int, boolean) 223
IMGLOW_set_tiff_tag(int, int, int, byte[]) 223
IMGLOW_set_UTF_8(int) 224
Chapter 16 - Printing Images 226
Printing Overview 226
Printing Methods 226
Normal Printing 226
Printing Image Loaded into an Applet 227
IMG_print_applet(java.awt.Container, int) 227
Printing High-resolution Multi-page Documents 228
IMG_print_applet_pages(java.awt.Container, int) 228
Methods Used for Printing 229
Methods Used for Silent Printing 230
Printing Large Documents 230
Servers 230
Clients 230
Solution 230
Chapter 17 - Annotations for RasterMaster Java 232
Overview of Annotations for the Java™ Platform 232
Annotation Classes for the Java™ Platform 232
Snow.SnowAnn Fields 233
Snow.SnowAnn 235
xvi ann_dblclick(java.awt.Container, int, int) 236
GetClientRect(java.awt.Container, Snow.SANN_RECT) 236 read_xml_file(SnbdFileio fd, int page) 237 resize_object(ANN_GRAPHIC_STRUCT fcs, SANN_RECT rc) 237
SANN_activate_all_objects(void) 238
SANN_activate_object(java.awt.Container, int) 238
SANN_add_object(int, Snow.SANN_RECT, byte[], Snow.SANN_POINT[], int) 239
SANN_deactivate_all_objects(void) 240
SANN_deactivate_object(int) 240
SANN_delete_object(int) 241
SANN_display_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int)242
SANN_draw_object(java.awt.Graphics, int, int, int, int, int) 243
SANN_flipx(void) 244
SANN_flipy(void) 244
SANN_get_croprect(Snow.SANN_RECT) 244
SANN_get_graphic_struct(int) 245
SANN_get_object_bounds(int, Snow.SANN_RECT) 245
SANN_get_object_data(int, byte[]) 245
SANN_get_object_info(int) 246
SANN_get_object_num(java.awt.Container, int, int) 246
SANN_highlight_object(java.awt.Container, Snow.SANN_RECT, int) 247
SANN_map_image_to_wnd(java.awt.Container, java.awt.Point) 247
SANN_map_wnd_to_image(java.awt.Container, java.awt.Point) 248
SANN_merge_annotations(Snowbnd, java.awt.Container) 248
xvii SANN_move_object(int, Snow.SANN_RECT) 249
SANN_output_pdf(double, double, double, doublet, int, in) 250
SANN_print_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int) 250
SANN_read_ann(DataInputStream, int) 251
SANN_read_ann(String) 251
SANN_read_ann(String, int) 252
SANN_read_ann_stream(String, int) 252
SANN_recalc_size(int, int) 253
SANN_resize_object(int, Snow.SANN_RECT) 253
SANN_rotate(int) 254
SANN_set_bcolor(int, int, int) 254
SANN_set_croprect(int, int, int, int) 255
SANN_set_fcolor(int, int, int) 255
SANN_set_font(String, int, int, int) 256
SANN_set_line_style(int) 256
SANN_set_line_width(int) 257
SANN_set_scrollbars(int) 257
SANN_set_size(int, int) 258
SANN_write_ann(byte[], int, byte[]) 258
SANN_write_ann(String, int, byte[]) 258
SANN_write_ann_fnx(String, String, int, byte[]) 259
SANN_write_ann_idm(String, String, String, int) 260
SANN_write_ann_idm(String, String, int, int) 260
SANN_write_ann_pages(String, int, byte[]) 261
xviii SANN_write_ann_pages(byte[], int, byte[]) 261
SANN_write_ann_xml(byte[], Snow.SnowXMLWriter) 262
SANN_write_ann_xml_document(Snow.SnowXMLWriter) 263
SANN_write_ann_xml_page(Snow.SnowXMLWriter) 263
ui_delete(java.awt.Container) 264
ui_exit(void) 264
ui_rotate_object(java.awt.Container) 264
ui_startmove(java.awt.Container) 265
ui_startresize(java.awt.Container) 265
ui_wm_lbuttondown(java.awt.Container, int, int, byte[]) 266
ui_wm_lbuttonup(java.awt.Container, int, int, byte[]) 267
ui_wm_mousemove(java.awt.Container, int, int, byte) 267
xml_boolean(byte) 268
xml_color(byte, short[], short[], short[]) 268
xml_convert(ANN_GRAPHIC_STRUCT,byte[], byte[], int, int, int, int, int) 269
xml_find_page(SnbdFileio fd, int page) 269
xml_inches_pixels(double) 270
xml_read(SnbdFileio fd, int page) 270
Overview of Built-In Annotation Editing 271
Using Built-In Annotation Editing 271
Adding New Objects 271
Moving Objects 272
Resizing Objects 272
Deleting Objects 273
xix Using Double Byte Characters with RasterMaster Java Annotations 273
Methods Used for Viewing and Annotations 273
Chapter 18 - Scanning 276
Using the Java Scanning Interface 276
Installing the scandll.dll 276
Using the scanInterface.class for JNI Declarations 276
Methods Used for Scanning 276
IMG_scan_acquire() 277
IMG_scan_acquire() 277
IMG_scan_acquire_feeder() 277
IMG_scan_feeder_close() 278
IMG_scan_open_source() 278
IMG_scan_get_source_list() 278
IMG_scan_pages() 279
IMG_scan_get_cap() 279
IMG_scan_set_cap() 280
IMG_scan_set_caps() 281
IMG_scan_setup() 281
IMG_get_scanned_image_bytes(int) 282
IMG_get_scanned_image(int) 282
Java Scanning Sample 282
Running the Sample 283
Chapter 19 - Class Snow.Snowbnd Methods 284
display_angle(int) 284
xx finalize(void) 284 fit_to_height(int) 285 fit_to_width(int) 285 getBitsPerPixel(void) 286 get_fit_to_height() 286 get_fit_to_width() 287 getHeight(void) 287 getInitialZoom(int, int) 287 getWidth(void) 288 getXdpi(void) 288 getYdpi(void) 288
IMG_antique_effect(void) 289
IMG_auto_crop_bitmap(int, int) 289
IMG_auto_orient(Snow.Snowbnd, int) 290
IMG_create_thumbnail(int, int) 290
IMG_decompress_bitmap(String, int) 291
IMG_decompress_bitmap(java.io.DataInputStream, int) 292
IMG_decompress_bitmap_fd(String, int, int) 294
IMG_decompress_bitmap_stream(String, int) 294
IMG_decompress_bitmap_stream_onthefly(String, int, java.awt.Container) 295
IMG_decompress_fax(java.lang.String, int, int, int, int, int) 295
IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int) 296
IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container) 297
xxi IMG_deskew_bitmap(int) 298
IMG_despeckle_bitmap(int) 299
IMG_display_bitmap(java.awt.Graphics, int, int, int, int) 299
IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) 300
IMG_display_bitmap_smooth(java.awt.Graphics, java.awt.Container, int, int, int, int, int) 302
IMG_erase_rect(int, int, int, int, int, int, int) 303
IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[]) 304
IMG_flip_bitmapx(void) 305
IMG_flip_bitmapy(void) 306
IMG_get_bitmap_block(int, int, int, int) 306
IMG_get_deskew_angle(int[], int, int) 307
IMG_get_version(int[], int[]) 308
IMG_histogram_equalize() 308
IMG_invert_bitmap(void) 309
IMG_merge_block(Snow.Snowbnd, int, int, int) 309
IMG_print_applet(java.awt.Container, int) 310
IMG_print_applet_pages(java.awt.Container, int) 311
IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int) 312
IMG_remove_red_eye(int, int, int, int) 313
IMG_resize_bitmap(int, int) 314
IMG_resize_bitmap_bicubic(int, int) 315
IMG_rotate_bitmap(int) 316
IMG_save_bitmap(byte, int) 317
xxii IMG_save_bitmap(byte, int, int, int) 318
IMG_save_bitmap(int, int, int, int) 318
IMG_save_bitmap(String, int) 320
IMG_save_document(String, byte, int) 321
IMG_save_document(byte, byte, int) 321
IMG_scroll_bitmap(java.awt.Container, java.awt.Event) 322
IMG_set_croprect(int, int, int, int) 323
IMG_sharpen_bitmap(int) 324
IMG_shift_bitmap(int, int) 325
IMG_window_level(int, int, int) 325
IMGLOW_append_page(String, byte, int) 326
IMGLOW_delete_page(String, int, int) 327
IMGLOW_delete_page(DataInputStream, int, int) 328
IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char) 328
IMGLOW_detect_color() 329
IMGLOW_extract_page(String, int, int) 331
IMGLOW_extract_page(java.io.DataInputStream, int, int) 331
IMGLOW_extract_text(String, int, int, int) 332
IMGLOW_get_bitmap_name() 334
IMGLOW_get_brightness() 335
IMGLOW_get_contrast() 335
IMGLOW_get_docx_license_filename() 335
IMGLOW_get_docx_license_path() 335
IMGLOW_get_fileinfo(java.io.DataInputStream, int) 336
xxiii IMGLOW_get_filetype(String) 336
IMGLOW_get_filetype(java.io.DataInputStream) 337
IMGLOW_get_gamma() 337
IMGLOW_get_image_orientation(void) 337
IMGLOW_get_pages(java.io.DataInputStream) 338
IMGLOW_get_pages(String) 339
IMGLOW_get_raster(int, byte[]) 339
IMGLOW_get_tiff_tag(int, int, int[], java.io.DataInputStream, byte[], int)IMGLOW_ get_tiff_tag(int, int, int[], String, byte[], int) 340
IMGLOW_get_warnings() 341
IMGLOW_put_raster(int, byte[]) 342
IMGLOW_redact_page(String, String, rarray, int , int) 342
IMGLOW_redact_page(DataInputStream, rarray, int, int) 343
IMGLOW_search_text(byte[], String, int, int, int[]) 344
IMGLOW_set_alias(int) 345
IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, String, int, double) 346
IMGLOW_set_bitmap_name(String, String) 347
IMGLOW_set_brightness(int) 348
IMGLOW_set_comp_quality(int) 348
IMGLOW_set_contrast(int) 349
IMGLOW_set_decompsize(int, int) 349
IMGLOW_set_decomp_rect(int, int, int, int) 350
IMGLOW_set_docx_license_filename(String) 351
IMGLOW_set_docx_license_path(String) 351
xxiv IMGLOW_set_document_input(int, int, int) 351
IMGLOW_set_document_input(int, int, int, int, int) 353
IMGLOW_set_fast_convert(int, int) 354
IMGLOW_set_gamma(int) 355
IMGLOW_set_image_orientation(int) 356
IMGLOW_set_jpg_interleave(int, int) 357
IMGLOW_set_msg_render_preference(int) 357
IMGLOW_set_overlay_path(String) 358
IMGLOW_set_pcl_input(int, int) 358
IMGLOW_set_pdf_input(int, int) 359
IMGLOW_set_pdf_output(int, int) 359
IMGLOW_set_tiff_tag(int, int, int, byte[]) 360
IMGLOW_set_UTF_8(int) 361
IMGLOW_write_tiff_stream(Dib_Head lpbi, byte, int, int, String) 361
map_image_to_wnd(java.awt.Container, java.awt.Point) 362
map_wnd_to_image(java.awt.Container, java.awt.Point) 362
set_croprect(int, int, int, int) 363
set_croprect_scroll(java.awt.Container, int, int, int, int, int) 363
setFrame(java.awt.Container) 365
setXdpi(int) 365
setYdpi(int) 366
Snowbnd(int, int, int) 366
Snowbnd(Snowbnd) 367
Appendix A - Supported File Formats 368
xxv Descriptions of Supported File Formats 369
File Type Constants Listed by File Type Number 381
Appendix B - Software Installation 384
Overview of the Installation Process 384
What to Expect When Installing an Evaluation Version 384
What to Expect in a Production Version 385
Installing the Production Version of RasterMaster Java 385
Installing the Software 385
Directory Structure 385
Installed Files 386
Documentation Directory Files 386
Images Directory Files 386
Marketing Directory Files 386
Samples Directory Files 386
Office 2007-2010 Directory Files 387
Snow.jar File 388
JWebEngine.jar File 389
Cmap-all.jar File 389
snowcommon.jar File 389
itext.jar File 389
license.jar File 389
Appendix C - TIFF Tags 390
Sources for Tag Specifications 390
Descriptions of Tags in Numerical Order 391
xxvi Appendix D - Snowbound Error Codes 417
Error Codes 417
General Error Define Values Retrieved from Status Property 420
General Status/Error Codes 420
Appendix E - Troubleshooting 422
Receiving an Error Code When Loading, Saving, or Converting a Document 422
Output Document Differs from Original Document 422
Output Document Displays Incorrect or Missing Characters 422
Output Document Has Much Larger File Size than the Original Document 422
Output Document Has Much Lower Quality than the Original Document 423
Identifying an Unknown File Format 424
Characters not Displaying Correctly with Smart Quotes in RTF and MS Word Documents 424
Receiving a -3 Corrupted File Error code 425
Overlapping Scrollbar Arrow 425
Overlay Resources Not Pulled into APF or MODCA Document 427
Searching for Text in a Snowbound Software Generated PDF 427
Yellow, Red or Other Light Colored Content Disappear When Converting to Black and White Output 427
Some TIFF_JPEG Files Produced By RasterMaster Java Do Not Open In Third Party Image Viewers 428
Converting Text to JPEG on Lower Resolution Screen 428
Getting a ClassNotFoundException Error 429
Getting Different Results When Using the Same Version of RasterMaster Java and the Same Document on Different Systems 429
xxvii List of Tables
Table 1.1: Available Application Demos 46
Table 1.2: Memory Requirements Based on Image Size 49
Table 3.1: IMG_create_thumbnail(int, int) Method Variables 68
Table 3.2: IMG_decompress_bitmap(String, int) Method Variables 69
Table 3.3: IMG_decompress_bitmap(java.awt.Image, int) Method Variables 70
Table 3.4: IMG_decompress_bitmap(java.io.DataInputStream, int) Method Variables 71
Table 3.5: IMG_decompress_bitmap_fd(String, int, int) Method Variables 72
Table 3.6: IMG_decompress_bitmap_stream(String, int) Method Variables 72
Table 3.7: IMG_decompress_bitmap_stream_onthefly(String, int, java.awt.Container) Method Variables 73
Table 3.8: IMG_decompress_fax(java.lang.String, int, int, int, int, int) Method Variables 74
Table 3.9: IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int) Method Variables 74
Table 3.10: IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container) Method Variables 75
Table 3.11: IMG_save_bitmap(byte, int) Method Variables 76
Table 3.12: IMG_save_bitmap(byte, int, int, int) Method Variables 77
Table 3.13: IMG_save_bitmap(int, int, int, int) Method Variables 79
Table 3.14: IMG_save_bitmap(String, int) Method Variables 80
Table 3.15: IMG_save_document(String, byte, int) Method Variables 80
Table 3.16: IMG_save_document(byte, byte, int) Method Variables 81
Table 3.17: IMGLOW_write_tiff_stream(Dib_Head lpbi, byte,int, int, String) Method Variables 81
Table 4.1: getAvailableSaveFormats(int) Method Variables 84
xxviii Table 4.2: getFormat(int) Method Variables 84
Table 4.3: getFormat(String) Method Variables 84
Table 4.4: getFormatCode(String) Method Variables 85
Table 4.5: getFormatExtension(int) Method Variables 85
Table 4.6: getFormatExtension(String) Method Variables 85
Table 4.7: getFormatName(String) Method Variables 86
Table 4.8: isValidMultiFormat(int) Method Variables 86
Table 4.9: isValidMultiFormat(String) Method Variables 86
Table 4.10: isVectorFormat(int) Method Variables 86
Table 4.11: canSaveBitDepth(int) Method Variables 87
Table 4.12: getErrorMessage(int) Method Variables 89
Table 4.13: IMGLOW_set_document_input Method Variables 89
Table 4.14: IMGLOW_set_pdf_output Method Variables 90
Table 4.15: Supported Multi-page Methods 91
Table 4.16: IMGLOW_redact_page Method Variables 94
Table 4.17: IMGLOW_redact_page Method Variables 95
Table 4.18: Description of a sample entry in the snbd_map.fnt file 96
Table 4.19: IMGLOW_set_fontmap_path(String) Method Variables 97
Table 4.20: IMGLOW_set_fontmap Method Variables 98
Table 4.21: IMGLOW_set_overlay_path(String) Method Variables 98
Table 4.22: IMGLOW_set_ooxml_license_input_stream(InputStream) Method Variables102
Table 5.1: IMG_save_bitmap(byte, int) Method Variables 105
Table 5.2: IMG_save_bitmap(byte, int, int, int) Method Variables 106
Table 5.3: IMG_save_bitmap(int, int, int, int) Method Variables 107
xxix Table 5.4: IMG_save_bitmap(String, int) Method Variables 108
Table 5.5: IMG_save_document(String, byte, int) Method Variables 109
Table 5.6: IMG_save_document(String, byte, int) Method Variables 109
Table 5.7: Supported Multi-page Methods 111
Table 6.1: MS_Windows DIB Palette Format 114
Table 6.2: MS_Windows DIB Image Data Format 115
Table 7.1: alias Settings 117
Table 7.2: alias_quality Settings 118
Table 7.3: decomp_vect Settings 118
Table 7.4: dis_crop_xs, dis_crop_ys, dis_crop_xe, and dis_crop_ye Fields 118
Table 7.5: dis_height and dis_width Fields 119
Table 7.6: dis_rotate Fields 120
Table 7.7: dis_xs, dis_ys, dis_xsize, and dis_ysize Fields 120
Table 7.8: threshold Settings 121
Table 7.9: ANN_GRAPHIC_STRUCT Class Variables 125
Table 7.10: SANN_POINT Class Variables 126
Table 7.11: SANN_RECT Class Variables 127
Table 7.12: List of Warnings 127
Table 7.13: getWarningMessage(int Index) Method Variables 127
Table 7.14: getWarningCode(int Index) Method Variables 128
Table 9.1: getInitialZoom(int, int) Method Variables 134
Table 9.2: Snow.Snowbnd IMG_get_bitmap_block(int, int, int, int)Method Variables 135
Table 9.3: IMG_get_deskew_angle(int[], int, int) Method Variables 136
Table 9.4: IMG_get_deskew_angle(int[], int, int) Method Variables 137
xxx Table 9.5: IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char) Method Variable 138
Table 9.6: IMGLOW_extract_page(String, int, int) Method Variables 139
Table 9.7: IMGLOW_extract_page(java.io.DataInputStream, int, int) Method Variables 139
Table 9.8: IMGLOW_extract_text(String, int, int, int) Method Variables 140
Table 9.9: Variables Included in Extracted Text 141
Table 9.10: IMGLOW_get_fileinfo(java.io.DataInputStream, int)Method Variables 144
Table 9.11: IMGLOW_get_filetype(String) Method Variables 144
Table 9.12: IMGLOW_get_filetype(java.io.DataInputStream) Method Variables 145
Table 9.13: IMGLOW_get_pages(java.io.DataInputStream) Method Variables 146
Table 9.14: IMGLOW_get_pages(String) Method Variables 147
Table 9.15: IMGLOW_get_raster(int, byte[]) Method Variables 148
Table 9.16: int IMGLOW_get_tiff_tag(int, int, int[],java.io.DataInputStream, byte[], int) and IMGLOW_get_tiff_tag(int, int, int[], String, byte[], int) Method Variables 149
Table 9.17: IMGLOW_search_text(byte[], String, int, int, int[]) Method Variables 151
Table 9.18: internal_extract_text(String, int, int, int) Method Variables 151
Table 10.1: IMG_deskew_bitmap(int) Method Variables 154
Table 10.2: IMG_despeckle_bitmap(int) Method Settings 155
Table 10.3: IMG_remove_red_eye(int, int, int, int) Method Variables 159
Table 10.4: IMG_sharpen_bitmap(int) Method Variables 160
Table 10.5: IMG_thresh_mono(int) Method Variables 161
Table 11.1: IMG_auto_crop_bitmap(int, int) Method Variables 163
Table 11.2: IMG_despeckle_bitmap(int) Method Settings 163
Table 11.3: IMG_erase_rect(int, int, int, int, int, int, int) Method Variables 164
Table 11.4: IMG_remove_red_eye(int, int, int, int) Method Variables 166
xxxi Table 11.5: IMG_resize_bitmap(int, int) Method Variables 168
Table 11.6: IMG_resize_bitmap_bicubic(int, int) Method Variables 168
Table 11.7: IMG_rotate_bitmap(int) Method Variables 169
Table 11.8: IMG_sharpen_bitmap(int) Method Variables 170
Table 12.1: display_angle(int) Method Settings 172
Table 12.2: fit_to_height(int) Method Variables 173
Table 12.3: fit_to_height(int) Method Variables 174
Table 12.4: IMG_auto_crop_bitmap(int, int) Method Variables 174
Table 12.5: IMG_auto_orient(Snow.Snowbnd, int)Method Variables 175
Table 12.6: IMG_display_bitmap(java.awt.Graphics, int, int, int, int) Method Variables 176
Table 12.7: IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) Method Variables 177
Table 12.8: IMG_display_bitmap_smooth(java.awt.Graphics, java.awt.Container, int, int, int, int, int) Method Variables 178
Table 12.9: IMG_erase_rect(int, int, int, int, int, int, int) Method Variables 180
Table 12.10: IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[]) Method Variables 181
Table 12.11: IMG_resize_bitmap(int, int) Method Variables 183
Table 12.12: IMG_resize_bitmap_bicubic(int, int) Method Variables 184
Table 12.13: IMG_resize_to_gray(int, int) Method Variables 184
Table 12.14: IMG_rotate_bitmap(int) Method Variables 185
Table 12.15: IMG_scroll_bitmap(java.awt.Container, java.awt.Event) Method Variables 186
Table 12.16: IMG_set_croprect(int, int, int, int) Method Variables 187
Table 12.17: IMG_shift_bitmap(int, int) Method Variables 188
Table 12.18: IMG_window_level(int, int, int) Method Variables 189
xxxii Table 12.19: IMGLOW_put_raster(int, byte[]) Method Variables 189
Table 12.20: IMGLOW_set_alias Function Variable 190
Table 12.21: IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int,int, int, int, boolean, boolean, String, int, double) Method Settings 191
Table 12.22: IMGLOW_set_brightness(int) Method Settings 192
Table 12.23: IMGLOW_set_contrast(int) Method Settings 192
Table 12.24: IMGLOW_set_decompsize(int, int) Method Settings 193
Table 12.25: IMGLOW_set_decomp_rect(int, int, int, int) Method Settings 194
Table 12.26: IMGLOW_set_image_orientation(int) Method Variables 194
Table 12.27: IMGLOW_set_pdf_flags(int) Method Variables 195
Table 12.28: IMGLOW_set_pdf_output(int, int) Method Variables 195
Table 12.29: map_image_to_wnd(java.awt.Container, java.awt.Point) Method Variables196
Table 12.30: map_wnd_to_image(java.awt.Container, java.awt.Point) Method Variables196
Table 12.31: set_croprect(int, int, int, int) Method Variables 197
Table 12.32: set_croprect_scroll(java.awt.Container, int, int, int, int, int) Method Variables 197
Table 12.33: setFrame(java.awt.Container) Method Variables 199
Table 13.1: IMGLOW_set_comp_quality(int) Method Variables 200
Table 13.2: IMGLOW_set_document_input(int, int, int) Method Settings 201
Table 13.3: IMGLOW_set_document_input(int, int, int, int, int) Method Settings 203
Table 13.4: IMGLOW_set_gamma(int) Method Settings 204
Table 13.5: IMGLOW_set_jpg_interleave(int, int) Method Variables 204
Table 13.6: IMGLOW_set_pcl_input(int dpi, int bit_pix) Method Variables 205
Table 13.7: IMGLOW_set_pdf_fontpath(String) Method Variables 205
Table 13.8: IMGLOW_set_pdf_fontpath(String) Method Variables 206
xxxiii Table 14.1: IMG_decompress_bitmap(String, int) Method Variables 209
Table 14.2: IMG_rotate_bitmap(int) Method Variables 210
Table 14.3: IMG_save_bitmap(int, int, int, int) Method Variables 212
Table 14.4: IMGLOW_append_page(String, byte[], int) Method Variables 212
Table 14.5: IMGLOW_append_page(String, byte, int) Method Settings 213
Table 14.6: IMGLOW_delete_page(String, int, int) Method Settings 214
Table 14.7: IMGLOW_delete_page(DataInputStream, int, int) Method Settings 214
Table 14.8: IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char) Method Variable 215
Table 14.9: IMGLOW_extract_page(java.io.DataInputStream, int, int) Method Variables 216
Table 14.10: IMGLOW_extract_page(String, int, int) Method Variables 217
Table 14.11: IMGLOW_get_pages(java.io.DataInputStream) Method Variables 217
Table 14.12: IMGLOW_get_pages(String) Method Variables 218
Table 15.1: IMG_merge_block(Snow.Snowbnd, int, int, int) Method Variables 219
Table 15.2: IMGLOW_append_page(String, byte[], int) Method Variables 220
Table 15.3: IMGLOW_append_page(String, byte[], int) Method Variables 221
Table 15.4: IMGLOW_set_bitmap_name(String, String) Method Settings 221
Table 15.5: IMGLOW_set_fast_convert(int, int) Method Variable 222
Table 15.6: IMGLOW_set_msg_render_preferences(int) Method Variables 223
Table 15.7: IMGLOW_set_third_party_use(int, boolean) Method Variable 223
Table 15.8: IMGLOW_set_tiff_tag(int, int, int, byte[]) Method Variables 224
Table 15.9: IMGLOW_set_UTF_8(int) Method Variables 225
Table 16.1: IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int) Method Variables 227
Table 16.2: IMG_print_applet(java.awt.Container, int) Method Variables 228
xxxiv Table 16.3: IMG_print_appiet_pages(java.awt.Container, int) Method Variables 229
Table 17.1: Snow.SnowANN Fields 233
Table 17.2: SnowAnn(int, int, int) Method Variables 236
Table 17.3: ann_dbclick(java.awt.Container, int, int) Method Variables 236
Table 17.4: GetClientRect(java.awt.Container, Snow.SANN_RECT) Method Variables 237
Table 17.5: read_xml_file(SnbdFileio, int) Method Variables 237
Table 17.6: read_xml_file(SnbdFileio fd, int page) Method Variables 238
Table 17.7: SANN_activate_object(java.awt.Container, int) Method Variables 239
Table 17.8: SANN_add_object(int, Snow.SANN_RECT, byte[], Snow.SANN_POINT[], int) Method Variables 239
Table 17.9: SANN_deactivate_object(int) Method Variables 241
Table 17.10: SANN_delete_object(int) Method Variables 242
Table 17.11: SANN_display_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int) Method Variables 243
Table 17.12: SANN_draw_object(java.awt.Graphics, int, int, int, int, int) Method Variables 243
Table 17.13: SANN_get_croprect(Snow.SANN_RECT) Method Variables 244
Table 17.14: SANN_get_graphic_struct(int) Method Variables 245
Table 17.15: SANN_get_object_bounds(int, Snow.SANN_RECT) Method Variables 245
Table 17.16: SANN_get_object_data(int, byte[]) Method Variables 246
Table 17.17: SANN_get_object_info(int) Method Variables 246
Table 17.18: SANN_get_object_num(java.awt.Container, int, int)Method Variables 247
Table 17.19: SANN_highlight_object(java.awt.Container, Snow.SANN_RECT, int) Method Variables 247
xxxv Table 17.20: SANN_map_image_to_wnd(java.awt.Container, java.awt.Point) Method Variables 248
Table 17.21: SANN_map_wnd_to_image(java.awt.Container, java.awt.Point)Method Variables 248
Table 17.22: SANN_merge_annotations(Snowbnd, java.awt.Container) Method Variables 249
Table 17.23: SANN_merge_annotations(Snowbnd, java.awt.Container) Method Variables 249
Table 17.24: SANN_output_pdf(java.awt.Graphics, java.awt.Container, int, int, int, int) Method Variables 250
Table 17.25: SANN_print_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int) Method Variables 250
Table 17.26: SANN_read_ann(DataInputStream, int) Method Variables 251
Table 17.27: SANN_read_ann(String) Method Variables 252
Table 17.28: SANN_read_ann(String, int) Method Variables 252
Table 17.29: SANN_read_ann_stream(String, int) Method Variables 252
Table 17.30: SANN_read_ann_stream(String, int) Method Variables 253
Table 17.31: SANN_resize_object(int, Snow.SANN_RECT) Method Variables 253
Table 17.32: SANN_rotate(int) Method Variables 254
Table 17.33: SANN_set_bcolor(int, int, int) Method Variables 254
Table 17.34: SANN_set_croprect(int, int, int, int) Method Variables 255
Table 17.35: SANN_set_fcolor(int, int, int) Method Variables 255
Table 17.36: SANN_set_font(String, int, int, int) Method Variables 256
Table 17.37: SANN_set_line_style(int) Method Variables 256
Table 17.38: SANN_set_line_width(int) Method Variables 257
Table 17.39: SANN_set_scrollbars Method Variables 257
xxxvi Table 17.40: SANN_set_size Method Variables 258
Table 17.41: SANN_write_ann(byte[], int, byte[]) Method Variables 258
Table 17.42: SANN_write_ann(String, int, byte[]) Method Variables 259
Table 17.43: SANN_write_ann_fnx(String, String, int, byte[]) Method Variable 260
Table 17.44: SANN_write_ann_idm(String, String, String, int) Method Variable 260
Table 17.45: SANN_write_ann_idm(String userName, String groupName, int page, int error[]) Method Variable 261
Table 17.46: SANN_write_ann_pages(String, int, byte[]) Method Variables 261
Table 17.47: SANN_write_ann_pages(byte[], int, byte[]) Method Variables 262
Table 17.48: SANN_write_ann_xml(byte[], Snow.SnowXMLWriter) Method Variable 262
Table 17.49: SANN_write_ann_xml_document(Snow.SnowXMLWriter) Method Variable 263
Table 17.50: SANN_write_ann_xml_page(Snow.SnowXMLWriter) Method Variable 263
Table 17.51: ui_delete(java.awt.Container) Method Variables 264
Table 17.52: ui_rotate_object(java.awt.Container) Method Variables 265
Table 17.53: ui_startmove(java.awt.Container) Method Variables 265
Table 17.54: ui_startresize(java.awt.Container) Method Variables 266
Table 17.55: ui_wm_lbuttondown(java.awt.Container, int, int, byte[]) Method Variables 266
Table 17.56: ui_wm_lbuttonup(java.awt.Container, int, int, byte[]) Method Variables 267
Table 17.57: ui_wm_lbuttonup(java.awt.Container, int, int, byte[]) Method Variables 268
Table 17.58: xml_boolean(byte[]) Method Variables 268
Table 17.59: xml_color(byte[], short[], short[], short[]) Method Variables 268
Table 17.60: XML_convert(ANN_GRAPHIC_STRUCT,byte[], byte[], int, int, int, int, int) Method Variables 269
Table 17.61: xml_find_page(SnbdFileio, int) Method Variables 270
xxxvii Table 17.62: xml_inches_pixels(double) Method Variables 270
Table 17.63: xml_read(SnbdFileio, byte[]. int, int) Method Variables 270
Table 17.64: Snow.SnowAnn Annotation Object Values 272
Table 17.65: Text and Post-it Objects 272
Table 18.1: IMG_scan_acquire Method Variables 277
Table 18.2: IMG_scan_acquire_feeder Method Variables 278
Table 18.3: IMG_scan_pages Method Variables 279
Table 18.4: IMG_scan_get_cap Method Variables 280
Table 18.5: IMG_scan_set_cap Method Variables 280
Table 18.6: IMG_scan_set_caps Method Variables 281
Table 18.7: IMG_get_scanned_image_bytes Method Variables 282
Table 18.8: IMG_get_scanned_image_bytes Method Variables 282
Table 19.1: display_angle(int) Method Settings 284
Table 19.2: fit_to_height(int) Method Variables 285
Table 19.3: fit_to_width(int) Method Settings 286
Table 19.4: getInitialZoom(int, int) Method Variables 288
Table 19.5: IMG_auto_crop_bitmap(int, int) Method Variables 289
Table 19.6: IMG_auto_orient(Snow.Snowbnd, int)Method Variables 290
Table 19.7: IMG_create_thumbnail(int, int) Method Variables 291
Table 19.8: IMG_decompress_bitmap(String, int) Method Variables 292
Table 19.9: IMG_decompress_bitmap(java.io.DataInputStream, int) Method Variables 293
Table 19.10: IMG_decompress_bitmap_fd(String, int, int) Method Variables 294
Table 19.11: IMG_decompress_bitmap_stream(String, int) Method Variables 294
xxxviii Table 19.12: IMG_decompress_bitmap_stream_onthefly(String, int, java.awt.Container) Method Variables 295
Table 19.13: IMG_decompress_fax(java.lang.String, int, int, int, int, int) Method Variables 296
Table 19.14: IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int) Method Variables 297
Table 19.15: IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container) Method Variables 298
Table 19.16: IMG_deskew_bitmap(int) Method Variables 298
Table 19.17: IMG_despeckel_bitmap(int) Method Settings 299
Table 19.18: IMG_display_bitmap(java.awt.Graphics, int, int, int, int) Method Variables 300
Table 19.19: IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) Method Variables 301
Table 19.20: IMG_display_bitmap_smooth(java.awt.Graphics, java.awt.Container, int, int, int, int, int) Method Variables 302
Table 19.21: IMG_erase_rect(int, int, int, int, int, int, int) Method Variables 304
Table 19.22: IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[]) Method Variables 305
Table 19.23: Snow.Snowbnd IMG_get_bitmap_block(int, int, int, int) Method Variables 306
Table 19.24: IMG_get_deskew_angle(int[], int, int) Method Variables 307
Table 19.25: IMG_get_ version(int[], int[]) Method Variables 308
Table 19.26: IMG_merge_block(Snow.Snowbnd, int, int, int) Method Variables 310
Table 19.27: IMG_print_applet(java.awt.Container, int) Method Variables 311
Table 19.28: IMG_print_appiet_pages(java.awt.Container, int) Method Variables 312
Table 19.29: IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int) Method Variables 313
Table 19.30: IMG_remove_red_eye(int, int, int, int) Method Variables 313
xxxix Table 19.31: IMG_resize_bitmap(int, int) Method Variables 315
Table 19.32: IMG_resize_bitmap_bicubic(int, int) Method Variables 315
Table 19.33: IMG_rotate_bitmap(int) Method Variables 316
Table 19.34: IMG_save_bitmap(byte, int) Method Variables 317
Table 19.35: IMG_save_bitmap(byte, int, int, int) Method Variables 318
Table 19.36: IMG_save_bitmap(int, int, int, int) Method Variables 319
Table 19.37: IMG_save_bitmap(String, int) Method Variables 320
Table 19.38: IMG_save_document(String, byte, int) Method Variables 321
Table 19.39: IMG_save_document(String, byte, int) Method Variables 322
Table 19.40: IMG_scroll_bitmap(java.awt.Container, java.awt.Event) Method Variables 323
Table 19.41: IMG_set_croprect(int, int, int, int) Method Variables 324
Table 19.42: IMG_sharpen_bitmap(int) Method Variables 324
Table 19.43: IMG_shift_bitmap(int, int) Method Variables 325
Table 19.44: IMG_window_level(int, int, int) Method Variables 326
Table 19.45: IMGLOW_append_page(String, byte, int) Method Variables 327
Table 19.46: IMGLOW_delete_page(String, int, int) Method Variables 327
Table 19.47: IMGLOW_delete_page(DataInputStream, int, int) Method Variables 328
Table 19.48: IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char) Method Variable 329
Table 19.49: IMGLOW_extract_page(String, int, int) Method Variables 331
Table 19.50: IMGLOW_extract_page(java.io.DataInputStream, int, int) Method Variables 332
Table 19.51: IMGLOW_extract_text(String, int, int, int) Method Variables 332
Table 19.52: Variables Included in Extracted Text 333
Table 19.53: IMGLOW_get_fileinfo(java.io.DataInputStream, int)Method Variables 336
xl Table 19.54: IMGLOW_get_filetype(String) Method Variables 336
Table 19.55: IMGLOW_get_filetype(java.io.DataInputStream) Method Variables 337
Table 19.56: IMGLOW_get_pages(java.io.DataInputStream) Method Variables Method Variables 338
Table 19.57: IMGLOW_get_pages(String) Method Variables 339
Table 19.58: IMGLOW_get_raster(int, byte[]) Method Variables 339
Table 19.59: int IMGLOW_get_tiff_tag(int, int, int[],java.io.DataInputStream, byte[], int) and IMGLOW_get_tiff_tag(int, int, int[], String, byte[], int) Method Variables 340
Table 19.60: IMGLOW_put_raster(int, byte[]) Method Variables 342
Table 19.61: IMGLOW_redact_page Method Variables 343
Table 19.62: IMGLOW_redact_page Method Variables 344
Table 19.63: IMGLOW_search_text(byte[], String, int, int, int[]) Method Variables 345
Table 19.64: IMGLOW_set_alias Function Variable 345
Table 19.65: IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int,int, int, int, boolean, boolean, String, int, double) Method Settings 346
Table 19.66: IMGLOW_set_bitmap_name(String, String) Method Settings 347
Table 19.67: IMGLOW_set_brightness(int) Method Settings 348
Table 19.68: IMGLOW_set_comp_quality(int) Method Variables 348
Table 19.69: IMGLOW_set_contrast(int) Method Settings 349
Table 19.70: IMGLOW_set_decompsize(int, int) Method Settings 350
Table 19.71: IMGLOW_set_decomp_rect(int, int, int, int) Method Settings 350
Table 19.72: IMGLOW_set_docx_license_filename(String) Method Settings 351
Table 19.73: IMGLOW_set_docx_license_path(String) Method Settings 351
Table 19.74: IMGLOW_set_document_input(int, int, int) Method Settings 352
Table 19.75: IMGLOW_set_document_input(int, int, int, int, int) Method Settings 354
xli Table 19.76: IMGLOW_set_fast_convert(int, int) Method Variable 355
Table 19.77: IMGLOW_set_gamma(int) Method Settings 355
Table 19.78: IMGLOW_set_image_orientation(int) Method Variables 356
Table 19.79: IMGLOW_set_jpg_interleave(int, int) Method Variables 357
Table 19.80: IMGLOW_set_msg_render_preferences(int) Method Variables 358
Table 19.81: IMGLOW_set_overlay_path(String) Method Variables 358
Table 19.82: IMGLOW_set_pcl_input(int dpi, int bit_pix) Method Variables 359
Table 19.83: IMGLOW_set_pdf_input(int, int) Method Variables 359
Table 19.84: IMGLOW_set_pdf_output(int, int) Method Variables 360
Table 19.85: IMGLOW_set_tiff_tag(int, int, int, byte[]) Method Variables 360
Table 19.86: IMGLOW_set_UTF_8(int) Method Variables 361
Table 19.87: IMGLOW_write_tiff_stream(Dib_Head lpbi, byte data_stream[],int data_ size, int file_type, String bm_name) Method Variables 361
Table 19.88: map_image_to_wnd(java.awt.Container, java.awt.Point) Method Variables362
Table 19.89: set_croprect(int, int, int, int) Method Variables 363
Table 19.90: set_croprect_scroll(java.awt.Container, int, int, int, int, int) Method Variables 364
Table 19.91: setFrame(java.awt.Container) method variable descriptions. 365
Table 19.92: Snowbnd(int, int, int) Method Variables 367
Table 19.93: Snowbnd(Snowbnd) Method Variables 367
Table A.1: File Format Key 368
Table A.2: Supported File Format Descriptions 369
Table A.3: File Type Constants listed by File Type Number 381
Table B.1: RasterMaster Java Documentation Directory Files 386
Table B.2: RasterMaster Java Marketing Directory Files 386
xlii Table B.3: RasterMaster Java Imaging SDK Samples Directory 387
Table C.1: TIFF Tags in Numerical Order1 391
Table D.1: Detailed Status/Error Codes 417
Table D.2: General Error Define Values Retrieved from Status Property 420
Table D.3: General Status/Error Codes 420
xliii Chapter 1 - Quick Start
Chapter 1 - Quick Start
This chapter describes how to quickly get started with the RasterMaster Java.
If you do not find the information that you are looking for in this manual, please open a support ticket at http://support.snowbound.com to request a specific sample, for clarification of a method description or to help you find the information you need. We are dedicated to helping our customers succeed and we are constantly enhancing our products based on feedback from customers like you.
Quickly Getting Started with the Convert Sample
The fastest way to get started is to run the Convert sample that is included with this product. The Convert sample converts any supported document type into the file format you request and then displays it. You can find the samples in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. For more information, please see RasterMaster Java Samples on how to find and run the Simple Conversion: The SimpleConvert Sample sample.
The Convert sample uses three routines that are at the heart of RasterMaster Java:
1. IMG_decompress_bitmap(String, int) - reads in a document in any format and converts it to a valid Snowbound image.
2. IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) - displays a valid Snowbound image.
3. IMG_save_bitmap(byte, int) - saves the valid Snowbound image to any available format.
The methods mentioned above are described in detail later in this manual. This manual also covers the following topics:
1. How to read and save multi-page documents. For more information, please see Decompressing a Multi-page Image.
2. How to adjust the color, compression, and resolution attributes of documents for performance, better quality output, or smaller output. For more information, please see Color Manipulation Methods.
3. How to extract text and search for text in documents. For more information, please see Input Documents and Images. Please note that Snowbound Software does not yet support OCR (Optical Character Recognition). Therefore, we can only extract text from documents that contain text. You can use RasterMaster Java in conjunction with OCR tools from other companies if you need to extract text from scanned document images.
44 Chapter 1 - Quick Start
We include a lot of code samples to help you get started. These samples are listed in RasterMaster Java Samples. We have also indexed our documentation and made it searchable to help you find what you need quickly.
If you have any questions please do not hesitate to open a support ticket at http://support.snowbound.com .
Viewing Demos Packaged with the Library
Follow the instructions below to run a sample:
Open any of the samples in your development environment. For example: Eclipse.
Add a reference to these two jar files: Snow.jar and snowbndcommon.jar.
Run the sample as a Java application or as an applet.
Running a Sample from the Command Prompt
Follow the instructions below to run a sample from the command prompt:
1. Make sure that the JDK (Java Development Kit) is installed on your system. If it is not, you can download the JDK for free from at http://www.oracle.com/technetwork/java/javase/downloads/index.html .
In the following examples, the JDK is installed at this location (Windows):
C:\Program Files\Java\jdk1.7.0\bin
2. Make sure that the code sample you want to run is in a directory name that matches the package name. In this example, RasterMaster Java was installed to c:\me. For example, the SingleConversion sample is in this directory: C:\me\com\snowbound\samples\convert
3. Follow the example below to change directory to be in the top-level directory, the directory above com. C:\> cd me C:\me>
4. Use the example below to compile the sample from the command line by running javac from the JDK: C:\me> "C:\Program Files\Java\jdk1.7.0\bin\javac" -classpath ".;.\com\snowbound\Snow.jar;.\com\snowbound\snowcommon.jar;C:\- Program Files\Java\jdk1.7.0\bin" .\com\snowbound\samples\convert\SingleConversion.java
5. Now run the sample from the command line and again from the top-level directory. Note that the slashes have changed to “.” in the name of the sample file: C:\me> java -cp ".;.\com\snowbound\Snow.jar;.\com\snowbound\snowcommon.jar"
45 Chapter 1 - Quick Start
com.snowbound.samples.convert.SingleConversion
Application Demos
Table 1-1 lists the available application demos. For more detailed information about the samples available in this SDK, see RasterMaster Java Samples.
Table 1.1: Available Application Demos
Application Demo To Run DemoApp.class Viewing and Annotations (\Samples\com\snowbound\samples\annapp). See The Viewing and Annotations Sample for more information. ConverterApp.class (\Samples\com\snowbound\samples\convert). See Convert Simple Conversion: The SimpleConvert Sample for more information. LoadAndSaveApp.class (\Samples\com\snowbound\samples\ Loadandsave loadandsave). See The Loadandsave Sample for more information. PrintingApp.class Printing (\Samples\com\snowbound\samples\printing). See The Printing Sample for more information. DemoSwingApp.class Swing (\Samples\com\snowbound\samples\Swing). See The Swing Sample for more information. ThumbnailsApp.class Thumbnails (\Samples\com\snowbound\samples\thumbnails). See The Thumbnails Sample for more information.
Adding RasterMaster Java’s Snowbnd Class to Your Application
All classes that are a part of RasterMaster Java are contained in the Snow package. Use the import statement to call the classes. import Snow.*; or import Snow.Snowbnd;
Placing Classes In The Classpath Directory
The Snow.jar containing the RasterMaster Javaclasses must be placed in a directory included in your CLASSPATH environment variable. If they are not in your CLASSPATH, or if your
46 Chapter 1 - Quick Start
CLASSPATH environment variable is not specified, you can add them with the statement below. SET CLASSPATH=C:\JAVA
Specifying the Classpath At Compile
You can also specify the classpath at compile and run time by passing in the CLASSPATH as a parameter to the virtual machine by using the statement below. c:\jdk1.5\bin\java -classpath c:\snowbound\; MySnowClass
Note: When using the CLASSPATH , specify the parent directory of the Snow.jar file. For example, if the Snowbound class files are located at c:\snowbound\Snow.jar, the classpath to the Snowbound classes is c:\snowbound.
Snowbound Image Object
The Snowbnd image object is the main API class in the Snowbound SDK, representing a single image and all of its related operations, such as decompress, pan, scroll, zoom, and others. Just place snow.jar into your CLASSPATH then add a Snowbnd image object to your application and then you will have easy access to RasterMaster Java’s ability to read, manipulate, display, and save images.
Constructing a New Snowbnd Object
To construct a new Snowbnd object, use the default constructor below. Snowbnd Simage = new Snowbnd();
System Overview
The RasterMaster Java toolkit is written entirely in the Java programming language, permitting rapid development and cross-platform support. Both applications and applets can be written with the toolkit.
Determining System Requirements
System requirements to runRasterMaster Java include:
l Development Kit for the Java platform (JDK), JRE of 1.4.2_10 or higher and we recommend JRE 1.5.
l Minimum memory requirements are related to image size and necessary buffers. Buffers may require multiple megabytes if images are large. For more information, please see Determining Memory Requirements.
47 Chapter 1 - Quick Start
l Virtual machine (Contact your hardware vendor to see if a virtual machine is available for your platform.)
Determining Memory Requirements
The amount of memory required to display a document may be significantly larger than the size of the document that is stored on disk. Just like a road map, the document is folded up and compressed when it is stored. In order to see the document, it must be unfolded (decompressed) and spread out so you can see the whole map. The map takes up much more room when open for viewing. The same is true of online documents. When a document is open, a black and white letter size page at 300 dpi takes roughly 1MB of memory to display and a color page takes 25MB.
The amount of memory required to view documents varies depending on the size of the documents you are processing and the number of documents you are processing at any one time. The amount of memory needed increases as:
l You go from black and white, to grayscale, to color documents (bits per pixel increases).
l You go from compressed to uncompressed document formats (lossy compression to raw image data).
l You go from low resolution to high resolution documents (dots per inch / quality increases).
l You go from small index card size images to large blueprint size images (number of pixels increases).
Generally, higher quality documents require more memory to process. Snowbound Software does not have a one-size-fits-all recommendation for memory because our customers have such a variety of documents and different tolerances for the level of output quality. However, you can try doubling the memory available to see if that resolves the issue. Keep increasing memory until you stop getting out of memory errors. If you hit a physical or financial limit on memory, then you can do the following:
l Decrease the number of documents you have open at any one time.
l Decrease the quality of the images requested by decreasing bits per pixel, the resolution, or the size.
To calculate the amount of memory required for an image, you will need to know the size of the image in pixels and the number of bits per pixel in the image (black and white=1, grayscale=8, color=24). If you do not know the height or width in pixels, but you do know the size in inches and the dpi (dots per inch) of the image, then you can calculate the size in pixels as (width_in_ inches*dots_per_inch) = width_in_pixels.
48 Chapter 1 - Quick Start
To calculate the amount of memory (in bytes), multiply the height, width and number of bits per pixel. Then, divide by 8 to convert from bits to bytes. See the following example:
(height_in_pixels * width_in_pixels * bits_per_pixel)/ 8 = image_size_in_bytes
Table 1.2: Memory Requirements Based on Image Size Image Size Required Memory 24-bit per pixel, 640 x 480 image 640 * 480 * (24 / 8) = 921600 bytes 1-bit per pixel, 8.5" x 11" image, at 300 dpi 2550 * 3300 * (1 / 8) = 1051875 bytes (2550 pixels by 3300 pixels) 24-bit per pixel, 8.5" x 11" image, at 300 dpi 2550 * 3300 * (24 / 8) = 25245000 bytes (25 (2550 pixels by 3300 pixels) megabytes)
Version 13.7 Additions and Improvements
The following are the new features and formats added to Version 13.7 of the RasterMaster Java product.
New Features
l Enhancements and bug fixes to the AFP file format.
l Enhancements and bug fixes to the JPEG file format.
l Multiple enhancements and bug fixes to the PDF file format.
Support PPT Documents as Input for Searchable PDF Output
l Added support for PPT documents as input for searchable PDF output.
49 Chapter 2 - RasterMaster Java Samples
Chapter 2 - RasterMaster Java Samples
This chapter describes the Java samples included with the RasterMaster Java.
If you do not find the sample that you are looking for in this manual, please open a support ticket at http://support.snowbound.com to request a specific sample. We are dedicated to helping our customers succeed and we are constantly enhancing our products based on feedback from customers like you.
You can find the samples in the following directory [RM Java install dir] \Samples\com\snowbound\samples.
Note: Please note that some of the samples depend on the resources directory located at: [RM Java install dir]\Samples\com\resources. Please make sure that the resources directory is installed before running the samples.
The chapter contains the following topics:
Overview of the Java Samples
Conversion between Document Formats
Printing
Image Manipulation
Viewing and Annotating Documents
Scanning
Overview of the Java Samples
There are several samples included with RasterMaster Java. You can find the samples in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. They are used to manipulate an image in many ways, such as altering its alter viewable size, changing its orientation, correcting its imperfections, modifying its size and resolution, converting it to another format, and adding text and graphic annotations.
Running a Sample
Follow the instructions below to run a sample:
50 Chapter 2 - RasterMaster Java Samples
1. Open any of the samples in your development environment. For example: Eclipse.
2. Add a reference to these two jar files: Snow.jar and snowbndcommon.jar.
3. Run the sample as a Java application or as an applet.
Running a Sample from the Command Prompt
Follow the instructions below to run a sample from the command prompt:
1. Make sure that the JDK (Java Development Kit) is installed on your system. If it is not, you can download the JDK for free from at http://www.oracle.com/technetwork/java/javase/downloads/index.html
In the following examples, the JDK is installed at this location (Windows):
C:\Program Files\Java\jdk1.7.0\bin
2. Make sure that the code sample you want to run is in a directory name that matches the package name. In this example, RasterMaster Java was installed to C:\me. For example, the SingleConversion sample is in this directory:
C:\me\com\snowbound\samples\convert
3. Follow the example below to change directory to be in the top-level directory, the directory above com. C:\> cd me C:\me>
4. Use the example below to compile the sample from the command line by running javac from the JDK: C:\me> "C:\Program Files\Java\jdk1.7.0\bin\javac" -classpath ".;.\com\snowbound\Snow.jar;.\com\snowbound\snowcommon.jar;C:\- Program Files\Java\jdk1.7.0\bin" .\com\snowbound\samples\convert\SingleConversion.java
5. Now run the sample from the command line and again from the top-level directory. Note that the slashes have changed to “.” in the name of the sample file: C:\me> java -cp ".;.\com\snowbound\Snow.jar;.\com\snowbound\snowcommon.jar" com.snowbound.samples.convert.SingleConversion
Conversion between Document Formats
Simple Conversion: The SimpleConvert Sample
This sample demonstrates a simple conversion that converts an input file to a specified output format. The user must provide values for the inputFile and outputFormat variables. It takes the path to the image you want to convert and the format name or Snowbound integer
51 Chapter 2 - RasterMaster Java Samples format value for the type of file format you want to output, then saves the image as
Note: For multi-page color and/or grayscale output, PDF or TIFF_LZW is recommended. You may see an increase in the converted file size when using TIFF_LZW. To reduce the output file size, try TIFF_JPEG7 or reduce the image to 1-bit and use TIFF_G4_FAX.
Listed below are the methods used in this sample by default:
l IMGLOW_get_filetype(String) creates the input and output file extensions.
l IMGLOW_get_pages(String) prints the total number of pages in the input document.
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_save_bitmap(String, int) saves the current page and print the resulting status code.
Optional Methods
Listed below are optional methods used to enhance the sample:
Pre-decompression Options
Listed below are pre-decompression optional methods used to enhance the sample:
For vector PDFs: status = snowImage.decomp_vect = true;
l IMGLOW_set_ooxml_license() specifies the Aspose license file.
l IMGLOW_set_document_input(int, int, int) specifies the input DPI and bit-depth for PDF, MS Office, RTF, PCL, and AFP files.
l IMGLOW_set_fontmap_path(String) specifies the font-map for AFP files.
l IMGLOW_set_overlay_path(String) specifies the overlay path for AFP files.
l getXdpi(void) gets the horizontal DPI of the current page.
l getYdpi(void) gets the vertical DPI of the current page.
l getHeight(void) gets the height of the current page.
l getWidth(void) gets the width of the current page.
Pre-decompression Options
52 Chapter 2 - RasterMaster Java Samples
Listed below are pre-decompression optional methods used to enhance the sample:
l IMG_diffusion_mono(void) reduces the bit-depth to 1-bit black and white.
l IMG_color_gray(void) reduces a color image to 8-bit gray scale.
l IMG_promote_24(void) promotes 1, 4, or 8-bit images to 24-bit.
l setXdpi(int) sets the horizontal output DPI.
l setYdpi(int) sets the vertical output DPI.
l IMG_resize_bitmap(int, int) resizes the image.
Batch Conversion: The BatchConvert Sample
This sample provides a GUI that lets you choose a directory, then converts all of the files in the directory. You can find the samples in the following directory: \samples\convert.
Follow the instructions below to run the BatchConvert sample from the command prompt:
1. Make sure that the JDK (Java Development Kit) is installed on your system. If it is not, you can download the JDK for free from at http://www.oracle.com/technetwork/java/javase/downloads/index.html In the following examples, the JDK is installed at this location (Windows): C:\Program Files\Java\jdk1.7.0\bin
2. Make sure that the code sample you want to run is in a directory name that matches the package name. In this example, RasterMaster Java was installed to c:\me. For example, the SingleConversion sample is in this directory: C:\RasterMaster\Samples\com\snowbound\samples\convert
3. Follow the example below to change directory to be in the top-level directory, the directory above com. C:\> cd RasterMaster C:\RasterMaster>
4. Use the example below to compile the sample from the command line by running javac from the JDK: C:\RasterMaster> "C:\Program Files\Java\jdk1.7.0_06 \bin\javac" -classpath".;.\ Samples\com\snowbound\Snow.jar;. \Samples\com\snowbound\snowcommon.jar; C:\Program Files\Java\jdk1.7.0\bin ".\Samples\com\snowbound\samples\convert\BatchConvert.java
5. Now to run the BatchConvert, cd into Samples: C:\RasterMaster>cd Samples C:\RasterMaster>Samples> "C:\Program Files\Java\jre7\bin\java"
53 Chapter 2 - RasterMaster Java Samples
-cp ".;.\com\snowbound\Snow.jar;.\com\snowbound\snowcommon.jar" com.snowbound.samples.convert.BatchConvert
Note: You can change/add jar files in the class path as defined. Please note that when adding jar files make sure they are placed in the correct location and with the correct name.
Also due to the resource used in the UI, the resource folder needs to be included inside \Samples\com\resource
Listed below are the methods used in this sample.
l IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) displays the current image, corrected for aspect ratio, at the current X and Y coordinates.
l IMGLOW_get_pages(String) prints the total number of pages in the input document.
l IMGLOW_set_document_input(int, int, int) specifies the input DPI and bit-depth for PDF, MS Office, RTF, PCL, and AFP files.
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_promote_24(void) promotes 1, 4, or 8-bit images to 24-bit.
l IMG_color_gray(void) reduces a color image to 8-bit gray scale.
l IMG_save_bitmap(String, int) saves the current page and print the resulting status code.
Single Conversion: The SingleConversion Sample
This sample converts all of the pages in one document. You can find the samples in the following directory: \samples\convert\SingleConversion.java.
Listed below are the methods used in this sample.
l Snowbnd(Snowbnd)is an alternate constructor that creates a new Snowbnd object by copying the contents of an existing Snowbnd object
l IMGLOW_get_filetype(String) creates the input and output file extensions.
l IMGLOW_get_pages(String) prints the total number of pages in the input document.
l IMGLOW_set_ooxml_license() specifies the Aspose license file.
l IMGLOW_set_document_input(int, int, int) specifies the input DPI and bit-depth for
54 Chapter 2 - RasterMaster Java Samples
PDF, MS Office, RTF, PCL, and AFP files.
l IMGLOW_set_fontmap_path(String) specifies the font-map for AFP files.
l IMGLOW_set_overlay_path(String) specifies the overlay path for AFP files.
l getXdpi(void) gets the horizontal DPI of the current page.
l getYdpi(void) gets the vertical DPI of the current page.
l getHeight(void) gets the height of the current page.
l getWidth(void) gets the width of the current page.
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_diffusion_mono(void) reduces the bit-depth to 1-bit black and white.
l IMG_color_gray(void) reduces a color image to 8-bit gray scale.
l IMG_promote_24(void) promotes 1, 4, or 8-bit images to 24-bit
l setXdpi(int) sets the horizontal output DPI.
l setYdpi(int) sets the vertical output DPI.
l IMG_resize_bitmap(int, int) resizes the image.
l IMG_save_bitmap(String, int) saves the current page and print the resulting status code.
Simple Conversion with Timeouts: The HangDetector Sample
This sample converts one specified document. If a document does not convert within three seconds, then this sample halts the conversion and prints a timeout message.
To use this sample, do the following:
1. Search for the number for milliseconds that you want to use for the timeout. For example, search for 3000.
2. Search for the file location on your system. For example, search for the following: /Users/imgs/1234567.pdf
3. Change the output location in the next line.
55 Chapter 2 - RasterMaster Java Samples
You can find the samples in the following directory: \samples\convert\HangDetector.java.
Listed below are the methods used in this sample.
l Snowbnd(int, int, int) is an alternate constructor for the Snowbnd object. This allows the creation of a blank image with allocated memory.
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_save_bitmap(byte, int) saves the current Snowbnd image object to the format specified by comp_type. The string value is the output file.
Saving to Searchable PDF: The saveSearchablePDF Sample
This sample extracts the text from the input document and saves it as a searchable PDF. The user can also specify a text string to search for by assigning a value to the stringToSearch variable. You can find the samples in the following directory: \samples\snippets\SavesearchablePDF.java.
Listed below are the methods used in this sample.
l IMG_save_document(String, byte, int) saves to a searchable PDF file.
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMGLOW_extract_text(String, int, int, int) extracts text from PTOCA, PCL, PDF, MS Word, AFP, RTF and MS Excel files. It returns the buffer of extracted text in ASCII format.
l IMGLOW_search_text(byte[], String, int, int, int[]) returns an array of structures of classes of the type, SNBD_SEARCH_RESULT
The Loadandsave Sample
This sample is an extension of the Load sample which demonstrates saving an image. It allows you to choose JPEG with quality and interleave values. You can find the samples in the following directory: \samples\loadandsave.
Printing
The Printing Sample
This sample demonstrates printing using the Snowbound product. It contains both an application and applet. The features includes altering the size of an image and image printing. You can find the samples in the following directory: \samples\printing\PrintingUI.java.
Listed below are the methods used in this sample:
56 Chapter 2 - RasterMaster Java Samples
l IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int) prints the current image at the specified coordinates.
l IMG_print_applet(java.awt.Container, int) prints images loaded into an applet.
l IMG_print_applet_pages(java.awt.Container, int) prints high-resolution multi-page documents from applets.
The SilentPrint Sample
This sample demonstrates how to perform a silent print. You can find the samples in the following directory: \samples\printing\SilentPrintExample.java.
Listed below are the methods used in this sample.
l IMGLOW_set_document_input(int, int, int)specifies the input DPI and bit-depth for PDF, MS Office, RTF, PCL, and AFP files.
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int) prints the current image at the specified coordinates.
Image Manipulation
The Thumbnails Sample
This sample demonstrates creating thumbnails. When an image is opened, the thumbnail is created. You can open multiple images and view all thumbnails at once. When you click the thumbnail, the image appears in its original size. This sample is comprised of an applet and an application. You can find the samples in the following directory: \samples\snippets\CreateThumbnail.java and \samples\thumbnails.
Listed below are the methods used in this sample:
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) displays the current image, corrected for aspect ratio, at the current X and Y coordinates.
l IMG_resize_bitmap_bicubic(int, int) scales down images using a bicubic interpolation algorithm.
l IMG_resize_to_gray(int, int) resizes a 1-bit black and white image to a (smaller) 8-bit
57 Chapter 2 - RasterMaster Java Samples
grayscale image.
l Snowbnd()
Watermarks and Redaction: The Watermarks Sample
This sample demonstrates creating watermarks. You can find the sample in the following directory: \samples\watermark.
The Manipulation Sample
This sample demonstrates image manipulation using the Snowbound product. You can find the samples in the following directory: \samples\manipulation.
The Color Detection Sample
This sample converts a document to TIFF and selects the appropriate TIFF format (TIFF Group 4, or TIFF_LZW) based on the color profile of each source page.
You can find the samples in the following directory: \samples\snippets\ColorDetection.java.
Input
The input is the document name defined in variable inputFilename and defaults to C:/images/mysource.pdf.
Output
The output is the document name defined in variable outputFilename and defaults to C:/images/myoutput.tif.
Listed below are the methods used in this sample:
l IMGLOW_set_document_input(int, int, int) specifies the input DPI and bit-depth for PDF, MS Office, RTF, PCL, and AFP files.
l IMGLOW_get_pages(String) prints the total number of pages in the input document.
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMGLOW_detect_color() checks all pixels to determine if the image is color or gray scale.
l IMG_thresh_mono(int) permanently converts 4, 8, or 24-bit images to 1-bit per pixel using a threshold passed as the second argument.
l IMG_save_bitmap(byte, int) saves the current Snowbnd image object to the format specified by comp_type. The string value is the output file.
58 Chapter 2 - RasterMaster Java Samples
The Save Page to Memory Sample
This sample loads an image from a document and saves it in the desired format to a byte array.
You can find the samples in the following directory: \samples\snippets\SavePageToMemory.java.
Input
The input is the document name defined in variable inputFilename and defaults to C:/images/mysource.pdf.
Output
The output is a byte array containing the image data of the page.
Listed below are the methods used in this sample:
l IMGLOW_get_pages(String) prints the total number of pages in the input document.
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_save_bitmap(int, int, int, int) allows saving to a byte array without knowing or guessing the final size of the compressed image or document.
l IMG_save_bitmap(byte, int, int, int) saves the current Snowbnd image object to a returned byte array.
l IMG_decompress_bitmap(java.io.DataInputStream, int) decompresses the current page and print the resulting status code.
Viewing and Annotating Documents
The Viewing and Annotations Sample
This sample is an image viewer that demonstrates the following image manipulations: altering the viewable size, changing the orientation, changing the size and resolution, making corrections, and flipping through pages of a multi-page file. You can find the samples in the following directory: \samples\annapp\DemoAnnApp.java.
This sample also demonstrates several annotation methods, such as adding edits, bitmaps, lines, sticky notes, and more through a variety of methods. These annotations can be in both text and graphic format.
Listed below are the methods used in this sample:
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
59 Chapter 2 - RasterMaster Java Samples
l IMG_deskew_bitmap(int) is a fast rotate for 1-bit skewed images.
l IMG_despeckle_bitmap(int) removes noise (random pixel data) from 1-bit images.
l IMG_display_bitmap(java.awt.Graphics, int, int, int, int) displays the current image at the current X and Y coordinates and is not corrected for aspect ratio. l IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) displays the current image, corrected for aspect ratio, at the current X and Y coordinates. l IMG_erase_rect(int, int, int, int, int, int, int) fills the inside or outside of the specified rectangle (xs, ys, xsize, and ysize parameters) with the color passed in. It can be used to remove borders, for instance. l IMG_flip_bitmapx(void) flips the image horizontally to produce a mirror image.
l IMG_flip_bitmapy(void) flips the image vertically to produce a mirror image.
l IMG_get_deskew_angle(int[], int, int) returns the skew angle for 1-bit images.
l IMG_invert_bitmap(void) inverts the current image, changing pixels by a simple XOR operation applied to each byte of the image in memory. l IIMG_merge_block(Snow.Snowbnd, int, int, int) draws a source image on top of the current image at the x and y coordinates (xpos and ypos) passed in. l IMG_print_applet_pages(java.awt.Container, int) prints high-resolution multi-page documents from applets. l IMG_resize_bitmap(int, int) resizes the image.
l IMG_rotate_bitmap(int) rotates the current image clockwise by display angle.
l IMG_save_bitmap(byte, int) saves the current Snowbnd image object to the format specified by comp_type. The string value is the output file. l IMG_scroll_bitmap(java.awt.Container, java.awt.Event) scrolls the bitmap. It essentially moves the current cropping rectangle in the direction indicated by the ScrollBar thumb. For users who do not want the scrollbars visible, a similar effect can be achieved by moving the cropping rectangle around using IMG_set_croprect. l IMG_window_level(int, int, int) changes the range of displayed pixels. It performs window leveling in 8 and 16-bit gray scale images. l SANN_read_ann(DataInputStream, int) reads an annotation file from disk. Pathnames are absolute. It supports multi-page annotation files. l SANN_set_croprect(int, int, int, int) sets the cropping rectangle is essentially the size of
60 Chapter 2 - RasterMaster Java Samples
the display container (which is usually a subclass of java.awt.Container), mapped onto the image (corrected for image scaling).
l SANN_display_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int) displays all current annotations (superimposes on the image) to the Graphics context pointed by g.
l GetClientRect(java.awt.Container, Snow.SANN_RECT) fills a SANN_RECT object with the current height and width of the display area.
l SANN_highlight_object(java.awt.Container, Snow.SANN_RECT, int) highlights the bounding box of the annotation object specified by graphic_num
l ui_delete(java.awt.Container) deletes the currently selected annotation object. It is used by a built in annotation editing pop-up menu to fire the SANN_delete_object method on the currently selected annotation object.
l ui_startmove(java.awt.Container) notifies the annotation library that the current annotation object is being moved.
l ui_startresize(java.awt.Container) notifies the annotation library that the current annotation object is being resized.
l ui_wm_lbuttondown(java.awt.Container, int, int, byte[]) begins tracking mouse movements when the mouse button is pressed. Call this method during the mouse down or mouse pressed events.
l ui_wm_mousemove(java.awt.Container, int, int, byte) notifies the library of the current mouse coordinates.
l ui_wm_lbuttonup(java.awt.Container, int, int, byte[]) notifies the annotation library that the mouse button has been released.
l SANN_write_ann(String, int, byte[]) writes out annotations to the disk file.
l SANN_activate_all_objects(void)activates all text based annotation objects to allow text editing in the TextArea represented by these objects. Currently used only on the SANN_EDIT and SANN_POSTIT objects.
l SANN_deactivate_all_objects(void) is used on the SANN_EDIT and SANN_POSTIT objects to disallow editing of text in all text based objects. It makes the window inactive and draws the object data statically, superimposed on the image
l SnowAnn Sann = new SnowAnn(int, int);
l Snowbnd()
The Swing Sample
This sample demonstrates using Java Swing classes. It demonstrates several image methods, such as altering the viewable size, changing the orientation, modifying the size and resolution,
61 Chapter 2 - RasterMaster Java Samples making corrections, and converting to other formats. You can find the samples in the following directory: \samples\swing.
Note: Please look carefully at the paint method.
Listed below are the methods used in this sample:
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_deskew_bitmap(int) is a fast rotate for 1-bit skewed images.
l IMG_despeckle_bitmap(int) removes noise (random pixel data) from 1-bit images.
l IMG_display_bitmap(java.awt.Graphics, int, int, int, int) displays the current image at the current X and Y coordinates and is not corrected for aspect ratio.
l IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) displays the current image, corrected for aspect ratio, at the current X and Y coordinates.
l IMG_erase_rect(int, int, int, int, int, int, int) fills the inside or outside of the specified rectangle (xs, ys, xsize, and ysize parameters) with the color passed in. It can be used to remove borders, for instance.
l IMG_flip_bitmapx(void) flips the image horizontally to produce a mirror image.
l IMG_flip_bitmapy(void) flips the image vertically to produce a mirror image.
l IMG_get_deskew_angle(int[], int, int) returns the skew angle for 1-bit images.
l IMG_invert_bitmap(void) inverts the current image, changing pixels by a simple XOR operation applied to each byte of the image in memory.
l IIMG_merge_block(Snow.Snowbnd, int, int, int) draws a source image on top of the current image at the x and y coordinates (xpos and ypos) passed in.
l IMG_print_applet(java.awt.Container, int) prints images loaded into an applet.
l IMG_resize_bitmap(int, int) resizes the image.
l IMG_rotate_bitmap(int) rotates the current image clockwise by display angle.
l IMG_save_bitmap(byte, int) saves the current Snowbnd image object to a byte array.
l IMG_window_level(int, int, int) changes the range of displayed pixels. It performs
62 Chapter 2 - RasterMaster Java Samples
window leveling in 8 and 16-bit gray scale images.
l Snowbnd()
Working with Vector PDF vs. Raster PDF: The VectorPDF Sample
This sample demonstrates how to use vector PDF. This sample is comprised of an applet and an application. You can find the samples in the following directory: \samples\vectorpdf.
Listed below are the methods used in this sample:
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) displays the current image, corrected for aspect ratio, at the current X and Y coordinates.
l IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int) prints the current image at the specified coordinates.
The VectorPDFPageManipulation Sample
This sample demonstrates how to delete, extract, and append pages to and from a vector PDF file without causing additional pages in that vector PDF to change into non-vector pages because of those manipulations. Pages being appended to vector PDFs can be vector or non vector pages. You can find the samples in the following directory: \samples\vectorpdf.
Listed below are the methods used in this sample:
l IMGLOW_delete_page(String, int, int) returns the ability to delete the specified page from a multi-page PDF document.
l IMGLOW_extract_page(String, int, int) extracts the specified page from a multi-page PDF or TIFF document.
l IMGLOW_append_page(String, byte, int) allows the appending of PDF content for individual pages without any changes.
l IMG_decompress_bitmap_stream(String, int) reads images from a standard URL.
l IMG_save_bitmap(int, int, int, int) allows saving to a byte array without knowing or guessing the final size of the compressed image or document.
Scanning
The Scanning Sample
This sample demonstrates how to use scanning. You can find the samples in the following directory: \samples\scanning.
63 Chapter 2 - RasterMaster Java Samples
Listed below are the methods used in this sample.
l IMG_scan_acquire() is a TWAIN scanning routine. It scans an image on the current installed scanner or input device and returns the standard library image handle. IMG_ scan_open_source() must be called first.
l IMG_scan_acquire_feeder() is a TWAIN scanning method that allows scanning from a scanner with an automatic document feeder.
l IMG_scan_feeder_close() is a TWAIN method used to close the scanner after calls to IMG_scan_acquire_feeder().
l IMG_scan_open_source() is a TWAIN scanning method that allows setting the desired scan or input device.
l IMG_scan_get_source_list() calls the native SDK method from ScanInterface to get a list of scanners.
l IMG_scan_pages() is a TWAIN scanning routine. It scans all pages from the currently selected scanner or input device and saves to the path\filename specified by filename in the image format file type.
l IMG_scan_get_cap() returns the current setting of the specified TWAIN capability.
l IMG_scan_set_cap() sets the value of the specified TWAIN capability.
l IMG_scan_set_caps() sets scanning parameters such as height, width, and bits per pixel for the current scanner.
l IMG_scan_setup() sets the value of the specified TWAIN capability.
64 Chapter 3 - Convert and Save Methods
Chapter 3 - Convert and Save Methods
This chapter describes how to convert an image to a different file format and the available convert and save methods for the Snow.Snowbnd class. The fastest way to get started is to run the SimpleConvert sample that is included with this product. The SimpleConvert sample converts any supported document type into the file format you request and then displays it. You can find the samples in the following directory: [RM Java install dir] \Samples\com\snowbound\samples. For more information, please see RasterMaster Java Samples on how to find and run the Simple Conversion: The SimpleConvert Sample sample.
Converting File Formats
The RasterMaster Java products support over 1040 file formats. Many formats such as TIFF are very broad in the internal support of compression and bit depths. Not all formats can support all bit depths.
All RasterMaster Java products import and convert file formats to Snowbound Software’s internal format at decompress time. The format is a simple uncompressed DIB (Device Independent Bitmap) format stored in memory. This format is decompressed or imported and can be saved out to any supported format. See Appendix A, Supported File Formats for a complete list of supported file formats. For more information on the DIB format, please see MS_ Windows DIB Header Format.
Automatically Detecting File Formats
In most cases, you do not need to know the file format you wish to convert since RasterMaster Java products automatically detect the file format regardless of the file extension. File extensions are not mandatory.
RasterMaster Java supports automatic promotion of images to destination files. For example, JPEG images can only be written out at 8 and 24-bits per pixel. In order to save a 1-bit TIFF image as JPEG, the developer must promote the TIFF to 8 or 24-bits per pixel.
In our other libraries, this is accomplished by calling one of the promote functions. In RasterMaster Java, however, the library automatically determines the bits per pixel for the destination format and promotes accordingly.
Supported Pixel Depths
JPEG supports 8, 24, and 32-bits per pixel. Black and white images use 1-bit per pixel, while color images usually require 24-bits per pixel. For many of these cases, RasterMaster Java automatically converts the pixel depth to the appropriate value, based on the output format specified.
See Simple Conversion: The SimpleConvert Sample to view a sample of decompressing and saving an image to another format.
65 Chapter 3 - Convert and Save Methods
Converting Up 8 or 24-bit Pixel Depths
To convert any pixel depth up to 24-bit, use IMG_promote_24. See IMG_promote_24(void) for more information.
See Supported File Formats for the pixel depths of each supported format.
For more information on converting from a higher pixel depth format to a lower pixel depth format or a lover pixel depth format to a higher pixel depth, please see Color Manipulation Methods.
File Format Conversion Error Messages
When saving to a format, if the error returned is PIXEL_DEPTH_UNSUPPORTED (-21), the output format does not support the current bits per pixel of the image you are trying to save. It is possible to convert the pixel depth of these images using the IMG_promote_24 method. See IMG_promote_24(void) for more information.
See Appendix A, Supported File Formats for the pixel depths of each supported format.
Extracting Text
Snowbound Software supports extracting text to an ASCII file for some popular formats such as PTOCA, PCL, PDF, MS Word, AFP, and MS Excel. Please see IMGLOW_extract_text (String, int, int, int) for more information on extracting text.
Methods Used for File Format Conversion
The Simple Conversion: The SimpleConvert Sample sample demonstrates a simple conversion that converts an input file to a specified output format. The user must provide values for the inputFile and outputFormat variables. It takes the path to the image you want to convert and the format name or Snowbound integer format value for the type of file format you want to output, then saves the image as
Note: For multi-page color and/or grayscale output, PDF or TIFF_LZW is recommended. You may see an increase in the converted file size when using TIFF_LZW. To reduce the output file size, try TIFF_JPEG7 or reduce the image to 1-bit and use TIFF_G4_FAX.
Listed below are the methods used in this sample by default:
l IMGLOW_get_filetype(String) creates the input and output file extensions.
l IMGLOW_get_pages(String) prints the total number of pages in the input document.
66 Chapter 3 - Convert and Save Methods
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_save_bitmap(String, int) saves the current page and print the resulting status code.
Optional Methods
Listed below are optional methods used to enhance the sample:
Pre-decompression Options
Listed below are pre-decompression optional methods used to enhance the sample:
For vector PDFs: status = snowImage.decomp_vect = true;
l IMGLOW_set_ooxml_license() specifies the Aspose license file.
l IMGLOW_set_document_input(int, int, int) specifies the input DPI and bit-depth for PDF, MS Office, RTF, PCL, and AFP files.
l IMGLOW_set_fontmap_path(String) specifies the font-map path for AFP files.
l IMGLOW_set_overlay_path(String) specifies the overlay path for AFP files.
l getXdpi(void) gets the horizontal DPI of the current page.
l getYdpi(void) gets the vertical DPI of the current page.
l getHeight(void) gets the height of the current page.
l getWidth(void) gets the width of the current page.
Pre-decompression Options
Listed below are pre-decompression optional methods used to enhance the sample:
l IMG_diffusion_mono(void) reduces the bit-depth to 1-bit black and white.
l IMG_color_gray(void) reduces a color image to 8-bit gray scale.
l IMG_promote_24(void) promotes 1, 4, or 8-bit images to 24-bit.
l setXdpi(int) sets the horizontal output DPI.
l setYdpi(int) sets the vertical output DPI.
l IMG_resize_bitmap(int, int) resizes the image.
67 Chapter 3 - Convert and Save Methods
IMG_create_thumbnail(int, int)
This method intelligently resizes down images. It supports any pixel depth and chooses IMG_resize_bicubic for color images or IMG_resize_to_gray for 1-bit black and white images. This method is excellent for creating thumbnails.
1-bit images are converted to grayscale with our “scale to gray” algorithm. 8 and 24-bit images are resized with our bicubic interpolation algorithm.
If you experience diminished quality when resizing, try calling IMG_create_thumbnail to look at neighboring pixels when resizing for better quality.
JPEG is not the best compression to use for converting text. JPEG works for pictures and not images with hard black to white transitions. For display on a lower resolution screen and to see better results when zoomed, try resizing the image with IMG_create_thumbnail(), then convert to JPEG.
Use IMG_create_thumbnail to preserve aspect ratio when converting to a thumbnail. This will create a gray scale aliased bitmap that must be saved with TIFF_LZW or TIFF_JPEG.
Syntax
int IMG_create_thumbnail(int xsize, int ysize);
Remark
Table 3.1: IMG_create_thumbnail(int, int) Method Variables
Variable Description xsize Destination width of image after resizing ysize Destination height of image after resizing
IMG_decompress_bitmap(String, int)
This method decompresses an image from the local disk. This standard method can be used by applications, signed applets, or applets for which disk read permissions have been granted. As with all decompression methods, it automatically detects the file format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l Simple Conversion: The SimpleConvert Sample
l Batch Conversion: The BatchConvert Sample
l Single Conversion: The SingleConversion Sample
l The SilentPrint Sample
68 Chapter 3 - Convert and Save Methods
l The Swing Sample
l The Thumbnails Sample
l The Color Detection Sample
l The Save Page to Memory Sample
l Working with Vector PDF vs. Raster PDF: The VectorPDF Sample
Syntax int IMG_decompress_bitmap(String st, int page);
Remark
Table 3.2: IMG_decompress_bitmap(String, int) Method Variables
Variable Description st Path and filename of the image to decompress page Page number for the multi-page image file
Returns
Returns the status of the decompressed image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 3.1: IMG_decompress_bitmap Sample
FileDialog fd = new FileDialog(this,"Open " + "Bitmap",FileDialog.LOAD); fd.show(); FileName = fd.getDirectory() + fd.getFile(); if (FileName != null) { tSimage = new Snow.Snowbnd(); tSimage.IMG_decompress_bitmap(FileName,0);}
OpenFileDialog fd = new OpenFileDialog(); DialogResult dr = fd.showDialog; if (dr == System.Windows.Forms.DialogResult.OK) { Simage = new Snow.Snowbnd(); tSimage.IMG_decompress_bitmap(fd.FileName,0); }
69 Chapter 3 - Convert and Save Methods
IMG_decompress_bitmap(java.awt.Image, int)
This method imports a Java™ image object.
Syntax
int IMG_decompress_bitmap(java.awt.Image img, int bits_pix);
Remark
Table 3.3: IMG_decompress_bitmap(java.awt.Image, int) Method Variables
Variable Description img Java image object from which to import data. Destination bits per pixel desired. Data from Java image bits_pix objects is returned as 24 bits, but you can convert to 1-bit or 8-bit if desired. For color, use 24-bits.
Returns
Returns the status of the Java image object. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 3.2: IMG_decompress_bitmap Sample
java.awt.Image img;int xsize, ysize;
if (myPanel1.Simage == null && myPanel1.Sann == null) return; xsize = myPanel1.Simage.getWidth(); ysize = myPanel1.Simage.getHeight(); img = this.createImage(xsize,ysize); Graphics g = img.getGraphics(); myPanel1.Simage.IMG_decompress_bitmap(img,1); myPanel1.Simage.IMG_display_bitmap(g,0,0,xsize,ysize); myPanel1.Sann = null;myPanel1.repaint(),
IMG_decompress_bitmap(java.io.DataInputStream, int)
This method decompresses data from a DataInputStream and automatically detects the file format. It only decompresses an image from a DataInputStream and created from a ByteArray. Then, you can call decompress on a ByteArray or create a DataInputStream from this ByteArray.
70 Chapter 3 - Convert and Save Methods
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the The Save Page to Memory Sample sample.
Note: You cannot read from an InputStream because it does not allow random access to the data. You must use either a string or a DataInputStream that was created from a ByteArray.
Syntax int IMG_decompress_bitmap(java.io.DataInputStream di, int page);
Remark
Table 3.4: IMG_decompress_bitmap(java.io.DataInputStream, int) Method Variables
Variable Description di Java.io.DataInputStream page Page number if reading from multi-page image file
Returns
Returns the status of the DataInputStream. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 3.3: IMG_decompress_bitmap Sample
java.io.RandomAccessFile ras; int length;byte buff[]; try{ ras = new java.io.RandomAccessFile (st,"r"); length = (int)ras.length(); buff = new byte[length]; ras.readFully(buff,0,length); } catch (IOException ioe) { return -2; } java.io.DataInputStream di; di = new java.io.DataInputStream(new java.io.ByteArrayInputStream(buff)) stat = tSimage.IMG_decompress_bitmap(di, page);
71 Chapter 3 - Convert and Save Methods
IMG_decompress_bitmap_fd(String, int, int)
This method works the same as IMG_decompress_bitmap but can be used for image formats that are embedded in a larger file and do not start at the beginning of a file.
Syntax
int IMG_decompress_bitmap_fd(String bm_name, int offset, int page);
Remark
Table 3.5: IMG_decompress_bitmap_fd(String, int, int) Method Variables
Variable Description bm_name Filename of image to decompress. offset Offset of start of image format in bytes. Image or page number to decompress if multi-page file page format. Set to 0 for first page.
Returns
Returns the file name of the image to decompress. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_decompress_bitmap_stream(String, int)
This method reads images from a standard URL. This method automatically detects the file format and is normally used by applets.
Syntax
int IMG_decompress_bitmap_stream(String st, int page);
Remark
Table 3.6: IMG_decompress_bitmap_stream(String, int) Method Variables
Variable Description URL and filename of the image to decompress, for st example, http://www.snowbound.com/image.tif page Page number for multi-page file
Returns
Returns the URL and filename of the image to decompress. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_decompress_bitmap_stream_onthefly
72 Chapter 3 - Convert and Save Methods
(String, int, java.awt.Container)
This method decompresses and displays partially downloaded image data from a URL. The image begins to display even before all image data is downloaded.
This special method is used by applets. As with all decompression methods, it automatically detects the file format.
Notes: A display container is required for this method. This method should not be used when there are no Graphical User Interface classes.
Syntax int IMG_decompress_bitmap_stream_onthefly(String st, int page, java.awt.Container sf);
Remark
Table 3.7: IMG_decompress_bitmap_stream_onthefly(String, int, java.awt.Container) Method Variables
Variable Description URL and file name of image to decompress, for example, st http://www.snowbound.com/image.tif page Page number for multi-page files Container which can get the panel or frame where the Container sf application or applet resides
Returns
Returns the URL and filename of the image to decompress. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_decompress_fax(java.lang.String, int, int, int, int, int)
This method decompresses compressed fax data from proprietary image file formats which use the CCITT G3 or G4 compression algorithms. The path name is the absolute path to the file.
The developer is responsible for reading any header information such as height, width, fill order, or compression. Call this method to decompress the data and convert it into a Snow.DIB in memory.
Syntax int IMG_decompress_fax(String bm_name, int xsize, int ysize, int type, int fill_order, int offset);
73 Chapter 3 - Convert and Save Methods
Remark
Table 3.8: IMG_decompress_fax(java.lang.String, int, int, int, int, int) Method Variables
Variable Description Absolute path and file name to the file on the local file bm_name system xsize Width, in pixels, of the image after decompression ysize Height, in pixels, of the image after decompression 2 = Group 3 2d image type 3 = Group 3 4 = Group 4 fax Bit order in each byte. Normal values: fill_order 0 = CALS, Intel byte order (MSB -> LSB) 2 = G3 and G4, Motorola byte order (LSB -> MSB) offset Absolute position of the first byte of compressed data
Returns
Returns the absolute path and filename to the file on the local file system. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int)
This method decompresses fax or proprietary image formats which use the CCITT G3 or G4 compression algorithms.
The developer is responsible for reading any header information such as height, width, fill order, or compression. Call this method to decompress the data and convert it into a Snow.DIB in memory.
Syntax
int IMG_decompress_fax(java.io.DataInputStream di, int xsize, int ysize, int type, int fill_order, int offset);
Remark
Table 3.9: IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int) Method Variables
Variable Description di DataInputStream containing compressed file data xsize Width, in pixels, of the image after decompression ysize Height, in pixels, of the image after decompression 2 = Group 3 2d image type 3 = Group 3
74 Chapter 3 - Convert and Save Methods
Variable Description 4 = Group 4 fax Bit order in each byte. Normal values: fill_order 0 = CALS, Intel byte order (MSB -> LSB) 2 = G3 and G4, Motorola byte order (LSB -> MSB) offset Absolute position of the first byte of compressed data
Returns
Returns the status of the DataInputStream. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container)
This method decompresses and displays partially downloaded image data from a URL. The image begins to display even before all image data is downloaded. After the first page is decompressed and downloaded, the other pages of a multi-page file are downloaded in the background. This allows subsequent pages to be available faster.
This special method is used by applets. As with all decompression methods, it automatically detects the file format.
Notes: A display container is required for this method. This method should not be used when there are no Graphical User Interface classes.
Syntax int IMG_decompress_multipage_bitmap_stream_onthefly(String st, int page, java.awt.Container sf);
Remark
Table 3.10: IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container) Method Variables
Variable Description URL and filename of image to decompress, for example, st http://www.snowbound.com/image.tif page Page number for multi-page files Container which can get the panel or frame where the Container sf application or applet resides
Returns
75 Chapter 3 - Convert and Save Methods
Returns the URL and filename of the image to decompress. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_save_bitmap(byte, int)
This method saves the current Snowbnd image object to a byte array. Multi-page saving to a byte array is supported for MO:DCA and TIFF only. There is no way to know how large the image will be once compressed.
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the getBitsPerPixel(void) method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats in Appendix A, Supported File Formats for details on what bit-depths are available for each format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
l The Swing Sample
l The Thumbnails Sample
l The Color Detection Sample
Notes: To save multiple pages for other formats, see IMG_save_bitmap(int, int, int, int) and Supported File Formats for more information. This method returns a length of the compressed image in the byte array.
Syntax
byte[]IMG_save_bitmap(byte array[] b, int comp_type);
Remark
Table 3.11: IMG_save_bitmap(byte, int) Method Variables
Variable Description array Byte array in which to save.
76 Chapter 3 - Convert and Save Methods
Variable Description Output file format to write. The output constants for comp_type currently supported and unsupported file types are defined in Supported File Formats .
Returns
Returns the value of the output file size in bytes.
IMG_save_bitmap(byte, int, int, int)
This method saves the current Snowbnd image object to a returned byte array. Multi-page TIFF and PDF file formats are supported.
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the getBitsPerPixel(void) method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats in Appendix A, Supported File Formats for details on what bit-depths are available for each format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the The Save Page to Memory Sample sample.
Notes: To save multiple pages for other formats, see IMG_save_bitmap(String, int)and Supported File Formats for more information. This method returns a length of the compressed image in the byte array.
Syntax int IMG_save_bitmap(byte dos[], int buff_inc, int comp_type, int error[]);
Remark
Table 3.12: IMG_save_bitmap(byte, int, int, int) Method Variables
Variable Description dos Buffer to use. buff_inc Amount that the buffer will grow if needed. Output file format to write. The output constants for comp_type currently supported and unsupported file types are defined inSupported File Formats . Returns the size of the data. If the value is less than 0, then error an error code is displayed.
77 Chapter 3 - Convert and Save Methods
Returns
Returns the value of the output file size in bytes.
IMG_save_bitmap(int, int, int, int)
This method is designed to allow saving to a byte array without knowing or guessing the final size of the compressed image or document. First, the initial size parameter is allocated. If the output data saved becomes larger than the initial size, then the buffer is reallocated to initial_size plus the increment size specified by buff_inc. Each time the output data becomes larger than the current buffer size when saving, the buffer is increased in size by the increment size. The caller must be careful in choosing the buffer increment size. If the buffer increment is too small, multiple reallocations will cause the saving process to be slow. If it is too large, too much memory will be allocated.
Note: Snowbound Software recommends an increment size of 10-25% of the initial buffer size.
Group 4 compression found in TIFF and AFP file formats typically compress at a rate of 10:1. You can choose an initial size of 1/8 to 1/10 of the uncompressed size.
A JPEG file format typically compresses at a rate of 10:1.
An LZW file format found in TIFF and GIF file formats compress at a rate of about 3:1. A .zip or flate file found in a PNG file format also compresses at a rate of about 3:1.
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the getBitsPerPixel(void) method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats in Appendix A, Supported File Formats for details on what bit-depths are available for each format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the The Save Page to Memory Sample sample.
Note: Compression results for your images may vary. For best results, test a number of images to see what the resultant output size will be. Also, it is suggested to test out smaller and larger increment sizes to find the best level of performance.
Syntax
78 Chapter 3 - Convert and Save Methods byte[] IMG_save_bitmap(int initial_size, int buff_inc, int comp_ type, int error[]);
Remark
Table 3.13: IMG_save_bitmap(int, int, int, int) Method Variables
Variable Description initial_size The buffer is initially allocated to this size exactly. buff_inc The amount to grow the buffer if needed. Output file format to write. The output constants for comp_type currently supported and unsupported file types are defined in Supported File Formats . Returns the size of the data. If the value is less than zero, it error is an error code.
Returns
Returns the value of the output file size in bytes.
IMG_save_bitmap(String, int)
This method saves the current Snowbnd image object to the format specified by comp_ type. The string value is the output file.
TIFF is a multi-page file format. If the image name already exists, a new page or image is appended to the local file, leaving the current images unchanged. If the file does not exist, it is created with only one page.
You can save images as black and white, grayscale, or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the getBitsPerPixel(void) method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats in Appendix A, Supported File Formats for details on what bit-depths are available for each format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l Simple Conversion: The SimpleConvert Sample
l Batch Conversion: The BatchConvert Sample
l Single Conversion: The SingleConversion Sample
l The Swing Sample
79 Chapter 3 - Convert and Save Methods
Note: Only applications and signed applets can save to a file.
Syntax
int IMG_save_bitmap(String st, int comp_type);
Remark
Table 3.14: IMG_save_bitmap(String, int) Method Variables
Variable Description st Output filename in which to save. Output file format to write. The output constants for comp_type currently supported and unsupported file types are defined in Appendix A, Supported File Formats.
Returns
Returns the value of the output file size in bytes.
IMG_save_document(String, byte, int)
This method saves extracted text to a searchable PDF file.
Note: Only applications and signed applets can save to a file.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the Saving to Searchable PDF: The saveSearchablePDF Sample sample.
Syntax
int IMG_save_document(String bm_name, byte vbuff[], int filetype);
Remark
Table 3.15: IMG_save_document(String, byte, int) Method Variables
Variable Description bm_name Name of file to save to. vbuff[] Byte array of extracted text and graphics. File type to save to. Currently, the file type to save to is filetype only PDF.
80 Chapter 3 - Convert and Save Methods
Returns
Returns the file name or file type to save to. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_save_document(byte, byte, int)
This method saves extracted text to a searchable PDF file.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the Saving to Searchable PDF: The saveSearchablePDF Sample sample.
Syntax int IMG_save_document(byte dos[], byte vbuff[], int filetype);
Remark
Table 3.16: IMG_save_document(byte, byte, int) Method Variables
Variable Description dos[] Destination byte array buffer to save to. vbuff[] Byte array of extracted text and graphics. File type to save to. Currently, the file type to save to is filetype only PDF.
Returns
Returns the file name or file type to save to. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_write_tiff_stream(Dib_Head lpbi, byte, int, int, String)
This method is used to create a TIFF file with existing compressed data. The header information is passed as the Dib_Head class containing the width, height, and bits per pixel of the image to create.
Syntax int IMGLOW_write_tiff_stream(Dib_Head lpbi, byte data_stream[], int data_size, int file_type, String bm_name);
Remarks
Table 3.17: IMGLOW_write_tiff_stream(Dib_Head lpbi, byte,int, int, String) Method Variables
81 Chapter 3 - Convert and Save Methods
Variable Description lpbi The header information structure. data_stream[] Byte array of compressed data. data_size Size of the data_stream compressed stream of bytes. Type of compressed data in stream. Possible types:
TIFF_COMP_NONE = 1, no compression TIFF_COMP_GIII = 2, modified huffman group 3 TIFF_COMP_GIIIP = 3, modified huffman group 3 padding TIFF_COMP_G4 = 4, modified huffman group 4 file_type TIFF_COMP_LZW = 5, lzw compression TIFF_COMP_PACK = 32773, pack bits compression TIFF_COMP_JPEG = 6, JPEG compression TIFF_COMP_JPEG_GRAY = 7, JPEG compression 8 bit gray scale TIFF_COMP_G4_FO = 4000, modified huffman group 4 TIFF_COMP_JBIG = 34661, JBIG format bm_name Name of output tiff file to create.
82 Chapter 4 - Input Documents and Images
Chapter 4 - Input Documents and Images
This chapter describes how to input documents and images and describes how to use the format hash for the Java platform. It also describes how to work with PDF and other document file formats in Snowbound Software’s RasterMaster® SDK products.
Determining the Document's Format and its Capabilities
The format hash methods provide an easy way to get information about supported formats in the RasterMaster Java.
To use these methods, you must first create the FormatHash class as follows.
This class maintains the set of valid Snowbound file formats.
To get instances of this class, use the static method getInstance().
Example 4.1: getInstance() Sample
FormatHash fh = FormatHash.getInstance();getInstance()Format faxFormat = fh.getFormat ("TIFF_G4_FAX"); int faxCode = faxFormat.getFormatCode();
This method can be called repeatedly. If the FormatHash has already been created it will just return that value. If not, it will create a new instance.
Syntax public static FormatHash getInstance();
Returns
String array of the format names that can save to the specified bitDepth. getAvailibleSaveFormats(int) getAvailibleSaveFormats(int)
This method returns a string array of the format names that can save to the specified bitDepth.
Syntax
83 Chapter 4 - Input Documents and Images
public String[] getAvailibleSaveFormats(int bitDepth);
Remark
Table 4.1: getAvailableSaveFormats(int) Method Variables
Variable Description bitDepth Number of bits used to represent the color of a single pixel
getAvailibleSaveFormats(String)
This method returns a string array for all possible formats available to save to.
Syntax
public String[] getAvailibleSaveFormats(String formatValue);
getFormat(int)
This method returns the format class for a Snowbound Format defined value.
Syntax
public Format getFormat(int formatValue);
Remark
Table 4.2: getFormat(int) Method Variables
Variable Description formatValue The format value
getFormat(String)
This method returns a format class for a given format name passed in.
Syntax
public Format getFormat(String formatName);
Remark
Table 4.3: getFormat(String) Method Variables
Variable Description formatName The format name
getFormatCode(String)
84 Chapter 4 - Input Documents and Images
This method returns the format code for the specified format name.
Syntax public int getFormatCode(String formatName);
Remark
Table 4.4: getFormatCode(String) Method Variables
Variable Description formatName The format name getFormatExtension(int)
This method returns the extension for the specified format code.
Syntax public String getFormatExtension(int formatCode);
Remark
Table 4.5: getFormatExtension(int) Method Variables
Variable Description formatCode The format code getFormatExtension(String)
This method returns the extension for the specified format name.
Syntax public String getFormatExtension(String formatName);
Remark
Table 4.6: getFormatExtension(String) Method Variables
Variable Description formatName The format name getFormatName(String)
This method returns a string format name based on a given Snowbound defined format name.
Syntax public String getFormatName(String formatValue);
85 Chapter 4 - Input Documents and Images
Remark
Table 4.7: getFormatName(String) Method Variables
Variable Description formatValue The format value
isValidMultiFormat(int)
This method returns true if the specified format code is a valid multi-page format.
Syntax
public boolean isValidMultiFormat(int formatCode);
Remark
Table 4.8: isValidMultiFormat(int) Method Variables
Variable Description formatCode The format code
isValidMultiFormat(String)
This method returns true if the specified format name is a valid multi-page format.
Syntax
public boolean isValidMultiFormat(String formatName);
Remark
Table 4.9: isValidMultiFormat(String) Method Variables
Variable Description formatName The format name
isVectorFormat(int)
This method returns a boolean to determine if the format value is a valid vector format.
Syntax
public boolean isVectorFormat(int formatValue);
Remark
Table 4.10: isVectorFormat(int) Method Variables
Variable Description formatValue The format value
86 Chapter 4 - Input Documents and Images
Methods Called from the Format Class
The methods in this section are called from the Format Class. canSaveBitDepth(int)
This method returns true or false to test for saving to the input bit depth.
Syntax public boolean canSaveBitDepth(int bitDepth);
Remark
Table 4.11: canSaveBitDepth(int) Method Variables
Variable Description bitDepth Number of bits used to represent the color of a single pixel getDisplayName()
This method returns a string name suitable for display.
Syntax public String getDisplayName(); getExtension()
This method returns the standard extension.
Syntax public String getExtension(); getFormatCode()
This method returns RasterMaster Java defined format code.
Syntax public int getFormatCode(); getFormatName()
This method returns a String format name for this Format.
87 Chapter 4 - Input Documents and Images
Syntax
public String getFormatName();
isMultipage()
This method returns true or false to test for saving to multi-page.
Syntax
public boolean isMultipage();
isTiff()
This method returns true or false to test if this is a TIFF file.
Syntax
public boolean isTiff();
isVectorFormat()
This method returns true or false to test for a vector format.
Syntax
public boolean isVectorFormat();
toString()
This method returns a formatted string with all information.
Syntax
public String toString();
Error Code
The method in this section is not part of the FormatHash. It defines the error code.
getErrorMessage(int)
This method returns a string based on the integer error code passed in.
Syntax
public static String getErrorMessage(int errorCode);
88 Chapter 4 - Input Documents and Images
Remark
Table 4.12: getErrorMessage(int) Method Variables
Variable Description errorCode Defines the error code
Working with Document File Formats
Snowbound Software supports many document file formats in most of its viewing, converting, and RasterMaster® SDK products.
The supported file formats include:
l PDF - Adobe portable file
l PCL - Hewlett Packard printer format
l DOC - Microsoft Word processor format
l XLS - Microsoft Excel spreadsheet format
l PPT - Microsoft PowerPoint presentation format
l RTF - Rich text file format
l AFP and MODCA - IBM advanced printing format
These formats, like any other file formats supported by Snowbound Software’s products, are read in using a call such as IMG_decompress_bitmap(String, int) . Snowbound Software’s products auto-detect the file format so there is no need to specify which format you are reading. You don’t even need a specific extension.
These formats contain graphics commands such as line and text drawing. This differs from bitmap formats that are a 2-dimensional array of bytes forming a picture. Normally, documents are drawn or rendered to a bitmap inRasterMaster Java, but RasterMaster Java can also produce searchable text documents. The PDF file created can be searched for words or phrases with the use of a text searching application. Please note that the only currently supported input formats for creating searchable PDF output are AFP/MO:DCA, PTOCA, PCL, RTF, DOC (MS Word), and MS Excel files. For more information on creating PDF files that are text searchable, please see Extracting Text for Searchable PDF output.
The rendering size for the bitmap can be set by the following call to Snowbound Software’s library:
IMGLOW_set_document_input(int dpi, int bits_pix, int format);
Table 4.13: IMGLOW_set_document_input Method Variables
89 Chapter 4 - Input Documents and Images
Variable Description dpi Sets the document in dots per inch. Sets the bits per pixel. 1 = black and white documents bits_pix 8 = grayscale or color images 24 = color images format Specifies the document type to alter.
Saving
This method sets the destination size for saving PDF files. The xsize and ysize are the output sizes in points. A point is 1/72 of an inch. Only PDF, PCL, and AFP file formats can be saved. The PCL and APF file formats are saved as bitmap. The PDF file format can be saved as bitmap or searchable text.
You can specify the output size with PDF using the IMGLOW_set_pdf_output(int, int) call.
IMGLOW_set_pdf_output(int xsize,int ysize);
Table 4.14: IMGLOW_set_pdf_output Method Variables
Variable Description xsize The destination width of the image after resizing. ysize The destination height of the image after resizing.
CCITT - G4 compression for black and white images. For more information on improving performance, please see Improving Performance in Chapter 8.
Working with Color Images
For color bitmaps, a PDF will be created with JPEG compression.
Reading Multiple Pages
All Snowbound libraries decompress a single page at a time. This section describes the read multi-page formats and how to decompress and determine page count.
Supported Multi-page Formats
RasterMaster Java currently supports the following multi-page formats:
l TIFF
l MO:DCA/IOCA
l PDF
90 Chapter 4 - Input Documents and Images
l PCL
l MS Word - Reading
l MS Excel - Reading
l RTF - Reading
Decompressing a Multi-page Image
Each page must be decompressed then saved separately. In other words, a decompress then save must be performed for each page.
Determining Multi-page Page Count
You can keep decompressing pages until a PAGE NOT FOUND or -11 error is returned from the decompress method, or you can query the number of pages with the IMGLOW_get_pages method. See IMGLOW_get_pages(java.io.DataInputStream) and IMGLOW_get_pages(String) for more information.
Table 4.15: Supported Multi-page Methods
Method Description Detects the number of pages in a file. See IMGLOW_get_ IMGLOW_get_pages() pages(String) for more information. Reads pages and specifies the specific page to import. See IMG_decompress_bitmap(java.io.DataInputStream, IMG_decompress_bitmap() int) and IMG_decompress_bitmap(String, int) for more information on these methods.
For more information on the methods used or multi-page formats, click on the links below:
l IMGLOW_get_pages(java.io.DataInputStream)
l IMGLOW_get_pages(String)
l IMG_decompress_bitmap(java.io.DataInputStream, int)
l IMG_decompress_bitmap(String, int)
Extracting Text for Searchable PDF output
The document conversion feature extracts and converts vector or document file formats such as AFP/MO:DCA, PCL, and MS Word to vector PDF format. The PDF file will be in a true vector format, meaning that it will not be in a bitmap format. The PDF file will retain the original text and graphics commands. Font information such as the font typeface, font height, and
91 Chapter 4 - Input Documents and Images
bold/Italic attributes will remain the same. This allows the output PDF file to be created as text searchable. The PDF file created can be searched for words or phrases with the use of a text searching application. Please note that the only currently supported input formats for creating searchable PDF output are AFP/MO:DCA, PTOCA, PCL, DOC (MS Word), and MS Excel files.
Conversion and text extraction occur in the following two step process:
A call is made to extract the text, graphics, and bitmap data. The IMGLOW_extract_text() method extracts text, graphics, and position information from the file name passed in. The buffer returned is used as an argument in the call to write out the new PDF file. See IMGLOW_ extract_text(String, int, int, int) for more information.
The IMG_save_document() method takes a buffer passed in with text, graphics, and position information to create the document file output. The output file contains searchable text. Normally, the IMG_save_bitmap() methods only create a bitmap file. This only supports the PDF file as an output file. See IMG_save_document(String, byte, int) and IMG_save_ document(byte, byte, int) for more information.
The IMGLOW_extract_text(String, int, int, int) method extracts the specified page from a multi- page document. IMGLOW_extract_page differs from IMG_decompress_image in that it preserves the format of the original page rather than converting it to the Snowbound common raster format. The currently supported input formats are raster PDF, searchable PD,F and TIFF.
Methods Used for Save Searchable PDF
The Saving to Searchable PDF: The saveSearchablePDF Sample sample extracts the text from the input document and saves it as a searchable PDF. The user can also specify a text string to search for by assigning a value to the stringToSearch variable. You can find the samples in the following directory: [RM Java install dir] \Samples\com\snowbound\samples. For more information on the methods used in the Saving to Searchable PDF: The saveSearchablePDF Sample sample, click on one of the links below:
l IMG_save_document(String, byte, int)
l IMGLOW_get_pages(String)
l IMGLOW_extract_text(String, int, int, int)
l IMGLOW_search_text(byte[], String, int, int, int[])
Working with RasterMaster Java’s Vector Display Technology
This section describes how to work with Snowbound Software’s vector display technology. The Working with Vector PDF vs. Raster PDF: The VectorPDF Sample sample demonstrates how to use vector PDF. This sample is comprised of an applet and an application. You can find the
92 Chapter 4 - Input Documents and Images samples in the following directory: [RM Java install dir] \Samples\com\snowbound\samples.
Information about ’s Vector Display Technology
Vector display technology gets its name from the fact that it was originally designed to display, convert, and manipulate bitmap or raster graphics. These are files that contain just an array of bytes that form a grid of pixels or dots. Anything can be contained in the array, such as color images or plain text. There is no way to easily tell. Vector graphics such as PDF, MS Word, and MS Excel files contain commands that tell the viewer to display text or graphics at specific positions. Graphics could be lines, circles, or other shapes. In the past, all Snowbound products would rasterize or draw the text and graphics commands into an off screen buffer which would then be imported into the main code as a bitmap image. The main problem with this approach is one of resolution, or fidelity of the image being displayed. Bitmap images contain a finite array of pixels. When zoomed enough, the display just makes each pixel bigger. An image then becomes pixelated or blocky, sometimes referred to as the jaggies.
The new vector display technology will no longer rasterize the image, but instead it will store the list of graphic commands for an image. At display time, the image is drawn directly to the monitor screen, and each time the image is displayed it is redrawn. This can be a little slower than displaying a bitmap image, but the benefit is infinite resolution. The new display is no longer making pixels bigger, but instead it redraws text and graphics at a larger size. Lines, circles, graphics, etc. remain smooth since they are continually redrawn to match the appropriate zoom level. Text remains at a perfect quality since a larger font is selected for each successive zoom level. An example benefit would be for large engineering drawings, which can contain thousands of graphic commands. They can continually be zoomed to provide more and more detail.
Implementing ’s Vector Display Technology
If you are an existing customer, implementation is simple. Just set the public variable as follows: Simage.decomp_vect = true;
The decompress and display methods listed below will work the same:
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) or IMG_display_bitmap(java.awt.Graphics, int, int, int, int)
Currently, ’s vector display technology is only available for PDF images. Other formats such as MS Word, MS Excel, PowerPoint, and AFP are currently in development.
Methods Used for Vector PDF
The Working with Vector PDF vs. Raster PDF: The VectorPDF Sample sample demonstrates how to use vector PDF. This sample is comprised of an applet and an application. You can find
93 Chapter 4 - Input Documents and Images
the samples in the following directory: [RM Java install dir] \Samples\com\snowbound\samples. For more information on the methods used in the Working with Vector PDF vs. Raster PDF: The VectorPDF Sample sample, click on one of the links below:
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image. displays the current image, corrected for aspect ratio, at the current X and Y coordinates
l IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) displays the current image, corrected for aspect ratio, at the current X and Y coordinates
l IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int) prints the current image at the specified coordinates.
PDF Redaction Support
RasterMaster Java supports redacting PDFs while preserving PDF text searchability. The process of redacting removes any strings that intercept a rectangle or rectangles passed in as arguments to the IMGLOW_redact_page methods. The strings are totally removed from the PDF file. All of the characters are replaced by the space character. The methods know the position and width and height of the area to redact.
IMGLOW_redact_page(String, String, rarray, int , int)
This method supports PDF redaction by removing any strings that intercept a rectangle or rectangles passed in as arguments to this method.
Syntax
int IMGLOW_redact_page(String inputFile, String outputFile, Rectangle2D.Double[] rarray, int page, int color)
Remarks
Table 4.16: IMGLOW_redact_page Method Variables
Variable Description inputFile The input file. outputFile The output file. Rectangle2D.Double[] A rectangle or rectangles passed in as arguments. page Page number to read. color Color to fill.
Returns
94 Chapter 4 - Input Documents and Images
Returns the area to redact. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 4.2: IMGLOW_redact_page Sample
{ try { RedactionInterface redactionFilter = (RedactionInterface) FilterManager .getFormatFilter(".pdf"); return redactionFilter.redactPage(inputFile, outputFile, rarray, page, color); } catch (ClassNotFoundException cnfe) { return ErrorCodes.DLL_NOT_LOADED; } }
IMGLOW_redact_page(DataInputStream, rarray, int, int)
This method supports PDF redaction by removing any strings that intercept a rectangle or rectangles passed in as arguments to this method.
Syntax int IMGLOW_redact_page(String inputFile, Rectangle2D.Double[] rarray, int page, int color)
Remarks
Table 4.17: IMGLOW_redact_page Method Variables
Variable Description inputStream DataInputStream containing file data. Rectangle2D.Double[] A rectangle or rectangles passed in as arguments. page Page number to read. color Color to fill.
Returns
Returns the area to redact. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
95 Chapter 4 - Input Documents and Images
AFP Specific Considerations
AFP files can use specific fonts to achieve a particular look. If you find that the fidelity of the output for your AFP documents is lacking, particularly in regards to text size and spacing or barcodes, then you can customize RasterMaster Java to use particular fonts when processing your AFP files. RasterMaster Java is easy to customize to improve the look of your AFP documents. Snowbound Software allows you to map the fonts in your AFP/MODCA document to fonts on your system using a mapping file named snbd_map.fnt. The snbd_map.fnt file is custom crafted to specify the fonts used in your AFP files and on your system. If you provide a representative sample AFP document to Snowbound Software by entering a support issue at http://support.snowbound.com, we will provide you with a custom snbd_map.fnt file usually in a few business days that will improve the display and print quality of your AFP documents.
RasterMaster Java automatically loads the customized snbd_map.fnt file if you place it in one of the following directories:
l The directory into which images are being read. For example: C:\\AFP\\fontmap
l The directory where your application exists as long as you are not changing directories with a dialog box
The following methods allow you to set font mapping:
1. The IMGLOW_set_fontmap_path() method sets the path of the font mapping file. See IMGLOW_set_fontmap_path(String) for more information.
2. The IMGLOW_set_fontmap() method programmatically sets the font mapping. See IMGLOW_set_fontmap(byte[], int) for more information.
Format of Font Mapping Data
Any AFP font name can now be mapped to the following:
l face name
l point size
l bold attributes
l italic attributes
The snbd_map.fnt file is a simple ASCII text file. Each entry is ended with a carriage return line feed. The following are two sample entries:
C0BC25I3,Courier,10,0,0
C0CGT12S,Times New Roman,14,0,1
Table 4.18: Description of a sample entry in the snbd_map.fnt file
96 Chapter 4 - Input Documents and Images
Variable Description C0BC25I3 Font resource name in the AFP file. Courier New face name to map to. 10 New size in points or 1/72 of an inch. 0 Bold attribute, 0 - off , 1 - on. 0 Italic attribute 0 - off, 1 - on.
IMGLOW_set_fontmap_path(String)
This method defines the path where Snowbound Software will look for the font mapping file, snbd_map.fnt. If the path is not currently set, RasterMaster Java looks for it in the current directory. The current directory is whatever folder the program is currently in, usually wherever the file being decompressed is located.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
Syntax int IMGLOW_set_fontmap_path(String path);
Remark
Table 4.19: IMGLOW_set_fontmap_path(String) Method Variables
Variable Description A string pointer to the path to look for the snbd_map.fnt file. The snbd_map.fnt file will be appended to the path path name. For example: IMGLOW_set_fontmap_path ("c:\\temp");
Returns
Returns the status of the path of the font mapping file. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_fontmap(byte[], int)
This method programmatically sets font mapping.
Syntax int IMGLOW_set_fontmap(byte font_map[], int len);
97 Chapter 4 - Input Documents and Images
Remarks
Table 4.20: IMGLOW_set_fontmap Method Variables
Variable Description Pointer to font mapping data. This is the whole buffer of data found in the font map file, snbd_map.fnt. This variable overrides existing font mapping in the snbd_map.fnt file.
font_map The following are some examples of the data in this variable:
C0H400xx90,PrecisionID Postnet L DEMO,12,0,0
C0BPOSBX,CCodePostnet,10,0,0 len The integer length of font mapping data
Returns
Returns the status of the font mapping data. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_overlay_path(String)
This method sets the path for finding overlay files. Some formats, such as MOD:CA, can contain references to overlay files. If set to null, overlay files will be ignored and only the bitmap will be decompressed.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
Syntax
int IMGLOW_set_overlay_path(String st);
Remark
Table 4.21: IMGLOW_set_overlay_path(String) Method Variables
Variable Description st Specify path of overlay files.
Returns
98 Chapter 4 - Input Documents and Images
Returns the status of the path of overlay files. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
PDF Specific Considerations
Reading and writing support for PDF formats is included in the following Imaging SDK products:
l Imaging SDK for Windows DLL
l Imaging SDK for ActiveX
l Imaging SDK for .NET
l Imaging SDK for the Java™ Platform
Currently, Snowbound Software does not provide PDF reading support in UNIX and Macintosh products. Snowbound Software does provide PDF writing support for its UNIX and Macintosh products.
PDF reading is available as a separate option. For the Imaging SDK for Java, a special PDF version is available. For the other products, the pdfplug.dll file is required for PDF reading support. This file must be included in the same directory as the ActiveX, .NET library, or DLL. You can also include the file in the following directory: \Windows\system.
Reading or Decompressing a PDF Document
To read in or decompress a PDF document, use any of the decompression calls such as IMG_ decompress_bitmap(String, int) . All Imaging SDK products automatically detect the file format and do not use the extension on the file name.
The default size for decompressing PDF documents is 200 dots per inch (DPI) and 24 bits per pixel. To alter this or to convert PDF files, you can call the IMGLOW_set_pdf_input(int, int) method.
Saving to a PDF Document
Imaging SDK products support writing PDF files. To save a file as PDF, use any of the saving calls such as IMG_save_bitmap() with the file format set to PDF or the file type constant number 59.
RasterMaster Java can save to two different types of PDF files; raster PDF and vector PDF. IMG_save_bitmap(byte, int, int, int) saves a rasterized PDF with high fidelity rendering. IMG_ save_document(byte, byte, int) ouputs a vector PDF with text that can be searched so vector PDF is also known as searchable PDF. Currently, the text output is limited to ASCII.
Working with Black and White Images
99 Chapter 4 - Input Documents and Images
If you are working with black and white documents, you will save a lot of memory and increase performance by setting the DPI to 300 or 200 and the bits per pixel to 1 when reading PDF images. For 1-bit or black and white images, will write out or save a PDF with CCITT - G4 compression for black and white images. For more information on improving performance, please see Improving Performance in Improving Performance or Quality.
Working with Color Images
For color bitmaps, a PDF will be created with JPEG compression.
Changing Output Page Size
The default page size is set to 8.5 x 11. The bitmap image saved is centered at this page. To alter the output page size, use the call the IMGLOW_set_pdf_output(int, int) method. The xsize and ysize parameters are the page size in points or 1/72 of an inch.
Performance
If you are working with black and white documents, you will save a lot of memory and increase performance by setting the DPI to 300 or 200 and the bits per pixel to 1 when reading all document formats. For more information on improving performance, please see Improving Performance in Improving Performance or Quality.
Office 2007 - 2010 Specific Considerations
This section describes the Imaging SDK for the Java Platform Open Office XML (OOXML) format methods.
Imaging SDK for the Java Platform Microsoft Office plugin supports the seamless conversion of Word 2007 and Excel 2007 documents which use the OOXML format. These documents are frequently stored with the file extension .docx/.xlsx.
The IMG_decompress_bitmap(String, int) . method will automatically detect OOXML format files and process them when the Aspose products library has been installed and setup. If the Aspose library is not found by , the system will return the error code DLL_NOT_LOADED (-24).
IMGLOW_get_ooxml_license_path()
This method returns the name of the jar file containing the Aspose license file or null if the Aspose license file is not found.
Please note that Aspose licenses must be named as follows:
Note: If you have an evaluation copy of installed, please remove the Aspose.Total.Product.Family.lic file when you install your purchased version with the Office 2007-2010 option.
100 Chapter 4 - Input Documents and Images
l Aspose.Total.Product.Family.lic for 30-day evaluations.
l Aspose.Words.Java.lic, Aspose.Cells.Java.lic and Aspose.Slides.Java.lic for product licenses. These licenses will not expire as long as they are used with the version of the product with which they were delivered.
Syntax
String IMGLOW_get_ooxml_license_path();
Returns
Returns the name of the jar file containing the Aspose license file or null if the license file is not found. The error returned will be for the last product that was loaded. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_ooxml_license()
This method searches the Java CLASSPATH to find a jar that contains a valid Aspose license or an evaluation license. If the license is found, then the license is loaded and validated. This takes no parameters.
If you set the path to the file in IMGLOW_set_ooxml_license, it calls that specific file. If you leave the method blank, it searches jar files. For example: IMGLOW_set_ooxml_license ("C:\\Aspose\\License\\Aspose.Slides.Java.lic") - calls the license file.
IMGLOW_set_ooxml_license() - search for the license files in all jars listed in the classpath.
Note: This method is deprecated. Please use the IMGLOW_get_ooxml_license_path method instead and rename your Aspose licenses to Aspose.Words.Java.lic, Aspose.Cells.Java.lic and Aspose.Slides.Java.lic for product licenses.
If no license file is found, then the OOXML_LICENSE_NOT_FOUND (-52) error message is returned.
If the license is found but it is invalid, then OOXML_LICENSE_EXPIRED (-53) error message is returned.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
101 Chapter 4 - Input Documents and Images
Syntax
String IMGLOW_set_ooxml_license();
Returns
Returns the last error encountered while loading the products. The error returned will be for the last product that was loaded. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_ooxml_license_input_stream(InputStream)
This method sets or loads the OOXML license from an InputStream.
Note: The IMGLOW_get_ooxml_license_path method is the preferred method to return the name of the jar file containing the Aspose license file or null if the Aspose license file is not found. Please make sure that your Aspose licenses are named Aspose.Words.Java.lic, Aspose.Cells.Java.lic and Aspose.Slides.Java.lic for product licenses.
Syntax
int IMGLOW_set_ooxml_license_input_stream(InputStream inputStream);
Remark
Table 4.22: IMGLOW_set_ooxml_license_input_stream(InputStream) Method Variables
Variable Description inputStream InputStream containing the license.
Returns
Returns the OOXML license from an InputStream. The error returned will be for the last product that was loaded. See Appendix D, Snowbound Error Codes for a list of error codes.
Ensuring Java Reading for Text-based Formats
This section describes how to read PDF, AFP, Word, HTML, PCL, and ASCII images in Java on UNIX-based operating systems when using the Imaging SDK for the Java platform.
Overview
To read PDF, AFP, Word, HTML, PCL, and ASCII images in Java on other UNIX-based operating systems, Snowbound software uses the Abstract Windowing Toolkit (AWT). In Solaris, calls into the java.awt package will trigger a connection to the X11 Windowing
102 Chapter 4 - Input Documents and Images environment. Since servers often operate as headless, or without a display, there is no X11 environment. The result is a NoClassDefFound error, similar to the following: java.lang.NoClassDefFoundError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:115) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment( GraphicsEnvironment.java:53) at java.awt.image.BufferedImage.createGraphics (BufferedImage.java:1006)
Depending on the JDK version, the following are solutions to this problem:
JDK 1.4 or greater
In JDK 1.4 and above, instruct the JDK to operate as a headless server, by setting a java run time option as follows: java -Djava.awt.headless=true
In many cases, setting this option involves modifying the start-up script to your application server (often JAVA_OPTIONS or JAVA_OPTS).
103 Chapter 5 - Output Documents and Images
Chapter 5 - Output Documents and Images
This chapter describes how to output an image or document to a different file format and the available save methods for the Snow.Snowbnd class.
Image Compression
This section describes compressed images.
Preferred Formats
Most of the compression algorithms only compress a specific type of image data. Compression techniques for 24-bit color images usually do not work well on 1-bit or bi-level images. Similarly, compression for 1-bit images do not compress well for 24-bit color images.
24-Bit Color Images
For 24-bit color images, use the JPEG format in RasterMaster Java for the best conversion results.
8-Bit Gray Scale Images
For 8-bit gray scale images, use the JPEG format in RasterMaster Java for the best conversion results.
1-bit Bi-Level Images
For 1-bit bi-level images, use the TIFF G4 in RasterMaster Java for the best conversion results. The JBIG format works about twenty percent better than the TIFF G4 format, but it can be much slower.
Saving to a Raster Image Format
This section describes the methods available to save to the raster image format.
IMG_save_bitmap(byte, int)
This method saves the current Snowbnd image object to a byte array. Multi-page saving to a byte array is supported for MO:DCA and TIFF only. There is no way to know how large the image will be once compressed.
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the getBitsPerPixel(void) method.
104 Chapter 5 - Output Documents and Images
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats in Appendix A, Supported File Formats for details on what bit-depths are available for each format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Notes: To save multiple pages for other formats, see IMG_save_bitmap(String, int) and Supported File Formats for more information. This method returns a length of the compressed image in the byte array.
Syntax
byte[]IMG_save_bitmap(byte array[] b, int comp_type);
Remark
Table 5.1: IMG_save_bitmap(byte, int) Method Variables
Variable Description array Byte array in which to save. Output file format to write. The output constants for comp_type currently supported and unsupported file types are defined in Appendix A, Supported File Formats.
Returns
Returns the value of the output file size in bytes.
IMG_save_bitmap(byte, int, int, int)
This method saves the current Snowbnd image object to a returned byte array. Multi-page TIFF and PDF file formats are supported.
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the getBitsPerPixel(void) method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image.See the Supported Bit Depths for Image Formats in Appendix A, Supported File Formats for details on what bit-depths are available for each format.
105 Chapter 5 - Output Documents and Images
Notes: To save multiple pages for other formats, see IMG_save_bitmap(String, int) and Supported File Formats for more information. This method returns a length of the compressed image in the byte array.
Syntax int IMG_save_bitmap(byte dos[], int buff_inc, int comp_type, int error[]);
Remark
Table 5.2: IMG_save_bitmap(byte, int, int, int) Method Variables
Variable Description dos Buffer to use. buff_inc Amount that the buffer will grow if needed. Output file format to write. The output constants for comp_type currently supported and unsupported file types are defined in Appendix A, Supported File Formats. Returns the size of the data. If the value is less than 0, error then an error code is displayed.
Returns
Returns the value of the output file size in bytes.
IMG_save_bitmap(int, int, int, int)
This method is designed to allow saving to a byte array without knowing or guessing the final size of the compressed image or document. First, the initial size parameter is allocated. If the output data saved becomes larger than the initial size, then the buffer is reallocated to initial_size plus the increment size specified by buff_inc. Each time the output data becomes larger than the current buffer size when saving, the buffer is increased in size by the increment size. The caller must be careful in choosing the buffer increment size. If the buffer increment is too small, multiple reallocations will cause the saving process to be slow. If it is too large, too much memory will be allocated.
Note: Snowbound Software recommends an increment size of 10-25% of the initial buffer size.
Group 4 compression found in TIFF and AFP file formats typically compress at a rate of 10:1. You can choose an initial size of 1/8 to 1/10 of the uncompressed size.
A JPEG file format typically compresses at a rate of 10:1.
106 Chapter 5 - Output Documents and Images
An LZW file format found in TIFF and GIF file formats compress at a rate of about 3:1. A .zip or flate file found in a PNG file format also compresses at a rate of about 3:1.
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the getBitsPerPixel(void) method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats in Appendix A, Supported File Formats for details on what bit depths are available for each format.
Note: Compression results for your images may vary. For best results, test a number of images to see what the resultant output size will be. Also, it is suggested to test out smaller and larger increment sizes to find the best level of performance.
Syntax
byte[] IMG_save_bitmap(int initial_size, int buff_inc, int comp_ type, int error[]);
Remark
Table 5.3: IMG_save_bitmap(int, int, int, int) Method Variables
Variable Description initial_size The buffer is initially allocated to this size exactly. buff_inc The amount to grow the buffer if needed. Output file format to write. The output constants for comp_type currently supported and unsupported file types are defined in Appendix A, Supported File Formats. Returns the size of the data. If the value is less than zero, error it is an error code.
Returns
Returns the value of the output file size in bytes.
IMG_save_bitmap(String, int)
This method saves the current Snowbnd image object to the format specified by comp_type. The string value is the output file.
TIFF is a multi-page file format. If the image name already exists, a new page or image is appended to the local file, leaving the current images unchanged. If the file does not exist, it is created with only one page.
107 Chapter 5 - Output Documents and Images
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the getBitsPerPixel(void) method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats in Appendix A, Supported File Formats for details on what bit-depths are available for each format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l Simple Conversion with Timeouts: The HangDetector Sample
l The Swing Sample
Note: Only applications and signed applets can save to a file.
Syntax int IMG_save_bitmap(String st, int comp_type);
Remark
Table 5.4: IMG_save_bitmap(String, int) Method Variables
Variable Description st Output filename in which to save. Output file format to write. The output constants for comp_type currently supported and unsupported file types are defined inAppendix A, Supported File Formats.
Returns
Returns the value of the output file size in bytes.
Saving to a Vector Format - Searchable PDF
This section describes the methods available to save to a vector format as a searchable PDF.
IMG_save_document(String, byte, int)
This method saves extracted text to a searchable PDF file.
108 Chapter 5 - Output Documents and Images
Note: Only applications and signed applets can save to a file.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the Saving to Searchable PDF: The saveSearchablePDF Sample sample.
Syntax
int IMG_save_document(String bm_name, byte vbuff[], int filetype);
Remark
Table 5.5: IMG_save_document(String, byte, int) Method Variables
Variable Description bm_name Name of file to save to. vbuff[] Byte array of extracted text and graphics. File type to save to. Currently, the file type to save to is filetype only PDF.
Returns
Returns the filename or file type to save to. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_save_document(byte, byte, int)
This method saves extracted text to a searchable PDF file.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the Saving to Searchable PDF: The saveSearchablePDF Sample sample.
Syntax
int IMG_save_document(byte dos[], byte vbuff[], int filetype);
Remark
Table 5.6: IMG_save_document(String, byte, int) Method Variables
Variable Description dos[] Destination byte array buffer to save to. vbuff[] Byte array of extracted text and graphics. File type to save to. Currently, the file type to save to is filetype only PDF.
109 Chapter 5 - Output Documents and Images
Returns
Returns the filename or file type to save to. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Saving to Multiple Pages
This section describes how to save and convert multi-page images in RasterMaster Java.
Multi-page Images
All Snowbound libraries decompress a single page at a time. This section describes the multi- page formats and how to decompress, determine page count, and save multi-page images.
Supported Multi-page Formats
RasterMaster Java currently supports the following multi-page formats:
l TIFF
l MO:DCA/IOCA
l PDF
l PCL
l MS Word - Reading
l MS Excel - Reading
l RTF - Reading
Decompressing a Multi-page Image
Each page must be decompressed then saved separately. In other words, a decompress then save must be performed for each page.
Determining Multi-page Page Count
You can keep decompressing pages until a PAGE NOT FOUND or -11 error is returned from the decompress method, or you can query the number of pages with the IMGLOW_get_pages method. See IMGLOW_get_pages(java.io.DataInputStream) and IMGLOW_get_pages(String) for more information.
Saving Multi-page File Formats
110 Chapter 5 - Output Documents and Images
When saving to a multi-page file format, keep in mind that all RasterMaster Java products append or add new pages to an image file if the file already exists. If you do not want to keep saving to the same file, you must first delete the page or save each page to a unique file name
Methods Used for Multi-page Format Methods
Table 5.7: Supported Multi-page Methods
Method Description Detects the number of pages in a file. See IMGLOW_get_ IMGLOW_get_pages() pages(String) for more information. Reads pages and specifies the specific page to import. See IMG_decompress_bitmap(java.io.DataInputStream, IMG_decompress_bitmap() int) and IMG_decompress_bitmap(String, int) for more information on these methods. Saves multi-page images.
For an existing file, new pages are appended.
For new files, new pages with the specified name are created as necessary. IMG_save_bitmap() Note: Use a unique filename when saving to multi-page formats; otherwise, images are automatically appended to any file with the same name.
See IMG_save_bitmap(byte, int) and IMG_save_bitmap (String, int) for more information on these methods.
For more information on the methods used for saving multi-page formats, click on the links below:
l IMG_save_bitmap(String, int)
l IMG_save_bitmap(byte, int)
RasterMaster® SDK Library
This section describes how to change the DPI in the RasterMaster® SDK library.
Changing the DPI in the RasterMaster® SDKLibrary
When the library decompresses an image, it is converted into an MS-Windows device independent bitmap (DIB), which contains a header for the width, height, and also the dots per inch.
To change or look at the DPI information from an image use the following code:
Example 5.1:Changing the DPI in the RasterMaster® SDK Library
111 Chapter 5 - Output Documents and Images
int xDPI, yDPI xDPI = Simage.getXdpi() yDPI = Simage.getYpdi() if (xDPI < 300 || yDPI < 300) { Simage.setXdpi(300); Simage.setYdpi(300); }
112 Chapter 6 - RasterMaster® SDK Image Data Format
Chapter 6 - RasterMaster® SDK Image Data Format
Overview of Data Formats
This chapter describes the formats for decompressed and compressed images. All high-level and low-level methods which decompress or import images convert the data and store it in memory as the MS Windows DIB format (Device Independent Bitmap), which consists of the following:
l Header (DIB_Head)
l Palette
l Image data
All formats are converted to either 1, 4, 8, or 24-bits.
MS_Windows DIB Header Format
All images stored in memory start with the following header.
Example 6.1: DIB Header Format
public class_Dib_Head public int biSize; public int biWidth; public int biHeight; public short biPlanes; public short biBitCount; public int biCompression; public int biSizeImage; public int biXPelsPerMeter; public int biYPelsPerMeter; public int biClrUsed; public int biClrImportant;
Note: In RasterMaster Java V12.6, the pelsPerMeter attribute queries return the actual
113 Chapter 6 - RasterMaster® SDK Image Data Format
value contained in the attribute. In previous versions, the bi{X/Y}PelsPerMeter would return a default value of 100 if the value was not set in the image. This method resulted in there being no way to tell if RasterMaster Java was returning the default value or the actual value that was set. Beginning with RasterMaster Java V12.6, it will return the actual value even if it is 0. If you want to preserve the previous behavior, you can add a check to see if the bi{X/Y}pelsPerMeter attribute is valued at 0. If it is valued at 0, replace it with 100.
MS_Windows DIB Palette Format
All images stored in memory except for 24-bit images have a series of the following RGBQUAD structures. An RGBQUAD structure exists for each possible color.
Table 6.1: MS_Windows DIB Palette Format
Image Size RGBQUAD Entries 1-bit 2 4 bit 16 8 bit 256 24-bit No Entries
All images stored in memory have the following palette format:
Example 6.2: MS_Windows DIB Palette Format
public class RGBQUAD { public byte rgbBlue; public byte rgbGreen; public byte rgbRed; public byte rgbReserved; {
MS_Windows DIB Image Data Format
1, 4, 8, and 24-bit images are stored as packed uncompressed raster data.
All rasters must end on a long or a multiple of 4 bytes. Extra bytes are added to rasters not meeting this criterion. They are stored with upside down or the last raster first up to the first or line 0.
114 Chapter 6 - RasterMaster® SDK Image Data Format
The raw image data may be much larger than the input document because the image data is not compressed. The size of the image data will depend on the resolution (DPI) and bits per pixel of the input document.
l Please see Determining Memory Requirements for more information on how to calculate the expected size of the raw image data.
l Please see IMGLOW_set_document_input for information on how to adjust the resolution and bits per pixel of the input document.
l Please see Converting File Formats for how to adjust from one resolution (dpi) to another.
The image data is a series of rasters, parallel lines that make up the rectangular image. Each raster is stored as a series of pixels or runs. A run is a series of pixels that are all the same color. All rasters must end on a long or a multiple of 4 bytes. Extra bytes are added to rasters not meeting this criterion. They are stored with upside down or the last raster first up to the first or line 0.
Table 6.2: MS_Windows DIB Image Data Format
Image Size Byte Size 1-bit 8 pixels 4-bit 2 pixels 8- bit 1 pixel 24-bit 3 bytes equals 1 pixel, starting with the blue, green, then red values
For black and white images, each run is stored as a 32-bit integer. The first wordint is a byte count of the entire raster including the byte count wordint. This is followed by a white then a black column. The line alternates from white to black until the end of the raster.
A line always starts with a white column. If the first pixel is black, the first white entry is then zero. The line must end with at least three entries for the horizontal width.
Example 6.3: WORDINT
For a raster or width of 100. DWORDINT 0 - 12 Total byte count. DWORDINT 1 - 5 White until pixel 5. WORDINT 2 - 10 Black from pixel 5 to pixel 10. WORDINT 3 - 100 White to end of raster. DWORDINT 4 - 100 DWORDINT 5 - 100
RasterMaster® SDK Library
This section describes how to change the DPI in theRasterMaster® SDK library.
115 Chapter 6 - RasterMaster® SDK Image Data Format
Changing the DPI in the RasterMaster® SDK Library
When the library decompresses an image, it is converted into an MS-Windows device independent bitmap (DIB), which contains a header for the width, height, and also the dots per inch.
To change or look at the DPI information from an image use the following code:
Example 6.4: Changing the DPI in the RasterMaster® SDK Library
int xDPI, yDPI
xDPI = Simage.getXdpi() yDPI = Simage.getYpdi()
if (xDPI < 300 || yDPI < 300) {
Simage.setXdpi(300); Simage.setYdpi(300); }
116 Chapter 7 - Snowbound Classes
Chapter 7 - Snowbound Classes
This chapter describes the Snowbound classes.
Snow.Snowbnd
This is the main class in the SDK. The default constructor for Snowbnd objects is a nullary constructor. It represents one image and all of the operations that you can perform on that image. It is the main API class through which operations such as decompress, rotate, scroll, zoom, and others are performed. See Snowbnd(int, int, int) for an alternative Snowbnd object constructor. Please see the field descriptions below and for method descriptions, see Class Snow.Snowbnd Methods. alias
This field sets the aliasing factor for the specified image. It is used to turn aliasing on or off for a specific image when one or more images are loaded in memory.
Syntax
Simage.alias = value;
Remark
Table 7.1: alias Settings
Setting Description 0 Use no anti-aliasing. Preserve Black. Forces the Snowbnd object not to skip 1 black pixels when being scaled down for display. Preserve black works best for large engineering drawings. (Default) Scale to gray. Converts the image to 8-bit aliased 2 grayscale for display. Scale to gray works best for documents. Scale to Color. Performs anti-aliasing for color images. 3 Scale to color works best for color images with text, such as brochures, magazines, and newspaper flyers. Alias All. Turns on Scale to Gray and Scale to Color. All 1- 4 bit black and white and color documents will be anti- aliased. alias_quality
This field sets the effectiveness of scale to gray and preserve black algorithms for anti-aliasing for black and white images when using the preserve black option. This field changes the amount of detail preserved when scaling down large images.
117 Chapter 7 - Snowbound Classes
Remark
Table 7.2: alias_quality Settings
Setting Description Discard maximum amount of data when scaling down 1 images. (Default) Take every pixel into account when scaling down 100 images.
decomp_vect
This field sets the ability to decompress a vector PDF file.
Syntax
boolean decomp_vect = true;
Remark
Table 7.3: decomp_vect Settings
Setting Description true If set to true, decompress a vector PDF file. false If set to false, do not decompress a vector PDF file.
dis_crop_xs, dis_crop_ys, dis_crop_xe, dis_crop_ye
The fields dis_crop_xs, dis_crop_ys contain the last cropping rectangle coordinates. The fields dis_crop_xe, dis_crop_ye contain the horizontal and vertical sizes of the cropped rectangle in pixels. All are set when set_croprect, set_croprect_scroll, or IMG_set_croprect is called, or when the image is zoomed. These fields are typically used to retrieve the cropping rectangle.
See set_croprect(int, int, int, int), set_croprect_scroll(java.awt.Container, int, int, int, int, int), and IMG_set_croprect(int, int, int, int) for more information.
Syntax
int cropX = Simage.dis_crop_xs; int cropY = Simage.dis_crop_ys; int cropXsize = Simage.dis_crop_xe; int cropYsize = Simage.dis_crop_ye;
Remark
Table 7.4: dis_crop_xs, dis_crop_ys, dis_crop_xe, and dis_crop_ye Fields
Field Description dis_crop_xs Position of the top edge of the last cropping rectangle dis_crop_ys Position of the left edge of the last cropping rectangle
118 Chapter 7 - Snowbound Classes
Field Description dis_crop_xe Width size of cropped rectangle in pixels dis_crop_ye Height size of cropped rectangle in pixels
Returns
Integer dis_dib
This field returns an instance of the Snow.Dib class representing the internal format for all 4, 8, 16, 24, and 32-bit images. The internal format is a Windows DIB (Device Independent Bitmap). This is the currently displayed image.
See Chapter 6, Formats for Decompressed and Compressed Images for more information on the DIB format.
Returns
Snow.Dib. This class represents a structure for the internal format of images in memory. dis_height, dis_width
These fields return the height and width of the display System.Windows.Forms.Paneljava.awt.Container. They return the height and width of the Container minus any offsets or translation from java.awt.Graphics.translate.
Syntax int dis_height = Simage.dis_height; int dis_width = Simage.dis_width;
Remark
Table 7.5: dis_height and dis_width Fields
Field Description dis_height Height of display rectangle dis_width Width of display rectangle
Returns
Integer dis_rotate
This field is the current display rotation angle. It is set any time display_angle is called. The display rotation angle can only be in 90 degree increments, but this field’s value is in hundredths of a degree. Thus, for 90 degrees, it has a value of 9000.
See display_angle(int) for more information.
119 Chapter 7 - Snowbound Classes
Syntax
int dis_angle = Simage.dis_rotate;
Remark
Table 7.6: dis_rotate Fields
Field Description dis_rotate Current display rotation angle
Returns
Integer
dis_runs_ptrs[] []
This field contains an array of pointers to each compressed raster for 1-bit images. The first array dimension represents the rows. The second array dimension represents each compressed raster broken into bytes.
See Chapter 6, Formats for Decompressed and Compressed Images paying special attention to the information on 1-bit images.
dis_xs, dis_ys, dis_xsize, dis_ysize
These fields return the last display coordinates. They are set any time IMG_display_bitmap or IMG_display_bitmap_aspect are called, and represent the coordinates passed to those methods.
See IMG_display_bitmap(java.awt.Graphics, int, int, int, int) and IMG_display_bitmap_aspect (java.awt.Graphics, java.awt.Container, int, int, int, int, int) for more information.
Syntax
int start_x = Simage.dis_xs; int start_y = Simage.dis_ys; int x_size = Simage.dis_xsize; int y_size = Simage.dis_ysize;
Remark
Table 7.7: dis_xs, dis_ys, dis_xsize, and dis_ysize Fields
Field Description dis_xs Position of top edge of last displayed rectangle dis_ys Position of left edge of last displayed rectangle dis_xsize Width of last displayed rectangle dis_ysize Height of last displayed rectangle
Returns
120 Chapter 7 - Snowbound Classes
Integer hsb, vsb
These fields arejava.awt.ScrollBar objects that control panning and scrolling. They are standard heavyweight ScrollBars. This means that they always display on top of lightweight components (Swing components, for example).
They are automatically turned on (made visible) when the zoom or shape of the container cannot display the entire image. They are made public in order to intercept scroll events.
See IMG_scroll_bitmap(java.awt.Container, java.awt.Event) for more information on scrolling in the SDK.
PrintStack
This field, when set to true, returns a printout of the stack trace for any exception. threshold
This field allows the ability to set the threshold value for the Color Manipulation Methods method or when converting a color or an 8-bit grayscale image to a 1-bit format such as TIFF G4.
Adjust the threshold when you see light colored content disappear when a document is being converted from color to black and white. Increasing the threshold value will cause lighter content to be preserved during the conversion. To remove light-colored artifacts, the threshold value should be decreased.
Syntax
Simage.threshold = value;
Remark
Table 7.8: threshold Settings
Setting Description Sets the threshold when converting a color or an 8-bit 0-255 grayscale image to a 1-bit format such as TIFF G4. The default vaule is 128.
VERSION_MAJOR
This field sets the major version number.
Syntax public static final int VERSION_MAJOR = 12;
VERSION_MAJOR
121 Chapter 7 - Snowbound Classes
This field sets the minor version number.
Syntax
public static final int VERSION_MINOR = 12;
Snow.SnowAnn
This class is used to create or read annotation objects from a file. The default constructor for SnowAnn takes two parameters, the height and width respectively, of the image object on which to display annotations. This class represents a set of annotation objects for a particular image and all of the operations you can perform on those annotations. For method descriptions, see Class Snow.Snowbnd Methods.
Please see Annotations for RasterMaster Java for more information on the methods in class Snow.SnowAnn. It contains the following topics:
l ann_dblclick(java.awt.Container, int, int)
l GetClientRect(java.awt.Container, Snow.SANN_RECT)
l SANN_activate_all_objects(void)
l SANN_activate_object(java.awt.Container, int)
l SANN_add_object(int, Snow.SANN_RECT, byte[], Snow.SANN_POINT[], int)
l SANN_deactivate_all_objects(void)
l SANN_deactivate_object(int)
l SANN_delete_all_objects(void)
l SANN_delete_object(int)
l SANN_display_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int)
l SANN_draw_object(java.awt.Graphics, int, int, int, int, int)
l SANN_flipx(void)
l SANN_flipy(void)
l SANN_get_croprect(Snow.SANN_RECT)
l SANN_get_graphic_struct(int)
122 Chapter 7 - Snowbound Classes
l SANN_get_object_bounds(int, Snow.SANN_RECT)
l SANN_get_object_data(int, byte[])
l SANN_get_object_info(int)
l SANN_get_object_num(java.awt.Container, int, int)
l SANN_highlight_object(java.awt.Container, Snow.SANN_RECT, int)
l SANN_map_image_to_wnd(java.awt.Container, java.awt.Point)
l SANN_map_wnd_to_image(java.awt.Container, java.awt.Point)
l SANN_merge_annotations(Snowbnd, java.awt.Container)
l SANN_move_object(int, Snow.SANN_RECT)
l SANN_output_pdf(double, double, double, doublet, int, in)
l SANN_read_ann(DataInputStream, int)
l SANN_read_ann(String)
l SANN_read_ann(String, int)
l SANN_read_ann_stream(String, int)
l SANN_resize_object(int, Snow.SANN_RECT)
l SANN_rotate(int)
l SANN_set_bcolor(int, int, int)
l SANN_set_croprect(int, int, int, int)
l SANN_set_fcolor(int, int, int)
l SANN_set_font(String, int, int, int)
l SANN_set_line_style(int)
l SANN_set_line_width(int)
l SANN_set_scrollbars(int)
123 Chapter 7 - Snowbound Classes
l SANN_set_size(int, int)
l SANN_write_ann(byte[], int, byte[])
l SANN_write_ann(String, int, byte[])
l SANN_write_ann_fnx(String, String, int, byte[])
l SANN_write_ann_idm(String, String, String, int)
l SANN_write_ann_idm(String, String, int, int)
l SANN_write_ann_pages(String, int, byte[])
l SANN_write_ann_pages(byte[], int, byte[])
l SANN_write_ann_xml(byte[], Snow.SnowXMLWriter)
l SANN_write_ann_xml_document(Snow.SnowXMLWriter)
l SANN_write_ann_xml_page(Snow.SnowXMLWriter)
l ui_delete(java.awt.Container)
l ui_exit(void)
l ui_startmove(java.awt.Container)
l ui_startresize(java.awt.Container)
l ui_wm_lbuttondown(java.awt.Container, int, int, byte[])
l ui_wm_lbuttonup(java.awt.Container, int, int, byte[])
l ui_wm_mousemove(java.awt.Container, int, int, byte)
Snow.Defines
This class contains the format file type constants used to identify and save images. See Supported File Formats for a list of file type constants.
Snow.ANN_GRAPHIC_STRUCT
124 Chapter 7 - Snowbound Classes
This is the main class for annotations. It represents an annotation object in its internal format for theRasterMaster® SDK.
Note: This object is typically not used, and is provided for developers who want to create their own annotation objects or store annotation objects in a database.
Constructing a New SnowAnn Object
To construct a new SnowAnn object, use the code below.
Syntax
ANN_GRAPHIC_STRUCT AGS SANN_get_object_info(graphic_num);
Remark
Table 7.9: ANN_GRAPHIC_STRUCT Class Variables
Variable Description ANN_GRAPHIC_STRUCT next Next Annotation object ANN_GRAPHIC_STRUCT prev Previous Annotation object SANN_RECT rc Rectangle byte text[] Byte array of text EdithWnd edit_hwnd Text area int data_size Size of data in bytes int fhmem Used internally int hmem Used internally int thmem Used internally int imhandle Image handle String font_name Name of font int italic Indicates italicized font int bold Indicates bold font int font_height Font height int fred Red plane of foreground color int fblue Blue plane of foreground color int fgreen Green plane of foreground int bred Red plane of background color int bblue Blue plane of background color int bgreen Green plane of background color int width Width of annotation object int height Height of annotation object int bits_pix Bits per pixel of image int transp Indicates transparency int graphic_id Annotation object type int line_width Line width
125 Chapter 7 - Snowbound Classes
Variable Description int line_style Line style SANN_POINT freehnd[] Array of SANN_POINT’s for freehand object Image bitmap Bitmap to place an annotation TextArea ta Text Area object for edit
Example 7.1: ANN_GRAPHIC_STRUCT
ANN_GRAPHIC_STRUCT ags = null; //pass in graphic num of annotation object ags = SANN_get_object_info(graphic_num);
Snow.SANN_POINT
This class represents points for the RasterMaster® SDK. It provides two fields representing the x and y axes of a point. It is typically used as an array of SANN_POINTs in determining placement of freehand objects. See Methods Used for Viewing and Annotations for more information on this class.
Syntax
SANN_POINT(int x, int y);
Remark
Table 7.10: SANN_POINT Class Variables
Variable Description x Horizontal coordinate (x-axis) y Vertical coordinate (y-axis)
Snow.SANN_RECT
This class represents rectangles for the RasterMaster® SDK. It provides four fields representing the four sides of a rectangle. This object is used mostly for constructing rectangular annotation objects, such as edits, Post-its, redactions, and more. Coordinates are absolute. See Methods Used for Viewing and Annotations for more information on this class.
To use this class to burn in redactions, you need to merge the annotation using SANN_merge_ annotations(Snowbnd, java.awt.Container) to make a redaction that the user cannot see beneath.
Syntax
SANN_RECT(int left, int top, int right, int bottom);
126 Chapter 7 - Snowbound Classes
Remark
Table 7.11: SANN_RECT Class Variables
Variable Description left Left edge (point on Y axis) as SANN_RECT top Top edge (point on X axis) as SANN_RECT right Right edge (point on Y axis) as SANN_RECT bottom Bottom edge (point on X axis) as SANN_RECT
SnbdWarningCode
This class is used to report document decompression warnings. See IMGLOW_get_warnings() for more information.
The following describes the SnbdWarningCode class:
This class contains a list of warnings that occurred while decompressing a document. Currently, only MS Word documents are supported.
Table 7.12: List of Warnings
Current List of Warnings Value Message WARNING_MISSING_SHAPE 0 "Missing Shape" WARNING_MISSING_IMAGE 1 "Missing Image" WARNING_CORRUPT_IMAGE 2 "Corrupt Image" public boolean hasWarnings()
Returns
Boolean. True if there are warnings. False if there are none. public Vector getWarningCodes()
Returns
Vector containing the list of warnings. public String getWarningMessage(int Index)
Table 7.13: getWarningMessage(int Index) Method Variables
Variable Description Index Index into warning list
Returns
String from warning list at element index.
127 Chapter 7 - Snowbound Classes
public int getWarningCode(int Index)
Table 7.14: getWarningCode(int Index) Method Variables
Variable Description Index Index into warning list
Returns
Integer for the corresponding index into the list.
Example 7.2: getWarningCodeSample
Public Snowbnd sImage = new Snowbnd();
int stat = sImage.IMG_decompress_bitmap(“myFile”, 0);
SnbdWarningCode sWarning = sImage.IMGLOW_get_warnings(); if ( sWarning.hasWarnings() ) { for ( int i = 0; i < sWarning.getWarningCodes().size(); i++ ) { System.out.println( sWarning.getWarningMessage(i) ); } }
128 Chapter 8 - Improving Performance or Quality
Chapter 8 - Improving Performance or Quality
This chapter describes the trade off between performance and quality. To improve performance, the quality of the image may be less. On the other hand, to get the best quality images, your performance may be slower than when converting to lower quality images. This is true whenever working with any imaging software.
Improving Performance
The more colors there are in the input or output image, the bigger the file and the slower the processing speed. To reduce the number of colors and improve performance, reduce the bit depth (bits per pixel) value to grayscale (8-bit) or black and white (1-bit).
Use one of the following color reduction methods to reduce 8-bit and 24-bit images to smaller gray scale images. Please see Color Manipulation Methods for more detailed information.
l IMG_color_gray() converts 24-bit color images to 8-bit gray scale images. Please see IMG_color_gray(void) for more information.
l IMG_resize_to_gray(int xsize, int ysize) resizes a 1-bit black and white image to a (smaller) 8-bit grayscale image. Please see IMG_resize_to_gray(int, int) for more information.
l IMG_diffusion_mono() converts 4, 8 or 24 bit images to 1-bit per pixel bi-level images using the Stucky error diffusion technique. Please see IMG_diffusion_mono(void) for more information.
To improve performance in RasterMaster Java, consider the input file type. To reduce the resolution, reduce the DPI value. If the input file is not a raster image, such as PCL, vector PDF, Word or Excel, use one of the following methods to set the DPI and bit depth prior to decompression. Please see Image Quality Manipulation for more detailed information.
l IMGLOW_set_document_input(int dpi, int bits_pix, int format) converts PDF, Word, Excel, PCL and AFP formats. Please see IMGLOW_set_document_input(int, int, int) for more information.
l IMGLOW_set_pcl_input(int dpi, int bits_pix) converts PCL formats only. Please see IMGLOW_set_pcl_input(int, int) for more information.
l IMGLOW_set_pdf_input(int dpi, int bits_pix) converts PDF formats only. Please see IMGLOW_set_pdf_input(int, int) for more information.
Improving Quality
129 Chapter 8 - Improving Performance or Quality
The output quality of your output document may be much lower than the original document if you convert a high quality image to a low quality output such as TIFF_G4_FAX. Please see the following suggestions to improve the quality of the output document:
l Choose a different output format such as TIFF_LZW to produce an output document with sufficient pixel depth. Supported File Formats shows a list of file formats and their supported bit depths.
l Use one of the following methods prior to decompression to increase the output dots per inch (DPI) or bit depth. Please see Class Snow.Snowbnd Methods for more detailed information.
IMGLOW_set_document_input(int dpi, int bits_pix, int format) converts PDF, Word, Excel, PCL and AFP formats. Please see IMGLOW_set_document_input(int, int, int) for more information.
IMGLOW_set_pcl_input(int dpi, int bits_pix) converts PCL formats only. Please see IMGLOW_ set_pcl_input(int, int) for more information.
IMGLOW_set_pdf_input(int dpi, int bits_pix) converts PDF formats only. Please see IMGLOW_set_pdf_input(int, int) for more information.
Use the color promotion method, IMG_promote_24(void), to promote 1-bit, 4-bit and 8-bit images to 24-bit images. Please see Color Manipulation Methods for more detailed information.
130 Chapter 9 - Image Information Methods
Chapter 9 - Image Information Methods
This chapter describes the available image information methods for the Snow.Snowbnd class. getBitsPerPixel(void)
This method returns the bit depth of the image. See Supported File Formats for more information on the number of bits per pixel of your image.
Syntax int getBitsPerPixel();
Returns
Returns the bit depth of the image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. getCropboxX(void)
This method returns the xpos of the cropbox for vector PDF images.
Syntax double getCropboxX();
Returns
Returns the xpos of the cropbox for vector PDF images. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 9.1: getCropboxXSample
Public double getCropboxX() { if (dis_pPage != null) return dis_pPage.cropbox.x; else return 0; } getCropboxY(void)
131 Chapter 9 - Image Information Methods
This method returns the ypos of the cropbox for vector PDF images.
Syntax
double getCropboxY();
Returns
Returns the ypos of the cropbox for vector PDF images. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 9.2: getCropboxYSample
Public double getCropboxY() { if (dis_pPage != null) return dis_pPage.cropbox.y; else return 0; }
get_fit_to_height()
This method returns the value set by fit_to_height(int).
Syntax
int get_fit_to_height();
Returns
Returns the value set by fit_to_height(int). A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
get_fit_to_width()
This method returns the value set by fit_to_width(int).
Syntax
int get_fit_to_width();
Returns
132 Chapter 9 - Image Information Methods
Returns the value set by fit_to_width(int). A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. getHeight(void)
This method returns the height of the image in pixels.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
Syntax int getHeight();
Returns
Returns the height of the image in pixels. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. getInitialZoom(int, int)
This method calculates the first zoom increment given the image’s height and width. Sometimes images are smaller than the containers in which they display. In that case, the image fits into the container either by height or width. The zoom increment is simply the ratio of screen pixels to image pixels.
For example, if this method returns 35, two zoom operations with a normal zoom increment of 25 are required before the image is noticeably zoomed.
Notes: For the first zoom operation on an image, assuming the scrollbars are off, always zoom the image by at least the amount returned from this method. The getInitialZoom(int, int) method is based on the width and height of the panel. Scrolling will not work unless the image fills the entire panel.
Syntax int getInitialZoom(int xsize, int ysize);
Remark
133 Chapter 9 - Image Information Methods
Table 9.1: getInitialZoom(int, int) Method Variables
Variable Description xsize Panel width in pixels ysize Panel height in pixels
getWidth(void)
This method returns the width of the image in pixels.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
Syntax
int getWidth();
Returns
Returns the width of the image in pixels. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
getXdpi(void)
This method returns the X resolution, in DPI (dots per inch), of the image. For more information, please see Changing the DPI in the RasterMaster Java Library.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
Syntax
int getXdpi();
Returns
Returns the X resolution, in DPI (dots per inch), of the image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
134 Chapter 9 - Image Information Methods getYdpi(void)
This method returns the Y resolution, in DPI(dots per inch), of the image. For more information, please see Changing the DPI in the RasterMaster Java Library.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
Syntax int getYdpi();
Returns
Returns the Y resolution, in dpi (dots per inch), of the image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_get_bitmap_block(int, int, int, int)
This method returns a block of data from the current image and creates a Snowbnd object, where the data is specified by the rectangle constructed from the image’s coordinates. The image can then be displayed, rotated, saved, and more.
Syntax
Snow.Snowbnd IMG_get_bitmap_block(int xs, int ys, int xsize, int ysize);
Remark
Table 9.2: Snow.Snowbnd IMG_get_bitmap_block(int, int, int, int)Method Variables
Variable Description xs Starting X position for the image block ys Starting Y position for the image block xsize Horizontal size of the image block in pixels ysize Vertical size of the image block in pixels
Returns
A new Snowbnd object
135 Chapter 9 - Image Information Methods
IMG_get_deskew_angle(int[], int, int)
This method returns the skew angle for 1-bit images. When scanning multiple pages, images are often slightly skewed or rotated. The values returned in the p_angle[] array should be passed to IMG_deskew_bitmap.
See IMG_deskew_bitmap(int) for more information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax
int IMG_get_deskew_angle(int p_angle[], int start_angle, int end_ angle);
Remark
Table 9.3: IMG_get_deskew_angle(int[], int, int) Method Variables
Variable Description Integer array to return the rotation or skew angle; this array p_angle can have a single element Minimum angle to start (no less than -45 degrees; -20 is start_angle optimum) Maximum angle to test for (no more than 45 degrees; 20 is end_angle optimum)
Returns
Returns the skew angle for 1-bit images. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 9.3: IMG_get_deskew_angle Sample
if (Simage != null) stat = Simage.IMG_get_deskew_angle(pangle, -15, 15);
if (stat >= 0 && pangle[0] != 0) { Simage.IMG_deskew_bitmap(pangle[0]);
136 Chapter 9 - Image Information Methods
repaintRefresh(); }
IMG_get_version(int[], int[])
This method returns the RasterMaster Javaversion id in the two integers that you provide. The first parameter is the major version number and the second is the minor version number. Together, these form the current version number for the RasterMaster® SDK base library. For example, 13 and 0 are version 13.0.
Syntax int IMG_get_version(int major[], int minor[]);
Remark
Table 9.4: IMG_get_deskew_angle(int[], int, int) Method Variables
Variable Description Major version number. For example, returns 13 in version major number 13.0. Minor version number. For example, returns 0 in version minor number 13.0.
Returns
Returns the RasterMaster Java version id. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 9.4: IMG_get_version Sample
int majorVersion[]={0}; int minorVersion[]={0}; s.IMG_get_version(majorVersion, minorVersion); System.out.println("RasterMaster Java version: " + majorVersion[0] + "." + minorVersion[0]);
IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char)
137 Chapter 9 - Image Information Methods
This method can be used to detect blank pages. It can also be used to detect pages that are essentially blank though there are some scan artifacts or other “dirt” on them.
This method returns the percentage of pixels present that are not equal to the passed detection or background color. If autodetect is set to 1, then the detection or background color will be determined automatically and will correspond to the dominant color in the image. The tolerance value can be set to allow for a more lenient color matching the algorithm.
Syntax
double SNBDAPI IMGLOW_detect_blank_page(int hdib, char autodetect, int red, int green, int blue, int tolerance, char isLowQuality, char isLowMemory);
Remark
Table 9.5: IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char) Method Variable
Variable Description hdib Standard RasterMaster® SDK image handle. Auto-detect the background color (0: no; 1: yes). 1 will autodetect force the system to ignore the passed color. 24-bpp: Red component of the detection color. May have the value of [0-255]. 1-bpp/4-bpp/8-bpp: Index value of the red detection color. May have the value of [0-1], [0-127], and [0-255], respectively. Green component of the detection color. Ignored for non- green 24-bpp images. May have the value of [0-255]. Blue component of the detection color. Ignored for non-24- blue bpp images.May have the value of [0-255]. Per color-channel pixel-value match tolerance linear tolerance distance value. Use this value in comparing background pixels. This number is in the range [0-255]. Execute the low-quality version of the autodetect algorithm (0: no; 1: yes). The low-quality version will not guarantee isLowQuality the global maximum, but it will execute much faster. The tolerance level is not taken into consideration. Execute the low-memory version of the autodetect algorithm (0: no; 1: yes). The low-memory version will not isLowMemory guarantee the global maximum. The tolerance level is not taken into consideration. This setting is only for 24-bpp images.
Returns
Double. The percentage of pixels on the page that are not equal to the background color. If the percentage is zero or near zero the page is blank. Note the percentage is a floating point number. For example, a return value of 50.26 means 50.26% of the page is non-blank. Any
138 Chapter 9 - Image Information Methods value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_extract_page(String, int, int)
This method extracts the specified page from a multi-page PDF or TIFF document.
Syntax byte[] IMGLOW_extract_page(String bm_name, int page, int error[]);
Remarks
Table 9.6: IMGLOW_extract_page(String, int, int) Method Variables
Variable Description The filename of the multi-page document from which to bm_name extract page. page The page number to extract starting at 0. One integer array for returning an error code, where non- error zero implies an error code and zero implies no error.
Returns byte[]. A byte array of the extracted page.
IMGLOW_extract_page(java.io.DataInputStream, int, int)
This method allows the extraction of a PDF or TIFF page into a returned buffer. The page parameter will specify the page number starting at 0. An entire complete TIFF or PDF file of a single page will be returned.
Syntax byte[] IMGLOW_extract_page(java.io.DataInputStream di, int page, int error[]);
Remarks
Table 9.7: IMGLOW_extract_page(java.io.DataInputStream, int, int) Method Variables
Variable Description di DataInputStream. page The page number to extract starting at 0. One integer array for returning an error code, where non- error zero implies an error code and zero implies no error.
139 Chapter 9 - Image Information Methods
Returns
byte[]. A byte array of the extracted page.
IMGLOW_extract_text(String, int, int, int)
This method extracts text from PTOCA, PCL, PDF, MS Word, AFP, RTF and MS Excel files. It returns the buffer of extracted text in ASCII format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Loadandsave Sample
l The Printing Sample
l Saving to Searchable PDF: The saveSearchablePDF Sample
Syntax
byte[] IMGLOW_extract_text(String bm_name, int length[], int error [], int page);
Remarks
Table 9.8: IMGLOW_extract_text(String, int, int, int) Method Variables
Variable Description bm_name Name of file from which to extract text. Array for returning a single integer to specify the length of length the buffer to receive extracted text. error Array for returning an integer code. page Page number of file from which to extract text.
Returns
Returns the buffer of extracted text in ASCII format.
Note: Some PDF or PCL files may be in a format that will not allow text searching.
Please note that the sample below is a sample of output.
Example 9.5: IMGLOW_extract_textSample
int length[],error[];
140 Chapter 9 - Image Information Methods
length = new int [2]; error = new int[2];
int stat;
Simage = new Snowbnd(); buff = Simage.IMGLOW_extract_text(FileName,length,error,page);
The extracted text returned in buff will look like the text in the following example,which contains meta-data that is described in Variables Included in Extracted Text:
%%SOF /Page=0 /Width=1700 /Height=2200 /FontName=TimesRoman /FontHeight=44 /FontBold=1 /FontItalic=0 /Xpos=1300 /Ypos=240 %%SOT Devadas %%EOT /Xpos=1253 /Ypos=240 %%SOT S. %%EOT %%EOF
Table 9.9: Variables Included in Extracted Text
Variable Description %%SOF Signals the start of the buffer. %%EOF Marks the end of extracted text. Specified once at the beginning of the file to indicate the Page page number. Specified once at the beginning of the file to indicate page Width width in pixels. Specified once at the beginning of the file to indicate page Height height in pixels. FontName Name of font FontHeight Font height in pixels. Font to be drawn plain or in bold:
FontBold 1 = bold 0 = plain FontItalic Font to be drawn in normal or Italic:
141 Chapter 9 - Image Information Methods
Variable Description 1 = ItIalic 0 = normal Xpos X pos in pixels. Ypos Y pos in pixels. %%SOT Start of text block. %%EOT End of text block.
IMGLOW_get_bitmap_date()
This method gets the Date tag before or after decompressing a TIFF image.
Note: Please see the TIFF 6.0 specification (http://www.adobe.com) for a definition of tags Author 315.
Syntax
int IMGLOW_get_bitmap_date();
Returns
Returns the Date tag. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 9.6: IMGLOW_get_bitmap_dateSample
Public String IMGLOW_get_bitmap_date() { return tiff.get_image_date(); }
IMGLOW_get_bitmap_name()
This method gets the Name or Author and Date tag before saving images to the TIFF format.
Note: Please see the TIFF 6.0 specification (http://www.adobe.com) for a definition of tags Author 315.
Syntax
int IMGLOW_get_bitmap_name();
142 Chapter 9 - Image Information Methods
Returns
Returns the Name or Author and Date tag. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 9.7: IMGLOW_get_bitmap_nameSample
Public String IMGLOW_get_bitmap_name() { return tiff.get_image_name(); }
IMGLOW_get_brightness()
IMGLOW_get_brightness()
This method returns the current brightness set by IMGLOW_set_brightness(int). The default is 0. See IMGLOW_set_bitmap_name(String, String)for more information. int IMGLOW_get_brightness();
Returns
Integer. Any value between -127 and 127.
IMGLOW_get_contrast()
This method returns the current contrast set by IMGLOW_set_contrast(int). The default is 0. See IMGLOW_set_contrast(int) for more information.
Syntax int IMGLOW_get_contrast();
Returns
Integer. Any value between -127 and 127.
IMGLOW_get_fileinfo(java.io.DataInputStream, int)
This method fills in the height, width, and bits-per-pixel without decompressing the entire file. After calling this method, you can call getHeight(void), getWidth(void), getXdpi(void), getYdpi (void), and getBitsPerPixel(void).
Syntax
143 Chapter 9 - Image Information Methods
int IMGLOW_get_fileinfo(java.io.DataInputStream di, int page);
Remark
Table 9.10: IMGLOW_get_fileinfo(java.io.DataInputStream, int)Method Variables
Variable Description filename Filename and path to an image. page Page number of multi-page file.
Returns
Returns the status of the DataInputStream. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_filetype(String)
This method returns the file type of an image. See Appendix A, Supported File Formats or our website (www.snowbound.com) for a current list of supported formats.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l The Swing Sample
Syntax
int IMGLOW_get_filetype(String filename);
Remark
Table 9.11: IMGLOW_get_filetype(String) Method Variables
Variable Description filename Filename and path to an image.
Returns
Returns the status of the DataInputStream. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_filetype(java.io.DataInputStream)
144 Chapter 9 - Image Information Methods
This method returns the filetype of an image. See Appendix A, Supported File Formats or our website (www.snowbound.com) for the most updated list of supported formats.
Note: You cannot read from an InputStream because it does not allow random access to the data. You must use either a string or a DataInputStream that was created from a ByteArray.
Syntax int IMGLOW_get_filetype(DataInputStream dis);
Remark
Table 9.12: IMGLOW_get_filetype(java.io.DataInputStream) Method Variables
Variable Description dis Image in memory.
Returns
Returns the filetype of an image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_gamma()
This method returns the current gamma set by IMGLOW_set_gamma(int). The default is 100. IMGLOW_set_gamma(int) for more information.
Syntax int IMGLOW_get_gamma();
Returns
Returns the current gamma set by IMGLOW_set_gamma(int). Any value between 0 and 400. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_image_orientation(void)
This method returns the orientation of the last image decompressed if the information is available. Orientation is used to determine the display angle.
145 Chapter 9 - Image Information Methods
Note: Currently, TIFF and CALS can return orientation information.
Syntax
int IMGLOW_get_image_orientation();
Returns
Returns the orientation of the last image decompressed. Any value between 0 and 400. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_pages(java.io.DataInputStream)
This method returns the number of pages in a multi-page document. It works for any multi-page format. See Appendix A, Supported File Formats or our website (www.snowbound.com) for a current list of supported formats.
Note: The first page is 0.
Syntax
int IMGLOW_get_pages(DataInputStream dis);
Remark
Table 9.13: IMGLOW_get_pages(java.io.DataInputStream) Method Variables
Variable Description An object containing compressed image data. This usually dis contains a file loaded into memory, and is commonly, but not necessarily, multipaged.
Returns
Returns the number of pages in a multi-page document. A value of 0 or 1 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_pages(String)
146 Chapter 9 - Image Information Methods
This method returns the number of pages in a multi-page document. It works for any multi-page format.See Appendix A, Supported File Formats or our website (www.snowbound.com) for the most updated list of supported formats.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion with Timeouts: The HangDetector Sample
l Saving to Searchable PDF: The saveSearchablePDF Sample
l Simple Conversion: The SimpleConvert Sample
l The Save Page to Memory Sample
l Batch Conversion: The BatchConvert Sample
l Single Conversion: The SingleConversion Sample
l The Thumbnails Sample
l The Color Detection Sample
Note: The first page is 0.
Syntax int IMGLOW_get_pages(String filename);
Remark
Table 9.14: IMGLOW_get_pages(String) Method Variables
Variable Description filename Filename and path to an image.
Returns
Returns the number of pages in a multi-page document. A value of 0 or 1 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_raster(int, byte[])
147 Chapter 9 - Image Information Methods
This method returns the raster line specified by the position on the Y-axis into the array buffer. Data placed in the array is in the DIB format. This is one line of raw, uncompressed data.
Syntax
int IMGLOW_get_raster(int ypos, byte buff[]);
Remark
Table 9.15: IMGLOW_get_raster(int, byte[]) Method Variables
Variable Description ypos Line to retrieve. buff Buffer to hold data.
Returns
Returns the raster line specified by the position on the Y-axis into the array buffer. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_tiff_tag(int, int, int[], java.io.DataInputStream, byte[], int)IMGLOW_get_tiff_ tag(int, int, int[], String, byte[], int)
These methods read a TIFF tag from the file specified. The tag may be either a string returned in buff or an int, short, or byte returned in value.
Note: This method is not thread-safe. The tags are kept in static memory. The tags for TIFF files read in are not saved unless they are in the set needed to create a PDF file. Alternatively, the user can explicitly call IMGLOW_set_tiff_tag for each tag in the original TIFF. The thread-safe workaround is encapsulating the processing of one file in a synchronized block with a class object or a static member as a static lock.
Syntax
int IMGLOW_get_tiff_tag(int tag, int max_bytes, int[] value, String file, byte[] buff, int page);
int IMGLOW_get_tiff_tag(int tag, int max_bytes, int[] value, DataInputStream file, byte[] buff, int page);
Remark
148 Chapter 9 - Image Information Methods
Table 9.16: int IMGLOW_get_tiff_tag(int, int, int [],java.io.DataInputStream, byte[], int) and IMGLOW_get_tiff_tag(int, int, int[], String, byte[], int) Method Variables
Variable Description tag TIFF tag number to return. max_bytes Maximum bytes to read for string tags. Tag value returned: value 1 = String 0 = Non String File to read tags from. If a string is passed in, the file must file be locally accessible. buff String buffer for returning string tags. page Page number for multi-page file.
Returns
Dependent on how value variable is set.
Example 9.8: IMGLOW_get_tiff_tagSample
You can use the TIFF tag to get the colorspace type by specifying tag #262.
Value is what is returned. For this tag you will not need the byte array.
int tag_no = 262; int max_bytes = 0; int[] value = new int[1]; byte[] data = null;
myFrame.Simage.IMGLOW_get_tiff_tag(tag_no, max_bytes, value, st, data, page);
/* PHOTOMETRIC INTERPRETATION */
#define TIFF_PHOTO_WHITE_IS0 0 #define TIFF_PHOTO_WHITE_IS1 1 #define TIFF_PHOTO_RGB 2 #define TIFF_PHOTO_PALETTE 3 #define TIFF_PHOTO_TRANSP 4 #define TIFF_PHOTO_CMYK 5 #define TIFF_PHOTO_YCC 6 #define TIFF_PHOTO_CIELAB 8
IMGLOW_get_warnings()
149 Chapter 9 - Image Information Methods
This method returns a SnbdWarningCode object. It is used to get a list of warnings that occurred while decompressing a document. Currently, warnings are only reported for MS Word documents. For more information, please see Snowbound Classes .
Syntax
public SnbdWarningCode IMGLOW_get_warnings();
Returns
SnbdWarningCode object
Example 9.9: IMGLOW_get_warningsSample
Public Snowbnd sImage = new Snowbnd();
int stat = sImage.IMG_decompress_bitmap(“myFile”, 0);
SnbdWarningCode sWarning = sImage.IMGLOW_get_warnings();
if ( sWarning.hasWarnings() ) { for ( int i = 0; i < sWarning.getWarningCodes().size(); i++ ) { System.out.println( sWarning.getWarningMessage(i) ); } }
IMGLOW_search_text(byte[], String, int, int, int[])
The method returns an array of structures of classes of the type, SNBD_SEARCH_RESULT. For each class or structure there is an array of rectangles. This is to allow a search term to wrap to a new line requiring more than two rectangles to highlight.
The nCount parameter will be set to the number of rectangles required for each instance of a search term. The rectangles will be sorted from the top of the page to the bottom from the left side to the right.
Note: A search returns hits for a whole word instead of individual characters.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
150 Chapter 9 - Image Information Methods
l The Loadandsave Sample
l The Printing Sample
l Saving to Searchable PDF: The saveSearchablePDF Sample
Note: The following file formats are supported: AFP, PCL, PDF, Word and Excel.
Syntax
SNBD_SEARCH_RESULT[] IMGLOW_search_text(byte[] buffer, String search_String, int page, int error[]);
Remark
Table 9.17: IMGLOW_search_text(byte[], String, int, int, int[]) Method Variables
Variable Description Character buffer to search. Returned from a call to buffer IMGLOW_extract_text(String, int, int, int). search_String String for which to search. Is search case sensitive. case_sensitive 0 = Not case sensitive 1 = case sensitive error Error code. internal_extract_text(SnbdFileio, int, int, int)
This method extracts text from PTOCA files. It returns the buffer of extracted text in ASCII format.
Syntax byte[] internal_extract_text(SnbdFileio fh, int length[], int error [], int page);
Remarks
Table 9.18: internal_extract_text(String, int, int, int) Method Variables
Variable Description fh File handle from which to extract text. Array for returning a single integer to specify the length of length the buffer to receive extracted text.
151 Chapter 9 - Image Information Methods
Variable Description error Array for returning an integer error code. page Page number of file from which to extract text.
Returns
Returns the buffer of extracted text in ASCII format.
Example 9.10: internal_extract_textSample
public byte[] internal_extract_text( SnbdFileio fh, int length[], int error[], int page ) { String ext; int stat; byte buff[] = null;
/* test for file type */ if (fh.stat < 0) { error[0] = -2; return null; } ext = new String(" "); ext = get_extension(fh, 0);
152 Chapter 10 - Color Manipulation Methods
Chapter 10 - Color Manipulation Methods
This chapter describes the RasterMaster Java color manipulation methods. The quality of the conversion is determined by the input and output dots per inch resolution and the output compression type. If you go from a higher to a lower resolution or a lossy compression type, then the quality of the image will degrade. Use color reduction methods to create a lower image quality that is smaller in size and is speedier to process. If you go from a higher to a lower resolution or a lossy compression type, then the quality of the image will degrade.
Please note that some formats only support a certain number of bits per pixel, so you may get an unsupported pixel depth error when trying some of these methods. Please see Appendix A, Supported File Formats for the pixel depths of each supported format.
IMG_antique_effect(void)
This method converts color images to look as though they are antique photos. It replaces colors with sepia tones, which are reddish brown monochrome tints. When applied to a photo, they give the picture a warm, antique feeling.
Note: This method only works with 24-bit color images.
Syntax
int IMG_antique_effect();
IMG_color_gray(void)
This method converts 24-bit color images to 8-bit gray scale images.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Batch Conversion: The BatchConvert Sample
l Single Conversion: The SingleConversion Sample
Notes: The quality of the conversion to black and white or grayscale can be enhanced by specifying the alias and alias quality.
153 Chapter 10 - Color Manipulation Methods
We highly recommend the JPEG compression format as the best compression available in our library for photo type images
Syntax
int IMG_color_gray();
Returns
Returns the status of the grayscale image operation. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_deskew_bitmap(int)
This method is a fast rotate for 1-bit skewed images. Use this method after IMG_get_ deskew_angle returns a skew angle. This method rotates only from -45 to 45 degrees, but is much faster than IMG_rotate_bitmap for 1-bit images. For best results, use values of -20 to 20.
See IMG_get_bitmap_block(int, int, int, int) and IMG_rotate_bitmap(int) for more information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples.This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Note: When a call is made to IMG_deskew_bitmap, the internal Snowbound image object is stored in memory for viewing. The method needs to be saved to the library for the change to be permanent.
Syntax
int IMG_deskew_bitmap(int rot_angle);
Remark
Table 10.1: IMG_deskew_bitmap(int) Method Variables
Variable Description rot_angle Angle to rotate image
Returns
154 Chapter 10 - Color Manipulation Methods
Returns the angle to rotate the image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_despeckle_bitmap(int)
This method removes noise (random pixel data) from 1-bit images. This method works only with 1-bit images. The quality variable can accept a range of 100 values. A similar method is also available called IMG_despeckel_bitmap.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Note: When a call is made to IMG_despeckle_bitmap, the internal Snowbound image object is stored in memory for viewing. The method needs to be saved to the library for the change to be permanent.
Syntax int IMG_despeckle_bitmap(int quality);
Remark
Table 10.2: IMG_despeckle_bitmap(int) Method Settings
Setting Description 1 Minimum noise reduction 30 Normal noise reduction 100 Maximum noise reduction
Returns
Returns the status of the noise reduction. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_detect_color()
This method checks all pixels to determine if the image is color or grayscale. In documents with a mix of black and white and color pages, you can improve performance and reduce the output document size by ensuring the black and white pages are saved as 1-bit per pixel
155 Chapter 10 - Color Manipulation Methods
(monochrome) rather than 24-bits per pixel (color). Use this method to detect the presence of grayscale or color pixels on the current page. If the bit depth returned by this method is less than the bit-depth returned by getBitsPerPixel(void) in biBitCount, then you should consider converting to a lower bit per pixel format. Snowbound Software recommends converting to CCITT_TIFF_G4 format for black and white text images.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Thumbnails Sample
l The Color Detection Sample
Notes: The quality of the conversion to black and white or grayscale can be enhanced by specifying the alias and alias quality. We highly recommend the JPEG compression format as the best compression available in our library for photo type images.
Syntax
int SNBDAPI IMGLOW_detect_color(void);
Returns
Returns the bits per pixel of the image. If this method returns 1, then this image contains only black and white pixels. If this method returns 8, then this image contains grayscale data such as black and white photo or shaded graphics. If this method returns 24, then this image contains at least some content that uses full color. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 10.1: IMGLOW_detect_colorSample
public int IMGLOW_detect_color()
int pages = tSimage.IMGLOW_get_pages(st);
System.out.println("Pages - " + pages);
int x,bits_pix; for (x = 0;x < pages; x++) { stat = tSimage.IMG_decompress_bitmap(st,x); bits_pix = tSimage.IMGLOW_detect_color(); if (bits_pix == 24)
156 Chapter 10 - Color Manipulation Methods
tSimage.IMG_save_bitmap("c:\\temp\\mix_ java.tif",Snow.Defines.TIFF_LZW); else { if (bits_pix == 8) tSimage.IMG_thresh_mono();
tSimage.IMG_save_bitmap("c:\\temp\\mix_ java.tif",Snow.Defines.TIFF_G4_FAX); } }
IMG_diffusion_mono(void)
This method permanently converts 4, 8, or 24 bit images to 1-bit per pixel bi-level images using the Stucky error diffusion technique.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
Notes: The quality of the conversion to black and white or grayscale can be enhanced by specifying the alias and alias quality. We highly recommend the JPEG compression format as the best compression available in our library for photo type images IMG_decompress_bitmap must be called before IMG_diffusion_mono. It is designed for use on rasterized pages. It cannot be used on pages with vector content created by IMGLOW_extract_text.
Syntax int IMG_diffusion_mono();
Returns
Integer. Any positive value (as well as 0) is a valid return.
IMG_histogram_equalize()
157 Chapter 10 - Color Manipulation Methods
This method is a histogram equalization which improves the dynamic range of 8-bit gray scale images by remapping pixels based on a probability algorithm. This method works only with 8-bit images.
Syntax
int IMG_histogram_equalize();
Returns
Returns the status of the histogram equalize operation. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_invert_bitmap(void)
This method inverts the current image, changing pixels by a simple XOR operation applied to each byte of the image in memory. For bi-level images, this method changes black to white and white to black.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax
int IMG_invert_bitmap(void);
Returns
Returns the invert status of the current image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_promote_8(void)
This method permanently converts the current 1, 4, 16, or 24-bit image to 8 bit.
Syntax
int IMG_promote_8();
Returns
158 Chapter 10 - Color Manipulation Methods
Returns the standard library image handle. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_promote_24(void)
This method permanently converts the current 1, 4, or 8-bit image to a 24-bit image. This automatically disables anti-aliasing for 1-bit images.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Batch Conversion: The BatchConvert Sample
l Single Conversion: The SingleConversion Sample
Syntax int IMG_promote_24();
Returns
Returns the standard library image handle. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_remove_red_eye(int, int, int, int)
This method detects and converts photos of people with very red eyes to more natural colors.
Notes: If xpos, ypos, xsize, or ysize is set to -1, the entire photo is searched. For best results, refine the search area. This method works only with 24-bit color images.
Syntax int IMG_remove_red_eye(int xpos, int ypos, int xsize, int ysize);
Remarks
Table 10.3: IMG_remove_red_eye(int, int, int, int) Method Variables
159 Chapter 10 - Color Manipulation Methods
Variable Description xpos Starting top left area for x coordinate ypos Starting top left area for y coordinate xsize Width of area to search ysize Height of area to search
IMG_rgb_to_cmyk(void)
This method converts the current image from 24-bit RGB data to 32-bit CMYK data. RasterMaster® SDK products support full 32-bit CMYK data as an internal 32-bit DIB format. The black plane is created.
Syntax
int IMG_rgb_to_cmyk();
Returns
Returns the status of the convert RGB to CMYK operation. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_sharpen_bitmap(int)
This method sharpens or blurs the image. Positive values sharpen the image using a Laplacian method while negative values blur the image using an image-averaging filter.
Syntax
int SNBDAPI IMG_sharpen_bitmap(int sharpness);
Remark
Table 10.4: IMG_sharpen_bitmap(int) Method Variables
Variable Description sharpness Integer value from -127 to 127
Returns
Returns the sharpen bitmap operation. A value of 0 indicates success. Returns a FORMAT_ NOT_ALLOWED error message for 1-bit (black and white) images and for 4-bit or 8-bit color images. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 10.2: IMG_sharpen_bitmapSample
160 Chapter 10 - Color Manipulation Methods
Snowbnd snow = new Snowbnd(); snow.IMG_decompress_bitmap("c:/test.tif", 0); snow.IMG_sharpen_bitmap(127); // sharpens snow.IMG_save_bitmap("c:/test.sharpened.tif", 0);
Snowbnd snow = new Snowbnd(); snow.IMG_decompress_bitmap("c:/test.tif", 0); snow.IMG_sharpen_bitmap(-127); // blurs snow.IMG_save_bitmap("c:/test.blurred.tif", 0);
IMG_thresh_mono(int)
This method permanently converts 4, 8, or 24-bit images to 1-bit per pixel using a threshold passed as the second argument. For more information see the PrintStack field for the Snow.Snowbound class.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Thumbnails Sample
l The Color Detection Sample
Syntax int IMG_thresh_mono(int threshold);
Remark
Table 10.5: IMG_thresh_mono(int) Method Variables
Variable Description Sets the threshold value to use when converting a color or threshold an 8-bit grayscale image to a 1-bit format such as Tiff G4. The range is from 1 - 255. The default value is 128.
Returns
Returns the standard library image handle. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
161 Chapter 11 - Photo Editing Methods
Chapter 11 - Photo Editing Methods
This chapter describes the RasterMaster Java photo editing methods. The quality of the conversion is determined by the input and output dots per inch resolution and the output compression type. If you go from a higher to a lower resolution or a lossy compression type, then the quality of the image will degrade. Use color reduction methods to create a lower image quality that is smaller in size and is speedier to process. If you go from a higher to a lower resolution or a lossy compression type, then the quality of the image will degrade.
Please note that some formats only support a certain number of bits per pixel, so you may get an unsupported pixel depth error when trying some of these methods. Please see Appendix A, Supported File Formats for the pixel depths of each supported format.
IMG_antique_effect(void)
This method converts color images to look as though they are antique photos. It replaces colors with sepia tones, which are reddish brown monochrome tints. When applied to a photo, they give the picture a warm, antique feeling.
Note: This method only works with 24-bit color images.
Syntax
int IMG_antique_effect();
IMG_auto_crop_bitmap(int, int)
This method finds and clips any white border around the image in all directions. The border is discarded and the image is resized to the new cropped rectangle plus the margin.
The margin may be a value of 0.
Note: This function only works with 1-bit images. If you use this method with an image that is not a 1-bit image, you will get a PIXEL_DEPTH_UNSUPPORTED (-21) error message. See Appendix D, Snowbound Error Codes for a list of error codes.
Syntax int IMG_auto_crop_bitmap(int hdib, int margin);
162 Chapter 11 - Photo Editing Methods
Remark
Table 11.1: IMG_auto_crop_bitmap(int, int) Method Variables
Variable Description hdib Standard RasterMaster Java image handle margin Number of pixels to add to the autocrop rectangle
Returns
Returns the standard RasterMaster® SDK image handle. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_despeckle_bitmap(int)
This method removes noise (random pixel data) from 1-bit images. This method works only with 1-bit images. The quality variable can accept a range of 100 values. A similar method is also available called IMG_despeckel_bitmap.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Note: When a call is made to IMG_despeckle_bitmap, the internal Snowbound image object is stored in memory for viewing. The method needs to be saved to the library for the change to be permanent.
Syntax
int IMG_despeckle_bitmap(int quality);
Remark
Table 11.2: IMG_despeckle_bitmap(int) Method Settings
Setting Description 1 Minimum noise reduction 30 Normal noise reduction 100 Maximum noise reduction
Returns
163 Chapter 11 - Photo Editing Methods
Returns the status of the noise reduction. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_erase_rect(int, int, int, int, int, int, int)
This method fills the inside or outside of the specified rectangle (xs, ys, xsize, and ysize parameters) with the color passed in. It can be used to remove borders, for instance.
For 24-bit images, the color value must be a RGB-packed pixel; 1 byte red, 1 byte green, and 1 byte blue. For 1-bit black and white images, only the least significant bit is used.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax int IMG_erase_rect(int xs, int ys, int xsize, int ysize, int color, int in_outflag, int operation);
Remark
Table 11.3: IMG_erase_rect(int, int, int, int, int, int, int) Method Variables
Variable Description xs Start X coordinate of rectangle in pixels ys Start Y coordinate of rectangle in pixels xsize Width of rectangle in pixels ysize Height of rectangle in pixels color Color to fill 1 = fill inside rectangle in_outflag 0 = fill outside rectangle to the borders of the image 1 = xor image rectangle operation 0 = fill image
Example 11.1: IMG_erase_rectSample
if (ssb.Simage != null) { int width = ssb.Simage.getWidth(); int height = ssb.Simage.getHeight();
164 Chapter 11 - Photo Editing Methods
ssb.Simage.IMG_erase_rect(width / 20, height / 20, width (width / 10), height (height / 10),0xffffff, 0, 0); } repaintRefresh();
IMG_flip_bitmapx(void)
This method flips the image horizontally to produce a mirror image. Positive X coordinates along the X-axis are swapped with negative X coordinates, and vice versa.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax
int IMG_flip_bitmapx();
Returns
Returns the status of the X coordinate. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_flip_bitmapy(void)
This method flips the image vertically to produce a mirror image. Positive Y coordinates along the Y-axis are swapped with negative Y coordinates, and vice versa.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax
int IMG_flip_bitmapy();
Returns
165 Chapter 11 - Photo Editing Methods
Returns the status of the Y coordinate. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_histogram_equalize()
This method is a histogram equalization which improves the dynamic range of 8-bit gray scale images by remapping pixels based on a probability algorithm. This method works only with 8-bit images.
Syntax int IMG_histogram_equalize();
Returns
Returns the status of the histogram equalize operation. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_remove_red_eye(int, int, int, int)
This method detects and converts photos of people with very red eyes to more natural colors.
Notes: If xpos, ypos, xsize, or ysize is set to -1, the entire photo is searched. For best results, refine the search area. This method works only with 24-bit color images.
Syntax int IMG_remove_red_eye(int xpos, int ypos, int xsize, int ysize);
Remarks
Table 11.4: IMG_remove_red_eye(int, int, int, int) Method Variables
Variable Description xpos Starting top left area for x coordinate ypos Starting top left area for y coordinate xsize Width of area to search ysize Height of area to search
IMG_resize_bitmap(int, int)
166 Chapter 11 - Photo Editing Methods
This method changes the internal size of the image according to the input parameters. The size of the source image is not relevant.
The parameters are the page height and width measured in pixels. For an A4 size page at 200 DPI, set IMG_resize_bitmap(2336, 1656) as shown in the following example:
11.69 inches high * 200 dpi = 2336 height in pixels 8.27 inches wide * 200 dpi = 1656 width in pixels
To preserve aspect ratio:
hres is the destination width. vres the destination height.
Set the width and height to the original width and height of the image after decompress as shown in the following example:
Example 11.2: Preserving Aspect Ratio
vres = (int)((long)height * hres / width); IMG_resize_bitmap(hres,vres);
See IMG_resize_bitmap_bicubic(int, int) for important details on the algorithm (linear interpolation) used by this method, and for more details on creating high-quality thumbnails.
Note: IBM AFP printers require the width of an image to be an exact multiple of 8. To be on the safe side, set the width to a multiple of 8.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
l The Swing Sample
Note: Do not use this method for zooming; you will permanently alter the image data.
Syntax
int IMG_resize_bitmap(int hres, int vres);
Remark
167 Chapter 11 - Photo Editing Methods
Table 11.5: IMG_resize_bitmap(int, int) Method Variables
Variable Description hres New horizontal size of the image vres New vertical size of the image
Returns
Returns the size of the horizontal or vertical image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_resize_bitmap_bicubic(int, int)
This method scales down images using a bicubic interpolation algorithm. It is good for creating high-resolution color image thumbnails. Since this operation is floating-point intensive, it is not as fast as IMG_resize_bitmap which uses a linear interpolation.
Bicubic interpolation takes a four pixel by four pixel block and produces an average of those pixels by weighting the value of the pixel in the average based on its distance from the origin pixel. Pixels farther away have less effect on the resulting pixel’s value than do its nearest neighbors.
Linear interpolation takes two pixels, separated by x pixels, and averages the two pixels to create an in-between value. These three pixels (the two original pixels and the newly created in- between pixel), are used to represent the original x + 2 pixels (the two original pixels as end points plus all of the pixels in between).
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the The Thumbnails Sample sample.
Syntax int IMG_resize_bitmap_bicubic(int xsize, int ysize);
Remark
Table 11.6: IMG_resize_bitmap_bicubic(int, int) Method Variables
Variable Description xsize Target width of image in pixels ysize Target height of image in pixels
Returns
Returns the target width or height of the image in pixels. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
168 Chapter 11 - Photo Editing Methods
IMG_rotate_bitmap(int)
This method rotates the current image clockwise by display angle. This permanently rotates the image in memory. For fast rotation at display time (image is not altered in memory), call display_angle. See Photo Editing Methods for more information.
Note: It is expected behavior that the image is smaller in each rotation using IMG_rotate_ bitmap. If an image is rotated by 90 degrees, RasterMaster Java flips from portrait to landscape (or vice-versa) and preserves the page content. If the image is rotated by something other than 90 degrees, RasterMaster Java shrinks the page so that all the content is preserved. RasterMaster Java does not crop the edges during the rotation.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax
int IMG_rotate_bitmap(int angle);
Remark
Table 11.7: IMG_rotate_bitmap(int) Method Variables
Variable Description Angle to rotate image by, in hundredths of a degree. For angle example, to rotate an image by 90 degrees, enter 9000.
Returns
Returns the angle to rotate image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_sharpen_bitmap(int)
This method sharpens or blurs the image. Positive values sharpen the image using a Laplacian method while negative values blur the image using an image-averaging filter.
Syntax
int SNBDAPI IMG_sharpen_bitmap(int sharpness);
Remark
169 Chapter 11 - Photo Editing Methods
Table 11.8: IMG_sharpen_bitmap(int) Method Variables
Variable Description sharpness Integer value from -127 to 127
Returns
Returns the sharpen bitmap operation. A value of 0 indicates success. Returns a FORMAT_ NOT_ALLOWED error message for 1-bit (black and white) images and for 4-bit or 8-bit color images. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 11.3: IMG_sharpen_bitmapSample
Snowbnd snow = new Snowbnd(); snow.IMG_decompress_bitmap("c:/test.tif", 0); snow.IMG_sharpen_bitmap(127); // sharpens snow.IMG_save_bitmap("c:/test.sharpened.tif", 0);
Snowbnd snow = new Snowbnd(); snow.IMG_decompress_bitmap("c:/test.tif", 0); snow.IMG_sharpen_bitmap(-127); // blurs snow.IMG_save_bitmap("c:/test.blurred.tif", 0);
IMGLOW_detect_color()
This method checks all pixels to determine if the image is color or grayscale. In documents with a mix of black and white and color pages, you can improve performance and reduce the output document size by ensuring the black and white pages are saved as 1-bit per pixel (monochrome) rather than 24-bits per pixel (color). Use this method to detect the presence of grayscale or color pixels on the current page. If the bit depth returned by this method is less than the bit-depth returned by getBitsPerPixel(void) in biBitCount, then you should consider converting to a lower bit per pixel format. Snowbound Software recommends converting to CCITT_TIFF_G4 format for black and white text images.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Thumbnails Sample
l The Color Detection Sample
Notes: The quality of the conversion to black and white or grayscale can be enhanced by
170 Chapter 11 - Photo Editing Methods
specifying the alias and alias quality. We highly recommend the JPEG compression format as the best compression available in our library for photo type images.
Syntax
int SNBDAPI IMGLOW_detect_color(void);
Returns
Returns the bits per pixel of the image. If this method returns 1, then this image contains only black and white pixels. If this method returns 8, then this image contains grayscale data such as black and white photo or shaded graphics. If this method returns 24, then this image contains at least some content that uses full color. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 11.4: IMGLOW_detect_colorSample
public int IMGLOW_detect_color()
int pages = tSimage.IMGLOW_get_pages(st);
System.out.println("Pages - " + pages);
int x,bits_pix; for (x = 0;x < pages; x++) { stat = tSimage.IMG_decompress_bitmap(st,x); bits_pix = tSimage.IMGLOW_detect_color(); if (bits_pix == 24)
tSimage.IMG_save_bitmap("c:\\temp\\mix_ java.tif",Snow.Defines.TIFF_LZW); else { if (bits_pix == 8) tSimage.IMG_thresh_mono();
tSimage.IMG_save_bitmap("c:\\temp\\mix_ java.tif",Snow.Defines.TIFF_G4_FAX); } }
171 Chapter 12 - Image Display Methods
Chapter 12 - Image Display Methods
This chapter describes the available image display methods for the Snow.Snowbnd class. display_angle(int)
This method rotates the image at display time. The data itself is not changed, but the image is painted at the requested angle. This method is extremely fast, and is the recommended method for rotating when it is unnecessary to permanently change the image data.
See IMG_rotate_bitmap(int) for more information.
Syntax void display_angle(int angle);
Remark
Table 12.1: display_angle(int) Method Settings
Setting Description The display angle. Valid values are 0, 90, 180, and 270 angle degrees.
Example 12.1: display_angleSample
if (myPanel.Simage != null) { myPanel.Simage.display_angle(0); myPanel.repaint(); } finalize(void)
This method is a recommended call when a Snowbnd object is no longer needed.
Notes: If scrollbars are used, failure to call this method may result in a resource leak. Calling this method before the system has completed all requested operations may result in NullPointerExceptions or ArrayIndexOutOfBoundsExceptions. It is important to be particularly vigilant when calling this method in multithreaded environments.
172 Chapter 12 - Image Display Methods
Syntax
void finalize();
fit_to_height(int)
This method turns on an internal flag that forces the IMG_display_bitmap_aspectmethod to display by fitting the width of the image to the height of the Container, minus the height of the scroll bars, if any.
See IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) for more information.
Syntax
void fit_to_height(int flag);
Remark
Table 12.2: fit_to_height(int) Method Variables
Variable Description 0 = Method is off flag 1 = Method is on
Example 12.2: fit_to_heightSample
myPanel1.zoom = 0; myPanel1.Simage.fit_to_height(1); myPanel1.repaint();
fit_to_width(int)
This method turns on an internal flag that forces the IMG_display_bitmap_aspect method to display by fitting the width of the image to the width of the Container, minus the width of the scroll bars, if any.
See IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) for more information.
Syntax
void fit_to_width(int flag);
Remark
173 Chapter 12 - Image Display Methods
Table 12.3: fit_to_height(int) Method Variables
Setting Description 0 Method is off 1 Method is on
Example 12.3: fit_to_widthSample
myPanel1.zoom = 0; myPanel1.Simage.fit_to_width(1); myPanel1.repaint();
IMG_auto_crop_bitmap(int, int)
This method finds and clips any white border around the image in all directions. The border is discarded and the image is resized to the new cropped rectangle plus the margin.
The margin may be a value of 0.
Note: This function only works with 1-bit images. If you use this method with an image that is not a 1-bit image, you will get a PIXEL_DEPTH_UNSUPPORTED (-21) error message. See Appendix D, Snowbound Error Codes for a list of error codes.
Syntax int IMG_auto_crop_bitmap(int hdib, int margin);
Remark
Table 12.4: IMG_auto_crop_bitmap(int, int) Method Variables
Variable Description hdib Standard RasterMaster® SDK image handle margin Number of pixels to add to the autocrop rectangle
Returns
Returns the standard RasterMaster® SDK image handle. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_auto_orient(Snow.Snowbnd, int)
174 Chapter 12 - Image Display Methods
This method returns the orientation of the image. The value is 90 or 0. If the value is 90, you may want to fix the image by using IMG_rotate_bitmap() as follows:
Example 12.4: IMG_auto_orientSample
IMG_auto_orient(imghandle,angle) if (angle == 90) IMG_rotate_bitmap(imghandle,andle[0] * 100);
See IMG_rotate_bitmap(int) for more information.
Syntax
int IMG_auto_orient(Snowbnd hdib, int *p_angle);
Remark
Table 12.5: IMG_auto_orient(Snow.Snowbnd, int)Method Variables
Variable Description hdib Standard RasterMaster® SDK image object. Angle returned as the current orientation. Either 90 or 0 is p_angle returned.
Returns
Returns the orientation of the image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_display_bitmap(java.awt.Graphics, int, int, int, int)
This method displays the current image at the current X and Y coordinates, and is not corrected for aspect ratio. To use RasterMaster Java’s automatic aspect ratio correction during display, use IMG_display_bitmap_aspect.
See IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) for more information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
l The Thumbnails Sample
Syntax
175 Chapter 12 - Image Display Methods int IMG_display_bitmap(Graphics g, int xpos, int ypos, int xsize, int ysize);
Remark
Table 12.6: IMG_display_bitmap(java.awt.Graphics, int, int, int, int) Method Variables
Variable Description g Graphics context xpos Starting X position for drawing the image ypos Starting Y position for drawing the image xsize Horizontal size of displayed image ysize Vertical size of displayed image
Returns
Returns the status of the X and Y coordinates. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int)
This method displays the current image, corrected for aspect ratio, at the current X and Y coordinates. It also displays scroll bars if the image is zoomed (zoom != 0 and zoom > Snowbnd.getInitialZoom()).
RasterMaster Java automatically detects whether or not Swing is present, and uses the correct scroll bar for AWT or Swing.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l Simple Conversion with Timeouts: The HangDetector Sample
l Batch Conversion: The BatchConvert Sample
l The Thumbnails Sample
l The Swing Sample
l Working with Vector PDF vs. Raster PDF: The VectorPDF Sample
Syntax
176 Chapter 12 - Image Display Methods
int IMG_display_bitmap_aspect(Graphics g, Container f, int xpos, int ypos, int xsize, int ysize, int zoom);
Remark
Table 12.7: IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) Method Variables
Variable Description g Graphics context f Current java.awt.Container for image xs Starting X position for drawing the image ys Starting Y position for drawing the image xsize Horizontal size of displayed image ysize Vertical size of displayed image Zoom factor zoom 0 = Display entire image 100 = One-to-one pixel display (one pixel per screen)
Returns
Returns the status of the X and Y coordinates. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix A, Supported File Formats for a list of error codes.
Example 12.5: IMG_display_bitmap_aspectSample
public void paint (Graphics g) { if (Simage != null) { in = getInsets(); /* NOTE THAT Microsoft JVIEW.EXE has a bug and does not start the origin at 0,0 under the title bar. Comment this next line to fix Jview.exe. All other Java Machines work fine.*/ g.translate(in.left, in.top); d = getSize(); d.width = (in.right + in.left); d.height = (in.top + in.bottom); if (cropped == 0) stat = Simage.IMG_display_bitmap_aspect(g, this, 0,0,d.width,d.height, zoom); else Simage.IMG_display_bitmap(g,0,0,d.width,d.height); if (select) snbd_draw_pen(); } }
IMG_display_bitmap_smooth(java.awt.Graphics,
177 Chapter 12 - Image Display Methods java.awt.Container, int, int, int, int, int)
This method displays the current image, corrected for aspect ratio, at the current X and Y coordinates. The zoom value is a percentage of the image display to the container size. A value of zero will fill the current container with a best fit, either fit to width or fit to height. For example, a value of 10 will zoom the image 10% larger than the container size. This will crop the image slightly. A negative value will shrink the image by the percentage and center in the container.
Syntax int IMG_display_bitmap_smooth(Graphics hdc, Container sf, int xs, int ys, int xsize, int ysize, int zoom);
Remark
Table 12.8: IMG_display_bitmap_smooth (java.awt.Graphics, java.awt.Container, int, int, int, int, int) Method Variables
Variable Description hdc Graphics port to draw into sf Container to draw into xs Starting X coordinate of container ys Starting Y coordinate of container xsize Xsize coordinate of container ysize Ysize coordinate of container zoom Zoom level
Returns
Returns the status of the X and Y coordinates. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 12.6: IMG_display_bitmap_smoothSample
public void paint (Graphics g) { if (Simage != null)
{
d = getSize(); in = getInsets(); d.width -= (in.right + in.left); d.height -= (in.top + in.bottom);
in = getInsets();
178 Chapter 12 - Image Display Methods
/* NOTE THAT Microsoft JVIEW.EXE has a bug and does not start the origin at 0,0 under the title bar. Comment this next line to fix Jview.exe. All other JVMs work fine.*/
g.translate(in.left, in.top); stat = Simage.IMG_display_bitmap_smooth(g, this, 0, 0, d.width, d.height,zoom); } } public void update(Graphics g) { // If the container is showing, be sure to repaint it, otherwise // repainting it is unnecessary and will cause update flashing
if ((Simage == null) || (Simage.dis_crop_xe == Simage.dis_ width) || (Simage.dis_crop_ye == Simage.dis_height)) { g.setColor(getBackground()); g.fillRect(0, 0, d.width, d.height); g.setColor(getForeground()); }
paint(g);
}
IMG_erase_rect(int, int, int, int, int, int, int)
This method fills the inside or outside of the specified rectangle (xs, ys, xsize, and ysize parameters) with the color passed in. It can be used to remove borders, for instance.
For 24-bit images, the color value must be a RGB-packed pixel; 1 byte red, 1 byte green, and 1 byte blue. For 1-bit black and white images, only the least significant bit is used.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax
179 Chapter 12 - Image Display Methods int IMG_erase_rect(int xs, int ys, int xsize, int ysize, int color, int in_outflag, int operation);
Remark
Table 12.9: IMG_erase_rect(int, int, int, int, int, int, int) Method Variables
Variable Description xs Start X coordinate of rectangle in pixels ys Start Y coordinate of rectangle in pixels xsize Width of rectangle in pixels ysize Height of rectangle in pixels color Color to fill 1 = fill inside rectangle in_outflag 0 = fill outside rectangle to the borders of the image 1 = xor image rectangle operation 0 = fill image
Example 12.7: IMG_erase_rectSample
if (ssb.Simage != null) { int width = ssb.Simage.getWidth(); int height = ssb.Simage.getHeight();
ssb.Simage.IMG_erase_rect(width / 20, height / 20, width (width / 10), height (height / 10),0xffffff, 0, 0); } repaintRefresh();
IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[])
This method allows filling an area of a bitmap with specified patterns found in the pattern argument.
Syntax int IMG_fill_bitmap_pattern(int xs, int ys, int xsize, int ysize, int pattern_width, int pattern_height, int x_offset, int y_offset, int byte pattern[]);
Remark
180 Chapter 12 - Image Display Methods
Table 12.10: IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[]) Method Variables
Variable Description xs Start X position of image to fill ys Start Y position of image to fill xsize Width of pattern area to fill ysize Height of pattern area to fill pattern_width Width of data in pattern array pattern_height Height of data in pattern array pattern_xoffset X offset of data in pattern array pattern_yoffset Y offset of data in pattern array byte pattern [] Array of pattern data bytes
IMG_flip_bitmapx(void)
This method flips the image horizontally to produce a mirror image. Positive X coordinates along the X-axis are swapped with negative X coordinates, and vice versa.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax
int IMG_flip_bitmapx();
Returns
Returns the status of the X coordinate. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_flip_bitmapy(void)
This method flips the image vertically to produce a mirror image. Positive Y coordinates along the Y-axis are swapped with negative Y coordinates, and vice versa.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
181 Chapter 12 - Image Display Methods
l The Viewing and Annotations Sample
l The Swing Sample
Syntax int IMG_flip_bitmapy();
Returns
Returns the status of the Y coordinate. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_resize_bitmap(int, int)
This method changes the internal size of the image according to the input parameters. The size of the source image is not relevant.
The parameters are the page height and width measured in pixels. For an A4 size page at 200 DPI, set IMG_resize_bitmap(2336, 1656) as shown in the following example:
11.69 inches high * 200 dpi = 2336 height in pixels 8.27 inches wide * 200 dpi = 1656 width in pixels
To preserve aspect ratio: hres is the destination width. vres the destination height.
Set the width and height to the original width and height of the image after decompress as shown in the following example:
Example 12.8: Preserving Aspect Ratio
vres = (int)((long)height * hres / width); IMG_resize_bitmap(hres,vres);
See IMG_resize_bitmap_bicubic(int, int) for important details on the algorithm (linear interpolation) used by this method, and for more details on creating high-quality thumbnails.
Note: IBM AFP printers require the width of an image to be an exact multiple of 8. To be on the safe side, set the width to a multiple of 8.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
182 Chapter 12 - Image Display Methods
l The Viewing and Annotations Sample
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
l The Swing Sample
Note: Do not use this method for zooming; you will permanently alter the image data.
Syntax
int IMG_resize_bitmap(int hres, int vres);
Remark
Table 12.11: IMG_resize_bitmap(int, int) Method Variables
Variable Description hres New horizontal size of the image vres New vertical size of the image
Returns
Returns the size of the horizontal or vertical image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_resize_bitmap_bicubic(int, int)
This method scales down images using a bicubic interpolation algorithm. It is good for creating high-resolution color image thumbnails. Since this operation is floating-point intensive, it is not as fast asIMG_resize_bitmap which uses a linear interpolation.
Bicubic interpolation takes a four pixel by four pixel block and produces an average of those pixels by weighting the value of the pixel in the average based on its distance from the origin pixel. Pixels farther away have less effect on the resulting pixel’s value than do its nearest neighbors.
Linear interpolation takes two pixels, separated by x pixels, and averages the two pixels to create an in-between value. These three pixels (the two original pixels and the newly created in- between pixel), are used to represent the original x + 2 pixels (the two original pixels as end points plus all of the pixels in between).
183 Chapter 12 - Image Display Methods
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the The Thumbnails Sample sample.
Syntax int IMG_resize_bitmap_bicubic(int xsize, int ysize);
Remark
Table 12.12: IMG_resize_bitmap_bicubic(int, int) Method Variables
Variable Description xsize Target width of image in pixels ysize Target height of image in pixels
Returns
Returns the target width or height of the image in pixels. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_resize_to_gray(int, int)
This method resizes a 1-bit black and white image to a (smaller) 8-bit grayscale image. Use it for making thumbnail versions of documents or engineering drawings. It uses the anti-aliasing method of the display engine to create a high-quality thumbnail.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the The Thumbnails Sample sample.
Notes: The quality of the conversion to black and white or grayscale can be enhanced by specifying the alias and alias quality. We highly recommend the JPEG compression format as the best compression available in our library for photo type images
Syntax int IMG_resize_to_gray(int xsize, int ysize);
Remark
Table 12.13: IMG_resize_to_gray(int, int) Method Variables
Variable Description xsize Target width of image in pixels ysize Target height of image in pixels
184 Chapter 12 - Image Display Methods
Returns
Returns the status of the resize to gray operation. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_rotate_bitmap(int)
This method rotates the current image clockwise by display angle. This permanently rotates the image in memory. For fast rotation at display time (image is not altered in memory), call display_angle. See display_angle(int) for more information.
Note: It is expected behavior that the image is smaller in each rotation using IMG_rotate_ bitmap. If an image is rotated by 90 degrees, RasterMaster Java flips from portrait to landscape (or vice-versa) and preserves the page content. If the image is rotated by something other than 90 degrees, RasterMaster Java shrinks the page so that all the content is preserved. RasterMaster Java does not crop the edges during the rotation.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax
int IMG_rotate_bitmap(int angle);
Remark
Table 12.14: IMG_rotate_bitmap(int) Method Variables
Variable Description Angle to rotate image by, in hundredths of a degree. For angle example, to rotate an image by 90 degrees, enter 9000.
Returns
Returns the angle to rotate image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_scroll_bitmap(java.awt.Container, java.awt.Event)
185 Chapter 12 - Image Display Methods
This method scrolls the bitmap. It essentially moves the current cropping rectangle in the direction indicated by the ScrollBar thumb. For users who do not want the scrollbars visible, a similar effect can be achieved by moving the cropping rectangle around using IMG_set_ croprect.
See IMG_set_croprect(int, int, int, int) for more information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the The Viewing and Annotations Sample sample.
Note: A HandleEvent method for scrolling is not needed because it is handled internally.
Syntax int IMG_scroll_bitmap(Container sf, Event evt);
Remark
Table 12.15: IMG_scroll_bitmap(java.awt.Container, java.awt.Event) Method Variables
Variable Description sf Current frame or window. evt Event object passed to the event handler.
Returns
Returns the status of the current frame or window. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 12.9: IMG_scroll_bitmapSample
public boolean handleEvent (Event evt) { switch(evt.id) { case Event.SCROLL_LINE_UP: case Event.SCROLL_LINE_DOWN: case Event.SCROLL_PAGE_UP: case Event.SCROLL_PAGE_DOWN: case Event.SCROLL_ABSOLUTE: { Simage.IMG_scroll_bitmap(this,evt); return true; } }
186 Chapter 12 - Image Display Methods
return super.handleEvent(evt); }
IMG_set_croprect(int, int, int, int)
This method setsdis_crop_xs, dis_crop_xe, dis_crop_ys, and dis_crop_ye. The cropping rectangle is essentially the size of the display container (which is usually a subclass of System.Windows.Forms.Paneljava.awt.Container), mapped onto the image (corrected for image scaling).
To use cropping methods with zooming, see map_wnd_to_image(java.awt.Container, java.awt.Point) and map_image_to_wnd(java.awt.Container, java.awt.Point)map_wnd_to_ image(java.awt.Container, java.awt.Point) and map_image_to_wnd(java.awt.Container, java.awt.Point).
Note: This method is interchangeable with set_croprect(int, int, int, int) Crop values are static and cannot be used in a multi-threading environment.
Syntax
void IMG_set_croprect(int xs, int ys, int xsize, int ysize);
Remark
Table 12.16: IMG_set_croprect(int, int, int, int) Method Variables
Variable Description Coordinate on the X axis for the upper edge of the xs cropping rectangle. Coordinate on the Y axis for the left edge of the cropping ys rectangle. xsize Width of the cropping rectangle in image pixels. ysize Height of the cropping rectangle in image pixels.
IMG_shift_bitmap(int, int)
This method shifts the image data along the x and y axes, positively or negatively according to the parameters passed in. Values are relative.
Note: The height and width of the image do not change, so any data shifted beyond the border of the image is permanently lost.
187 Chapter 12 - Image Display Methods
Syntax int IMG_shift_bitmap(int xoffset, int yoffset);
Remark
Table 12.17: IMG_shift_bitmap(int, int) Method Variables
Variable Description Positive or negative horizontal distance to move image xoffset data. Positive or negative vertical distance to move image yoffset data.
Returns
Returns the status of the horizontal or vertical distance to move image data. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_window_level(int, int, int)
This method changes the range of displayed pixels. It performs window leveling in 8 and 16-bit gray scale images.
Many medical images have been created to use only a portion of the total range of gray values possible. They appear very dark or washed out and need contrast enhancement or window leveling. This is typical. The window-leveling function improves the contrast to allow more details to be present in the image at display time. A normal 16 bit image that does not need window leveling should be display correctly.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Note: If the min and max values are set to zero, the method automatically calculates the min and max values by analyzing the image.
Syntax int IMG_window_level(int min, int max, int on_off);
Remark
188 Chapter 12 - Image Display Methods
Table 12.18: IMG_window_level(int, int, int) Method Variables
Variable Description min Minimum value of window level. max Maximum value of window level. 1 = On on_off 0 = Off
Returns
Returns the status of the minimum or maximum value of the window level. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 12.10: IMG_window_levelSample
if (Simage.getBitsPerPixel() == 16) Simage.IMG_window_level(0,0,1);
IMGLOW_put_raster(int, byte[])
This method replaces the raster line specified on the Y-axis with the new image data in the array buffer. The data to replace it is in the DIB format. This is one line of raw uncompressed data.
See for more information regarding formats for decompressed images.
Syntax
int IMGLOW_put_raster(int ypos, byte buff[]);
Remark
Table 12.19: IMGLOW_put_raster(int, byte[]) Method Variables
Variable Description ypos Line to replace. buff Data with which to replace.
Returns
Returns the new image data in the array buffer. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_alias(int)
189 Chapter 12 - Image Display Methods
This function displays scaled-down (zoomed out) 1-bit (black and white) and color images.
Preserve Black checks neighboring pixels for any adjacent black values and literally interpolates (inserts) black pixels so that small black lines or objects are not lost when scaling a large black and white image. It is recommended to use preserve black for large schematics and engineering drawings.
Scale to Gray converts a black and white image to gray scale upon display when zooming out on a large drawing or document. It is recommended for use with documents or other images that contain text.
Scale to Color is used when scaling down color images and prevents loss of visual data, creating a smoother rendering of text and lines.
Alias All turns scale to gray and scale to color on and is the default setting.
Syntax int IMGLOW_set_alias(int alias_type);
Remark
Table 12.20: IMGLOW_set_alias Function Variable
Variable Description Sets the aliasing factor. Choose from: 0 = No aliasing 1 = Use the preserve black algorithm alias_type 2 = Use the scale to gray algorithm 3 = Use the scale to color algorithm 4 = Alias all. Use scale to gray and scale to color
Returns
Returns the status of the aliasing factor. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, String, int, double)
This method sets attributes for importing an Ascii file into the RasterMaster Java library.
Note: Please note that this method is not thread safe.
190 Chapter 12 - Image Display Methods
Syntax
int IMGLOW_set_ascii_attributes(int xdpi, int ydpi, int lmargin, int rmargin, int tmargin, int bmargin, int tabs, int pwidth, int pheight, int psize, int charpline, int lineppage, boolean weigh, boolean ital, String fontName, int lnspacing, double charspacing);
Remark
Table 12.21: IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, String, int, double) Method Settings
Setting Default Value Description Horizontal dots per inch for xdpi 200 rendering file. 200 or 300 usually. Vertical dots per inch for rendering ydpi 200 file. 200 or 300 usually. Left margin size in 1/1000 of an lmargin 1000 inch. Right margin size in 1/1000 of an rmargin 1000 inch. Top margin size in 1/1000 of an tmargin 750 inch. Bottom margin size in 1/1000 of bmargin 750 an inch. Number of characters between tabs 8 tab stops. pwidth 8500 Page width in 1/1000 of an inch. pheight 11000 Page height in 1/1000 of an inch. psize -1 Font height in pixels. charpline 80 Characters per line. lineppage 60 Lines per page. Set to True for bold and False for weight false normal. Set to True for Italic or False for italic false normal. typeFace TimesRoman Font type name. asciiFont null Ascii font. lineSpacing 0 Line spacing. charSpacing 0 Character spacing. pageOffset 1 Sets the page offset.
IMGLOW_set_brightness(int)
This method sets the brightness of the current image.
191 Chapter 12 - Image Display Methods
Notes: Setting and saving the brightness permanently affects color and grayscale image data. This method has no effect on 1-bit images, except at display time (if anti-alias is on, and alias = 2).
Syntax int IMGLOW_set_brightness(int value);
Remark
Table 12.22: IMGLOW_set_brightness(int) Method Settings
Setting Description Sets the image's brightness to the lowest (darkest) -127 setting. 0 (Default) Retains the image's native brightness. Sets the image's brightness to the highest (lightest) +127 setting.
Returns
Returns the brightness of the current image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_contrast(int)
This method sets the relative difference between the image’s black and white values.
Notes: Setting and saving the contrast permanently affects color and grayscale image data. This method has no effect on 1-bit images, except at display time if anti-alias is on and alias = 2.
Syntax int IMGLOW_set_contrast(int value);
Remark
Table 12.23: IMGLOW_set_contrast(int) Method Settings
Setting Description (minimum) Displays the image with minimum contrast -127 between the image’s black and white colors.
192 Chapter 12 - Image Display Methods
Setting Description 0 (Default) Retains the image's native contrast. (maximum) Displays maximum contrast, causing the +127 whites to be whiter and the blacks to be blacker.
Returns
Returns the relative difference between the image’s black and white values. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_decompsize(int, int)
This method allows setting the destination size for an image being decompressed. At decompress time, the image is scaled to the destination x and y size. This destination size also represents the image size in pixels, as it is necessary to decompress usingIMG_ decompress_bitmap.
When theIMGLOW_set_alias parameter is set to 4, the above method uses the Bicubic interpolation algorithm for scaling the image smoothly. If the alias parameter is set to 0, the scaling is done by skipping pixels. There is no other processing of neighboring pixels.
Note: The destination size must be set before calling any decompress method.
Syntax
int IMGLOW_set_decompsize(int xsize, int ysize);
Remark
Table 12.24: IMGLOW_set_decompsize(int, int) Method Settings
Method Description xsize Destination width of image after resizing. ysize Destination height of image after resizing.
IMGLOW_set_decomp_rect(int, int, int, int)
This method allows specifying a rectangle in the image to decompress. Only this portion of the image is stored in RasterMaster Java’s internal memory. To turn this method off, call the method with all parameters set to 0.
Note: This must be set prior to decompressing an image.
193 Chapter 12 - Image Display Methods
Syntax int IMGLOW_set_decomp_rect(int xs, int ys, int xsize, int ysize);
Remarks
Table 12.25: IMGLOW_set_decomp_rect(int, int, int, int) Method Settings
Method Description xs Starting X position. xy Starting Y position. xsize Horizontal size of cropping rectangle. ysize Vertical size of cropping rectangle.
IMGLOW_set_image_orientation(int)
This method sets the orientation flag before saving images to the TIFF format. Orientation changes the default display angle for the image.
See the TIFF 6.0 specification (http://www.adobe.com) for the meaning of the orientation flag.
Syntax int IMGLOW_set_image_orientation(int orient);
Remark
Table 12.26: IMGLOW_set_image_orientation(int) Method Variables
Variable Description Sets the image orientation
TIFF 1 = Rotated 0 degrees 2 = Flipped in the x direction 3 = Rotated 180 degrees 4 = Rotated 180 degrees and flipped in the x direction 5= Rotated 90 degrees and flipped in the x direction orient 6= Rotated 90 degrees 7 = Rotated 270 degrees and flipped in the x direction 8 = Rotated 270 degrees
CALS 0 = Rotated 0 degrees 90 = Rotated 90 degrees 180 = Rotated 180 degrees 270 = Rotated 270 degrees
Returns
194 Chapter 12 - Image Display Methods
Returns the status of the image orientation. A value of 0 or 1 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_pdf_flags(int)
Call this method with the flag variable set to 1, if you have a PDF file with a PDF annotation that is covering the document text and you do not want the annotations to be displayed: IMGLOW_set_pdf_flags(1)
Syntax
int IMGLOW_set_pdf_flags(int flag);
Remark
Table 12.27: IMGLOW_set_pdf_flags(int) Method Variables
Variable Description PDF_DEFINE.PDF_ANNOTATIONS_OFF = 1 flag PDF_DEFINE.PDF_ACROFORMS_OFF = 2
IMGLOW_set_pdf_output(int, int)
This method sets the destination size for saving PDF files. The xsize and ysize are the output sizes in points. A point is 1/72 of an inch. Only PDF, PCL, and AFP file formats can be saved. The PCL and APF file formats are saved as bitmap. The PDF file format can be saved as bitmap or searchable text.
Syntax
int IMGLOW_set_pdf_output(int xsize, int ysize);
Remark
Table 12.28: IMGLOW_set_pdf_output(int, int) Method Variables
Variable Description xsize Destination width of image after resizing. ysize Destination height of image after resizing.
map_image_to_wnd(java.awt.Container, java.awt.Point)
195 Chapter 12 - Image Display Methods
This method converts image coordinates to screen coordinates for the currently displayed image. This is useful for converting mouse coordinates on the image to screen coordinates, as in creating a selection rectangle (rubber-band zoom).
Syntax void map_image_to_wnd(java.awt.Container sf, java.awt.Point pt);
Remark
Table 12.29: map_image_to_wnd(java.awt.Container, java.awt.Point) Method Variables
Variable Description sf Container for displayed image. pt Point to be mapped. map_wnd_to_image(java.awt.Container, java.awt.Point)
This method converts screen coordinates to image coordinates. This is valid only for the currently displayed image. This is useful for converting mouse coordinates on the screen to image coordinates, as in creating a selection rectangle (rubber-band zoom).
Syntax void map_wnd_to_image(java.awt.Container sf, java.awt.Point pt);
Remark
Table 12.30: map_wnd_to_image(java.awt.Container, java.awt.Point) Method Variables
Variable Description sf Container for displayed image. pt Point to be mapped. set_croprect(int, int, int, int)
This method sets the cropping rectangle for the display engine. Only the area of the image inside the current crop rectangle displays. Compare this to IMG_display_bitmap_aspect in which the zoom parameter simply sets the current crop rectangle.
See IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) for more information.
Syntax int set_croprect(int xs, int ys, int xe, int ye);
196 Chapter 12 - Image Display Methods
Remark
Table 12.31: set_croprect(int, int, int, int) Method Variables
Variable Description xs Starting X position for cropping the image. ys Starting Y position for cropping the image. xe Horizontal size of cropped rectangle in pixels. ye Vertical size, of cropped rectangle in pixels.
Returns
Returns the status of the cropping rectangle for the display engine. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
set_croprect_scroll(java.awt.Container, int, int, int, int, int)
This method sets the rectangular area of an image to display and also sets up scrollbars. Scrollbars are turned on if the size of the cropping rectangle is smaller than the height and/or width of the image.
Syntax
int set_croprect_scroll(java.awt.Container sf, int xs, int ys, int xe, int ye, int aspect);
Remark
Table 12.32: set_croprect_scroll(java.awt.Container, int, int, int, int, int) Method Variables
Variable Description sf Container for the displayed image. xs Starting X position for cropping the image. ys Starting Y position for cropping the image. xe Horizontal size in pixels of the cropping rectangle. ye Vertical size in pixels of the cropping rectangle. 1 = preserve the aspect ratio of cropped rectangle. aspect Any other value stretches the image.
Returns
Returns the status of the new zoom value. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
197 Chapter 12 - Image Display Methods
Example 12.11: set_croprect_scrollSample
public void mouseReleased(MouseEvent e) { Point pt,pt2; if (select) { snbd_draw_pen(); pt = new Point(); pt2 = new Point(); pt.x = selrect.x; pt.y = selrect.y; Simage.map_wnd_to_image(this,pt); pt2.x = selrect.x + selrect.width; pt2.y = selrect.y + selrect.height; Simage.map_wnd_to_image(this,pt2); if(pt.x > pt2.x) { selrect.x = pt.x; pt.x = pt2.x; pt2.x = selrect.x; } if(pt.y > pt2.y) { selrect.y = pt.y; pt.y = pt2.y; pt2.y = selrect.y; } zoom = Simage.set_croprect_scroll(this, pt.x, pt.y, pt2.x pt.x, pt2.y pt.y,1); if (zoom <0) zoom = 0; cropped = 1; select = false; selrect = null; repaint(); } } setFrame(java.awt.Container)
This method sets the destination container for image display.
Note: This method must be called prior to decompressing PTOCA or ASCII files.
Syntax
198 Chapter 12 - Image Display Methods
void setFrame(java.awt.Container c);
Remark
Table 12.33: setFrame(java.awt.Container) Method Variables
Variable Description c Container of displayed image (usually "this").
199 Chapter 13 - Image Quality Manipulation
Chapter 13 - Image Quality Manipulation
This chapter describes the available image quality manipulation methods for the Snow.Snowbnd class.
IMGLOW_set_comp_quality(int)
This method sets the compression quality factor when saving JPEG images.
IMGLOW_set_comp_quality is rarely used. If the size of the TIFF_JPEG output file needs to be reduced and it is acceptable to reduce the quality of the output, you can call this method before calling IMG_save_bitmap.
Syntax int IMGLOW_set_comp_quality(int quality);
Remark
Table 13.1: IMGLOW_set_comp_quality(int) Method Variables
Variable Description 1 = Smallest file size and lowest quality image. quality 100 = Largest file size and highest quality image.
Returns
Returns the compression quality factor when saving JPEG images. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_document_input(int, int, int)
This method sets the level of color and resolution quality when reading in documents for the specified document format.
This method should be called before the input document is read in using IMG_decompress_ bitmap(String, int).
You can override RasterMaster Java’s default bits-per-pixel and DPI settings for the specified format using this method.
You can use this method to do the following:
l Set the input bits-per-pixel to 1 for black and white input to remove the extra overhead and performance costs of processing color images.
200 Chapter 13 - Image Quality Manipulation
l Read in color or grayscale documents by setting a higher bits-per-pixel. Please see Appendix A, Supported File Formats for a current list of supported formats
l Increase your output image quality by increasing the input document DPI.
l Increase your processing throughput by decreasing the document DPI or bits per pixel.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The SilentPrint Sample
l Simple Conversion: The SimpleConvert Sample
l Batch Conversion: The BatchConvert Sample
l Single Conversion: The SingleConversion Sample
Note: The default is 200 dpi and 24 bits per pixel for PDF. The default is 300 dpi and 1 bit per pixel for PCL, AFP, Word, and Excel.
Syntax
int IMGLOW_set_document_input(int dpi, int bits_pix, int format);
Remarks
Table 13.2: IMGLOW_set_document_input(int, int, int) Method Settings
Method Description Sets the input resolution in dots per inch. A higher dpi dpi yields a higher quality document that takes longer to process and takes up more memory and storage space. Sets the bits per pixel. 1 = black and white documents 8 = grayscale or color images bits_pix 24 = color images
See Appendix A, Supported File Formats for information on these and other pixel depths supported by each format. Sets the format parameter. A file format number as format specified in Appendix A, Supported File Formats i.e. Word (DOC) is 86.
Returns
201 Chapter 13 - Image Quality Manipulation
Returns the status of document formats to be rendered in color or black and white. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_document_input(int, int, int, int, int)
This method sets the rendering parameters for the decompression of Office files. Office files are rendered as a bitmap at decompression time. These values allow you to set the dots per inch (DPI) and the bit pixel depth of the resulting bitmap. The default page size is 8.5” x 11” in pixels. This method should be used in to set the DPI for the XLS, XLSX format.
Note: Currently this method only supports .xls and .xlsx files.
This method should be called before the input document is read in using IMG_decompress_ bitmap(String, int).
You can override RasterMaster Java’s default bits-per-pixel and DPI settings for the specified format using this method.
You can use this method to do the following:
l Set the input bits-per-pixel to 1 for black and white input to remove the extra overhead and performance costs of processing color images.
l Read in color or grayscale documents by setting a higher bits-per-pixel. Please see Appendix A, Supported File Formats for a current list of supported formats
l Increase your output image quality by increasing the input document DPI.
l Increase your processing throughput by decreasing the document DPI or bits per pixel.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The SilentPrint Sample
l Simple Conversion: The SimpleConvert Sample
l Batch Conversion: The BatchConvert Sample
l Single Conversion: The SingleConversion Sample
Note: The default is 200 dpi and 24 bits per pixel for PDF. The default is 300 dpi and 1 bit per pixel for PCL, AFP, and Word.
202 Chapter 13 - Image Quality Manipulation
Syntax
int IMGLOW_set_document_input(int dpi, int bits_pix, int format, int width, int height);
Remarks
Table 13.3: IMGLOW_set_document_input(int, int, int, int, int) Method Settings
Method Description Sets the dots per inch in which to render the pcl file. A higher dpi yields a higher quality document that takes dpi longer to process and takes up more memory and storage space. Sets the bits per pixel. 1 = black and white documents bits_pix 24 = color images See Appendix A, Supported File Formats for information on these and other pixel depths supported by each format. Sets the format parameter. A file format number as format specified in Appendix A, Supported File Formats i.e. Word (DOC) is 86. width Sets the page width in inches (i.e. 8.5) height Sets the page height in inches (i.e. 11.0)
Returns
Returns the status of Office documents to be rendered in color or black and white. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_gamma(int)
This method sets a gamma correction factor which corrects for the gamma or response curve of the monitor. This can drastically improve the quality of some gray scale or 24-bit images.
Notes: Setting and saving the gamma factor permanently affects color and grayscale image data. This method has no effect on 1-bit images, except at display time if anti-alias is on, and alias = 2.
Syntax
203 Chapter 13 - Image Quality Manipulation int IMGLOW_set_gamma(int value);
Remark
Table 13.4: IMGLOW_set_gamma(int) Method Settings
Setting Description 0 No gamma correction. 100 Default gamma correction (1.00). 400 Maximum gamma correction (4.00).
Returns
Returns the status of the gamma correction factor which corrects for the gamma or response curve of the monitor. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_jpg_interleave(int, int)
This method sets the JPEG interleave factor for writing JPEG images. This is the factor for decimating the blue and red chroma planes when writing out JPEG images.
Notes: To obtain the highest quality image, set both variables to a value of 1. (It does not skip any lines). The default, JPEG uses a 2:1 interleaving factor. It skips every other pixel in the X direction.
Syntax int IMGLOW_set_jpg_interleave(int h_int, int v_int);
Remark
Table 13.5: IMGLOW_set_jpg_interleave(int, int) Method Variables
Variable Description Integer 1, 2, or 4. Specifies the number of horizontal pixels h_int to skip. You can specify up to the height of the file, but this is not recommended. Integer 1, 2, or 4. Specifies the number of vertical pixels to v_int skip. You can specify up to the width of the file, but this is not recommended.
Returns
204 Chapter 13 - Image Quality Manipulation
Returns the status of the JPEG interleave factor for writing JPEG images. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IIMGLOW_set_pcl_input(int, int)
This method sets the rendering for PCL decompression. PCL files are rendered as a bitmap at decompression time. These values allow you to set the dots per inch and the pixel depth of the resulting bitmap.
Syntax
int IMGLOW_set_pcl_input(int dpi, int bits_pix);
Remark
Table 13.6: IMGLOW_set_pcl_input(int dpi, int bit_pix) Method Variables
Variable Description dpi Dots per inch in which to render the pcl file. bits_pix Bitmap pixel depth. Set to 1 or 24.
IMGLOW_set_pdf_fontpath(String)
This method sets the path for finding PDF fonts.
Syntax
int IMGLOW_set_pdf_fontpath(String st);
Remark
Table 13.7: IMGLOW_set_pdf_fontpath(String) Method Variables
Variable Description st Specify the path of the directory to find PDF fonts.
Returns
Returns the status of the path of the directory for PDF fonts. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_pdf_input(int, int)
205 Chapter 13 - Image Quality Manipulation
This method allows the conversion of PDF files into bitmaps when decompressed by RasterMaster Java products. It allows the programmer to set the bitmap size and pixel depth of the resulting bitmap.
Note: When used for black and white PDF documents calling IMGLOW_set_pdf_input() set to a dpi of 200 and bits per pixel of 1, it provides optimal decompress and display performance. Also, it is ideal for TIFF Group 4 conversions.
Syntax int IMGLOW_set_pdf_input(int dpi, int bits_pix);
Remark
Table 13.8: IMGLOW_set_pdf_fontpath(String) Method Variables
Variable Description Dots per inch in which to render the PDF. Typical DPI is 300. dpi 1-bit images such as documents DPI is 200. Color images dpi is 100 or 200. Bitmap pixel depth for resulting rendered pdf image. Set to bits_pix 1, 8, or 24. setXdpi(int)
This method sets the resolution, in DPI (dots per inch, 1/72nd of an inch), along the X-axis of an image. The value is saved in the image.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
Note: If an image’s resolution is not explicitly set, the resolution is now specified as 0 dots per inch (DPI). In older versions, it was set as 100 DPI. To avoid errors or unexpected behavior, set the resolution of the image explicitly when saving in the setXdpi(int) and setYdpi(int) methods.
Syntax int setXdpi(int dpi);
206 Chapter 13 - Image Quality Manipulation
Returns
Returns the status of he resolution, in DPI (dots per inch, 1/72nd of an inch), along the X-axis of an image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
setYdpi(int)
This method sets the resolution, in DPI (dots per inch, 1/72nd of an inch), along the Y-axis of an image. The value is saved in the image.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion: The SimpleConvert Sample
l Single Conversion: The SingleConversion Sample
Note: If an image’s resolution is not explicitly set, the resolution is now specified as 0 dots per inch (DPI). In older versions, it was set as 100 DPI. To avoid errors or unexpected behavior, set the resolution of the image explicitly when saving in the setXdpi(int) and setYdpi(int) methods.
Syntax
int setYdpi(int dpi);
Returns
Returns the status of he resolution, in DPI (dots per inch, 1/72nd of an inch), along the X-axis of an image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
207 Chapter 14 - Page Manipulation Functionality and Methods
Chapter 14 - Page Manipulation Functionality and Methods
This chapter describes the available page manipulation functionality and methods.
RasterMaster Java allows for page manipulation of a supported file format and saves it with original page formatting. Page manipulation of documents is at a page-by-page level, such as deleting pages, moving pages, adding pages, and creating new documents from pages of other documents. Page content remains the same and preserves the formatting. The ordering of the pages may be changed and pages may be added or removed. Pages of a searchable PDF that are reordered may be saved as a searchable PDF. New documents can be created by moving or copying pages of other documents. You can create a new document with pages copied from other documents. Every document that can be paginated is capable of page manipulation.
This feature includes the VectorPDFPageManipulation code sample. This sample demonstrates how to delete, extract, and append pages to and from a vector PDF file without causing additional pages in that vector PDF to change into non-vector pages because of those manipulations. Pages being appended to vector PDFs can be vector or non vector pages. You can find this sample in the following directory: [RM Java install dir] \Samples\com\snowbound\samples\vectorpdf. For more information on using this sample, please see The VectorPDFPageManipulation Sample .
Page Manipulation Functionality
The Page Manipulation functionality can be used in the following scenarios:
l To remove pages, such as blank pages, duplicate pages, or pages irrelevant to the document.
l To add pages. Separator pages can be added between sections, or pages for notes which are subsequently written on using annotations.
l To reorder pages. If the original document’s pages were scanned in the incorrect order, they can be rearranged. Also, the document’s pages can be rearranged to place more relevant pages first.
l To copy pages. Similar to reorder pages, some pages may be copied and placed first in the document leaving the rest of the document in its original form.
l To rotate pages. In some cases, pages may be scanned with the wrong orientation. This allows the orientation to be fixed. A page in landscape orientation may be rotated within an otherwise portrait-oriented document. Please note that rotating pages changes searchable PDF pages into non-searchable rasterized PDF pages.
208 Chapter 14 - Page Manipulation Functionality and Methods
l To create new documents. New documents can be created from pages of other documents either copied or moved.
IMG_decompress_bitmap(String, int)
This method decompresses an image from the local disk. This standard method can be used by applications, signed applets, or applets for which disk read permissions have been granted. As with all decompression methods, it automatically detects the file format.
The IMG_decompress_bitmap(java.io.DataInputStream, int) method decompresses data from a DataInputStream and automatically detects the file format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l Simple Conversion: The SimpleConvert Sample
l The SilentPrint Sample
l The Swing Sample
l The Thumbnails Sample
l Working with Vector PDF vs. Raster PDF: The VectorPDF Sample
l The VectorPDFPageManipulation Sample
Syntax
int IMG_decompress_bitmap(String st, int page);
Remark
Table 14.1: IMG_decompress_bitmap(String, int) Method Variables
Variable Description st Path and filename of the image to decompress page Page number for the multi-page image file
Returns
Returns the status of the decompressed image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
209 Chapter 14 - Page Manipulation Functionality and Methods
Example 14.1:IMG_decompress_bitmapSample
FileDialog fd = new FileDialog(this,"Open " + "Bitmap",FileDialog.LOAD); fd.show(); FileName = fd.getDirectory() + fd.getFile(); if (FileName != null) { tSimage = new Snow.Snowbnd(); tSimage.IMG_decompress_bitmap(FileName,0); }
IMG_rotate_bitmap(int)
This method rotates the current image clockwise by display angle. This permanently rotates the image in memory. For fast rotation at display time (image is not altered in memory), call display_angle. See display_angle(int) for more information.
Note: It is expected behavior that the image is smaller in each rotation using IMG_rotate_ bitmap. If an image is rotated by 90 degrees, RasterMaster Java flips from portrait to landscape (or vice-versa) and preserves the page content. If the image is rotated by something other than 90 degrees, RasterMaster Java shrinks the page so that all the content is preserved. RasterMaster Java does not crop the edges during the rotation.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax int IMG_rotate_bitmap(int angle);
Remark
Table 14.2: IMG_rotate_bitmap(int) Method Variables
Variable Description Angle to rotate image by, in hundredths of a degree. For angle example, to rotate an image by 90 degrees, enter 9000.
Returns
210 Chapter 14 - Page Manipulation Functionality and Methods
Returns the angle to rotate image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_save_bitmap(int, int, int, int)
This method is designed to allow saving to a byte array without knowing or guessing the final size of the compressed image or document. First, the initial size parameter is allocated. If the output data saved becomes larger than the initial size, then the buffer is reallocated to initial_size plus the increment size specified by buff_inc. Each time the output data becomes larger than the current buffer size when saving, the buffer is increased in size by the increment size. The caller must be careful in choosing the buffer increment size. If the buffer increment is too small, multiple reallocations will cause the saving process to be slow. If it is too large, too much memory will be allocated.
You can find this sample in the following directory: [RM Java install dir] \Samples\com\snowbound\samples\vectorpdf. For more information on using this sample, please see The VectorPDFPageManipulation Sample .
Note: Snowbound Software recommends an increment size of 10-25% of the initial buffer size.
Group 4 compression found in TIFF and AFP file formats typically compress at a rate of 10:1. You can choose an initial size of 1/8 to 1/10 of the uncompressed size.
A JPEG file format typically compresses at a rate of 10:1.
An LZW file format found in TIFF and GIF file formats compress at a rate of about 3:1. A .zip or flate file found in a PNG file format also compresses at a rate of about 3:1.
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the Page Manipulation Functionality and Methods method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats in Supported File Formats for details on what bit-depths are available for each format.
Note: Compression results for your images may vary. For best results, test a number of images to see what the resultant output size will be. Also, it is suggested to test out smaller and larger increment sizes to find the best level of performance.
Syntax
211 Chapter 14 - Page Manipulation Functionality and Methods
byte[] IMG_save_bitmap(int initial_size, int buff_inc, int comp_ type, int error[]);
Remark
Table 14.3: IMG_save_bitmap(int, int, int, int) Method Variables
Variable Description initial_size The buffer is initially allocated to this size exactly. buff_inc The amount to grow the buffer if needed. Output file format to write. See Appendix A, Supported File Formats for more information on supported file formats. comp_type The output constants for currently supported and unsupported file types are defined in Appendix A, Supported File Formats. Returns the size of the data. If the value is less than zero, error it is an error code.
Returns
Returns the value of the output file size in bytes.
IMGLOW_append_page(DataInputStream, byte[], int)
This method appends a specified page to an existing multi-page PDF or TIFF document contained in an existing DataInputStream.
Syntax int IMGLOW_append_page(DataInputStream bm_name, byte buff[], int format);
Remarks
Table 14.4: IMGLOW_append_page(String, byte[], int) Method Variables
Variable Description di DataInputStream containing current multi-page document. buff Byte array containing page to append. format RasterMaster Java defined file format TIFF or PDF.
Returns
Returns the status of the page to append. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
212 Chapter 14 - Page Manipulation Functionality and Methods
IMGLOW_append_page(String, byte, int)
This method allows the appending of content for individual pages without any changes. This allows appending or creation of files to preserve the exact content of pages.
The IMGLOW_append_page(DataInputStream, byte[], int) method appends a specified page to an existing multi-page PDF or TIFF document contained in an existing DataInputStream.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples\vectorpdf. This method is used in The VectorPDFPageManipulation Sample sample.
Syntax
public int IMGLOW_append_page(String filename, byte buff[],int format);
Remark
Table 14.5: IMGLOW_append_page(String, byte, int) Method Settings
Setting Description filename Sets the filename of the source file to append a page to. buff A bytearray containing the page to append. Integer value to specify the file format. Currently TIFF and format PDF.
Returns
Returns the resulting document with the specified page appended. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_delete_page(String, int, int)
This method returns the ability to delete the specified page from a multi-page document. The content of the resulting document is returned unchanged in the form of a byte array. Please use the IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char) method to detect blank pages.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples\vectorpdf. This method is used in The VectorPDFPageManipulation Sample.
Syntax
public byte[] IMGLOW_delete_page(String bm_name, int page, int error[]);
213 Chapter 14 - Page Manipulation Functionality and Methods
Remark
Table 14.6: IMGLOW_delete_page(String, int, int) Method Settings
Setting Description Sets the filename of multi-page document to extract page bm_name from. page The page index to delete starting at 0. error One integer array to return an error code >= 0 is no error.
Returns
Returns a byte array of the resulting document with the specified page deleted. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_delete_page(DataInputStream, int, int)
This method returns the ability to delete the specified page from a multi-page document. The content of the resulting document is returned unchanged in the form of a byte array. Please use the IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char) method to detect blank pages.
Syntax public byte[] IMGLOW_delete_page(DataInputStream di, int page, int error[]);
Remark
Table 14.7: IMGLOW_delete_page(DataInputStream, int, int) Method Settings
Setting Description The DataInputStream containing the multi-page di document to delete the page from. page The page index to delete starting at 0. error One integer array to return an error code >= 0 is no error.
Returns
Returns a byte array of the resulting document with the specified page deleted. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_detect_blank_page(int, char, int, int, int, int,
214 Chapter 14 - Page Manipulation Functionality and Methods
char, char)
This method can be used to detect blank pages. It can also be used to detect pages that are essentially blank though there are some scan artifacts or other “dirt” on them.
This method returns the percentage of pixels present that are not equal to the passed detection or background color. If autodetect is set to 1, then the detection or background color will be determined automatically and will correspond to the dominant color in the image. The tolerance value can be set to allow for a more lenient color matching the algorithm.
Syntax
double SNBDAPI IMGLOW_detect_blank_page(int hdib, char autodetect, int red, int green, int blue, int tolerance, char isLowQuality, char isLowMemory);
Remark
Table 14.8: IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char) Method Variable
Variable Description hdib Standard RasterMaster® SDK image handle. Auto-detect the background color (0: no; 1: yes). 1 will autodetect force the system to ignore the passed color. 24-bpp: Red component of the detection color. May have the value of [0-255]. 1-bpp/4-bpp/8-bpp: Index value of the red detection color. May have the value of [0-1], [0-127], and [0-255], respectively. Green component of the detection color. Ignored for non- green 24-bpp images. May have the value of [0-255]. Blue component of the detection color. Ignored for non-24- blue bpp images.May have the value of [0-255]. Per color-channel pixel-value match tolerance linear tolerance distance value. Use this value in comparing background pixels. This number is in the range [0-255]. Execute the low-quality version of the autodetect algorithm (0: no; 1: yes). The low-quality version will not guarantee isLowQuality the global maximum, but it will execute much faster. The tolerance level is not taken into consideration. Execute the low-memory version of the autodetect algorithm (0: no; 1: yes). The low-memory version will not isLowMemory guarantee the global maximum. The tolerance level is not taken into consideration. This setting is only for 24-bpp images.
Returns
215 Chapter 14 - Page Manipulation Functionality and Methods
Double. The percentage of pixels on the page that are not equal to the background color. If the percentage is zero or near zero the page is blank. Note the percentage is a floating point number. For example, a return value of 50.26 means 50.26% of the page is non-blank. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_extract_page(java.io.DataInputStream, int, int)
This method allows the extraction of a PDF or TIFF page into a returned buffer. The page parameter will specify the page number starting at 0. An entire complete TIFF or PDF file of a single page will be returned.
Syntax byte[] IMGLOW_extract_page(java.io.DataInputStream di, int page, int error[]);
Remarks
Table 14.9: IMGLOW_extract_page(java.io.DataInputStream, int, int) Method Variables
Variable Description di DataInputStream. page The page number to extract starting at 0. One integer array for returning an error code, where non- error zero implies an error code and zero implies no error.
Returns byte[]. A byte array of the extracted page.
IMGLOW_extract_page(String, int, int)
This method extracts the specified page from a multi-page PDF or TIFF document.
This method extracts the specified page from a multi-page document. IMGLOW_extract_ page differs from IMG_decompress_image in that it preserves the format of the original page rather than converting it to the Snowbound common raster format. The currently supported input formats are raster PDF, searchable PDF and TIFF.
The IMGLOW_extract_page(java.io.DataInputStream, int, int) method allows the extraction of a PDF or TIFF page into a returned buffer. The page parameter will specify the page number starting at 0.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples\vectorpdf. This method is used in The VectorPDFPageManipulation Sample sample.
216 Chapter 14 - Page Manipulation Functionality and Methods
Syntax
byte[] IMGLOW_extract_page(String bm_name, int page, int error[]);
Remarks
Table 14.10: IMGLOW_extract_page(String, int, int) Method Variables
Variable Description The filename of the multi-page document from which to bm_name extract page. page The page number to extract starting at 0. One integer array for returning an error code, where non- error zero implies an error code and zero implies no error.
Returns
byte[]. A byte array of the extracted page.
IMGLOW_get_pages(java.io.DataInputStream)
This method returns the number of pages in a multi-page document. It works for any multi-page format. See Supported File Formats or our website (www.snowbound.com) for a current list of supported formats.
Note: The first page is 0.
Syntax
int IMGLOW_get_pages(DataInputStream dis);
Remark
Table 14.11: IMGLOW_get_pages(java.io.DataInputStream) Method Variables
Variable Description An object containing compressed image data. This usually dis contains a file loaded into memory, and is commonly, but not necessarily, multipaged.
Returns
Returns the number of pages in a multi-page document. A value of 0 or 1 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
217 Chapter 14 - Page Manipulation Functionality and Methods
IMGLOW_get_pages(String)
This method returns the number of pages in a multi-page document. It works for any multi-page format. See Supported File Formats or our website (www.snowbound.com) for the most updated list of supported formats.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l Simple Conversion with Timeouts: The HangDetector Sample
l Saving to Searchable PDF: The saveSearchablePDF Sample
l Simple Conversion: The SimpleConvert Sample
l The Save Page to Memory Sample
l Batch Conversion: The BatchConvert Sample
l Single Conversion: The SingleConversion Sample
l The Thumbnails Sample
l The Color Detection Sample
Note: The first page is 0.
Syntax int IMGLOW_get_pages(String filename);
Remark
Table 14.12: IMGLOW_get_pages(String) Method Variables
Variable Description filename Filename and path to an image.
Returns
Returns the number of pages in a multi-page document. A value of 0 or 1 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
218 Chapter 15 - Miscellaneous Methods
Chapter 15 - Miscellaneous Methods
This chapter describes the available methods for the Snow.Snowbnd class.
IIMG_merge_block(Snow.Snowbnd, int, int, int)
This method draws a source image on top of the current image at the x and y coordinates (xpos and ypos) passed in.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Note: The images must have compatible bit depths.
Syntax int IMG_merge_block(Snowbnd shdib, int xpos, int ypos, int operation);
Remark
Table 15.1: IMG_merge_block(Snow.Snowbnd, int, int, int) Method Variables
Variable Description shdib Source Snowbound image class within which to merge xpos Starting x merge position ypos Starting y merge position 0 = draw entire image operation 1 = draw only the black part of 1-bit images
Returns
Returns the source Snowbound image class within to merge. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 15.1:IMG_merge_blockSample
if (Simage != null){ FileDialog fd = new FileDialog(this,"Open
219 Chapter 15 - Miscellaneous Methods
Bitmap",FileDialog.LOAD); fd.show();
FileName = fd.getDirectory() + fd.getFile();
if (FileName != null) { tSimage = new Snow.Snowbnd(); tSimage.IMG_decompress_bitmap(FileName,0); Simage.IMG_merge_block(tSimage,31,31,0); tSimage = null; System.gc(); } }
IMGLOW_append_page(DataInputStream, byte[], int)
This method appends a specified page to an existing multi-page PDF or TIFF document contained in an existing DataInputStream.
Syntax
int IMGLOW_append_page(DataInputStream bm_name, byte buff[], int format);
Remarks
Table 15.2: IMGLOW_append_page(String, byte[], int) Method Variables
Variable Description di DataInputStream containing current multi-page document. buff Byte array containing page to append. format RasterMaster Java defined file format TIFF or PDF.
Returns
Returns the status of the page to append. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_append_page(String, byte[], int)
This method appends a specified page to an existing multi-page PDF or TIFF document.
Syntax
int IMGLOW_append_page(String bm_name, byte buff[], int format);
220 Chapter 15 - Miscellaneous Methods
Remarks
Table 15.3: IMGLOW_append_page(String, byte[], int) Method Variables
Variable Description bm_name Filename of the multi-page document to append page to. buff Byte array containing page to append. format RasterMaster Java defined file format TIFF or PDF.
Returns
Returns the status of the page to append. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_bitmap_name(String, String)
This method sets the Name or Author and Date tag before saving images to the TIFF format.
Note: Please see the TIFF 6.0 specification (http://www.adobe.com) for a definition of tags Author 315, and Date 306.
Syntax int IMGLOW_set_bitmap_name(String img_author, String img_date);
Remark
Table 15.4: IMGLOW_set_bitmap_name(String, String) Method Settings
Setting Description img_author Sets the author tag at 315. img_date Sets the date tag is 306.
Returns
Returns the Name or Author and Date tag. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 15.2:IMGLOW_set_bitmap_nameSample
Public int IMGLOW_set_bitmap_name(
String img_author,
221 Chapter 15 - Miscellaneous Methods
String img_date ) { return tif_save.set_image_name(img_author,img_date); }
IMGLOW_set_fast_convert(int, int)
This method greatly improves performance for decompression and conversion. Only call this function once per image. Call this method before any of the decompression methods in order to enable fast convert either from File I/O based or memory. To turn this method on, set the off_on value to 1. To reset this method, set the off_on value to 0.
This method makes the decompression methods non-reentrant or no longer thread safe when turned on.
Note: This method currently only works with MO:DCA or AFP images.
Syntax
int IMGLOW_set_fast_convert(int off_on, int format);
Remark
Table 15.5: IMGLOW_set_fast_convert(int, int) Method Variable
Variable Description 0 = Off off_on 1 = On format Applies fast convert to this input format.
Returns
Returns the status of the conversion. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_msg_render_preference(int)
This method sets the rendering preferences for Microsoft’s .MSG files. This preference is loose and may not actually take effect due to technical complications such as there is no data of that type within the .MSG file.
Syntax
222 Chapter 15 - Miscellaneous Methods int IMGLOW_set_msg_render_preferences(int preference);
Remark
Table 15.6: IMGLOW_set_msg_render_preferences(int) Method Variables
Variable Description Rendering data source preference for email body data. ASCII, Unicode, RTF, and HTML are recognized but may preferences not be all supported. Please see Appendix A, Supported File Formatsfor the specific integer values.
Returns
Returns the status of the rendering preferences for Microsoft’s .MSG files. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_third_party_use(int, boolean)
This method sets RasterMaster Java’s use of third party technology for certain format types.
Syntax int IMGLOW_set_third_party_use(int formatToRead, int isUsingThirdParty);
Remark
Table 15.7: IMGLOW_set_third_party_use(int, boolean) Method Variable
Variable Description RasterMaster Java file format enumeration for the formatToRead expected Office file format to render. Checks to see if RasterMaster Java is using third party isUsingThirdParty technology.
Returns
Returns the status of using third party technology. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_tiff_tag(int, int, int, byte[])
This method allows RasterMaster Java to write new and current tags. This method can be called multiple times for adding multiple tags to write.
223 Chapter 15 - Miscellaneous Methods
Note: If you read in a TIFF file, RasterMaster Java does not save any of the tags. None of the tag data is saved except for the needed data such as bits per pix, height, and DPI. This is saved in the LPBITMAPINFOHEADER struct in RasterMaster Java's internal format. Any other tags are not preserved. You could read in the tags and data you need from a source TIFF, then set new tags and data before saving.
Setting thetag ID to -1 clears out all extra tags from being written to the file. It stores the previous values between calls. Then, set new tag values as shown in the following example:
Simage.IMGLOW_set_tiff_tag(-1,0,0,null);
Note: This method is not thread-safe. The tags are kept in static memory. The tags for TIFF files read in are not saved unless they are in the set needed to create a PDF file. Alternatively, the user can explicitly call IMGLOW_set_tiff_tag for each tag in the original TIFF. The thread-safe workaround is encapsulating the processing of one file in a synchronized block with a class object or a static member as a static lock.
Syntax
int IMGLOW_set_tiff_tag(int tag, int max_bytes, int value, byte buff[]);
Remarks
Table 15.8: IMGLOW_set_tiff_tag(int, int, int, byte[]) Method Variables
Variable Description tag ID of tag to write. max_bytes Total size of tag value or data in bytes. value Integer value for a tag size of 4 bytes. Data binary or ASCII to write if tag size is greater than 4 buff bytes.
Returns
Returns the status of the tag. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_UTF_8(int)
224 Chapter 15 - Miscellaneous Methods
This method forces all files being decompressed to process as a UTF file. UTF-8 (8-bit USC/Unicode Tranformation Format) is a variable-length character encoding for Unicode. UTF allows double byte characters.
Note: Snowbound Software’s auto detection requires at least 10 characters to properly detect the ASCII format. We do not support extended ASCII characters so our format detection will fail if these are present in the first 10 characters. It is possible to use UTF - 8 , by setting the tSimage.IMGLOW_set_UTF_8(1);. This will force processing as a UTF - 8 file.
Syntax int IMGLOW_set_UTF_8(int mode);
Remarks
Table 15.9: IMGLOW_set_UTF_8(int) Method Variables
Variable Description 0 = Turns off UTF processing. mode 1 = Turns on UTF processing.
225 Chapter 16 - Printing Images
Chapter 16 - Printing Images
This chapter describes how to print images using the RasterMaster Java. The Printing Sample sample demonstrates printing using the Snowbound product. It contains both an application and applet. The features includes altering the size of an image and image printing. You can find the samples in the following directory: [RM Java install dir] \Samples\com\snowbound\samples.
Printing Overview
All Snowbound products print to any device with a valid Windows printer driver installed.
If a color or gray scale image is printed to a 1-bit or bi-level printer such as an HPLASERJET type printer, the image is dithered or reduced to 1-bit per pixel automatically.
The capabilities of the printer are detected by the Snowbound libraries to determine if the image must be dithered. The technique employed is Stucky error diffusion. This technique simulates grayscale by the placement of dots. The higher the resolution of the printer, the better the effect.
Printing Methods
There are three printing methods available.
Normal Printing
Normally, to print the current image at the specified coordinates, use the method below.
IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int)
This method prints the current image at the specified coordinates.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Printing Sample
l The SilentPrint Sample
l The Swing Sample
l Working with Vector PDF vs. Raster PDF: The VectorPDF Sample
Syntax int IMG_print_bitmap(Graphics g, int xs, int ys, int xsize, int ysize, int res);
226 Chapter 16 - Printing Images
Remark
Table 16.1: IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int) Method Variables
Variable Description g Graphics port xs Starting X position ys Starting Y position xsize Horizontal size ysize Vertical size res Print resolution in DPI (dots per inch). Usually set to 300.
Returns
Returns the status of specified coordinates of the displayed image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Printing Image Loaded into an Applet
To print images loaded into an applet, use the method below. This method automatically determines in which browser the applet is being displayed, and performs high-resolution corrections for that browser. It also formats the document for high-resolution printing.
IMG_print_applet(java.awt.Container, int)
This method prints images loaded into an applet. This method automatically determines in which browser the applet is being displayed, and performs high-resolution corrections for that browser. It also formats the document for high-resolution printing.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Printing Sample
l The SilentPrint Sample
Note: This method is for the Internet Explorer and Netscape Navigator browsers only. Results may vary with other browsers.
Syntax
int IMG_print_applet(Container C, int res);
Remark
227 Chapter 16 - Printing Images
Table 16.2: IMG_print_applet(java.awt.Container, int) Method Variables
Variable Description C java.awt.Container into which image is displayed Dots per inch for printed document (must be the same as res the printer resolution)
Returns
Returns the status of Java.awt.Container of the displayed image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 16.1:IMG_print_appletSample
void button4_clicked(Event e) { IMG_print_applet(this, 300); }
Printing High-resolution Multi-page Documents
To print high-resolution multi-page documents from applets, use the method below.
IMG_print_applet_pages(java.awt.Container, int)
This method prints high-resolution multi-page documents from applets.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Printing Sample
l The SilentPrint Sample
Notes: Results may vary depending on the web browser that is used. The resolution passed into this method must match the printer resolution. For example, if the printer is set to print at 300 DPI, make res = 300. Call this method for each page, pass c as null after the last page. A print dialog displays (in Windows), and the print job begins.
Syntax int IMG_print_applet_pages(Container c, int res);
228 Chapter 16 - Printing Images
Remark
Table 16.3: IMG_print_appiet_pages(java.awt.Container, int) Method Variables
Variable Description c Java.awt.Container of displayed image res Resolution in DPI (dots per inch) of the destination image
Returns
Returns the status of Java.awt.Container of the displayed image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 16.2:IMG_print_applet_pagesSample
void button5_clicked(Event e) { //for a 3 page document for(int i = 0; i < 3; i++) { Simage.IMG_decompress_bitmap_stream_onthefly(st, i,this); IMG_print_applet_pages(this, 300); } IMG_print_applet_pages(null, 0); }
Notes: Results may vary depending on the web browser that is used. The resolution passed into this method must match the printer resolution. For example, if the printer is set to print at 300 DPI, make res = 300. Call this method for each page, pass c as null after the last page. A print dialog displays (in Windows), and the print job begins.
Methods Used for Printing
The Printing Sample sample demonstrates printing using the Snowbound product. It contains both an application and applet. The features includes altering the size of an image and image printing. You can find the samples in the following directory: [RM Java install dir] \Samples\com\snowbound\samples. For more information on the methods used in sample, click on one of the links below:
229 Chapter 16 - Printing Images
l IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int)
l IMG_print_applet(java.awt.Container, int)
l IMG_print_applet_pages(java.awt.Container, int)
Methods Used for Silent Printing
The SilentPrint Sample sample demonstrates how to perform a silent print. You can find the samples in the following directory: [RM Java install dir] \Samples\com\snowbound\samples. For more information on the methods used in The Printing Sample sample, click on one of the links below:
l IMGLOW_set_document_input(int, int, int)specifies the input DPI and bit-depth for PDF, MS Office, RTF, PCL, and AFP files.
l IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid Snowbound image.
l IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int)prints the current image at the specified coordinates.
Printing Large Documents
Printing large documents, such as documents approaching or exceeding 100 pages, or documents set to a resolution of 300 DPI or above, requires additional memory resources. These additional resource requirements can affect the performance of both servers and clients.
Servers
Depending on the current Java Virtual Machine memory configuration for the Imaging server, the need for additional resources may cause an out of memory error. Increasing the Java Virtual Machine maximum heap size to the Imaging server during start up can help avoid memory errors. Specify the minimum and maximum heap size by passing the parameter -Xms and -Xmx to the Imaging server during start up, where the amount of memory is in megabytes or gigabytes you want to allocate to the Imaging server.
Clients
Each of the different browsers handles the increased resource demands uniquely. In some cases, when printing documents that require additional resources, the document may print with blank pages, fail to respond, or require the browser or computer to be restarted.
Solution
230 Chapter 16 - Printing Images
A workaround for this problem may be to download the document locally and then print it. If the document does not have any annotations or the document is to be printed without annotations, the original document can be downloaded and printed. However, if a document is to be printed with annotations, a TIFF version of the document can be downloaded and printed.
231 Chapter 17 - Annotations for RasterMaster Java
Chapter 17 - Annotations for RasterMaster Java
This chapter describes annotations for RasterMaster Java. The Viewing and Annotations Sample is an image viewer that demonstrates the following image manipulations: altering the viewable size, changing the orientation, changing the size and resolution, making corrections, and flipping through pages of a multi-page file. You can find the samples in the following directory: [RM Java install dir]\Samples\com\snowbound\samples.
This sample also demonstrates several annotation methods, such as adding edits, bitmaps, lines, sticky notes, and more through a variety of methods. These annotations can be in both text and graphic format.
Overview of Annotations for the Java™ Platform
The Snowbound Software annotation toolkit is a Java class library for adding text, lines, highlights, and other annotations to bitmap images. The annotations are read and saved as a separate file so they can be added or edited independently of the bitmap image.
The display allows normal zooming, panning, and scrolling of the bitmap image with annotations drawn on top. The toolkit provides a number of built-in user interface methods for adding and editing annotations.
The Annotation toolkit works like the imaging library; simple Java methods are used to perform the functionality. The developer can layer the annotations. Currently, annotations may be placed on the image, read, written to a file, deleted, resized, and moved.
To create a new Annotation object or read from a file, start by using the standard SnowAnn constructor below. SnowAnn Sann = new SnowAnn(simage.getWidth(), simage.getHeight());
Notes: Annotations require the image width and height. The Text and Post-it objects allow text editing because they subclass java.awt.TextArea. To take advantage of built in editing, you must add some code to the event handling procedure of your Container, and pass those events to the SnowAnn class.
Annotation Classes for the Java™ Platform
The annotation classes for the Java platform are listed below. For more information on the annotation classes, click on one of the links below to see detailed class information in Snowbound Classes :
232 Chapter 17 - Annotations for RasterMaster Java
l Snow.SnowAnn
l Snow.ANN_GRAPHIC_STRUCT
l Snow.SANN_POINT
l Snow.SANN_RECT
Snow.SnowAnn Fields
Table 17.1: Snow.SnowANN Fields
Field Description ANN_BUFF_SIZE Sets the annotation buffer size, 10 * 1024. gCancelCommand The Cancel command gCopyCommand The Copy command gCutCommand The Cut command gDeleteCommand The Delete command gEditTextCommand The Edit Text command gMoveCommand The Move command gPermissionsCommand The Permissions command gPropertiesCommand The Properties command gResizeCommand The Resize command gRotateCommand The Rotate command SANN_ARROW Arrow annotation SANN_BITMAP Bitmap annotation SANN_BUBBLE Bubble annotation SANN_CIRCLE Circle annotation SANN_CLOUD_EDIT Cloud Edit annotation SANN_CUSTOM_STAMP Custom Stamp annotation SANN_EDIT Edit annotation SANN_ELLIPSE Ellipse annotation SANN_FILLED_ELLIPSE Filled Ellipse annotation SANN_FILLED_POLYGON Filled Polygon annotation SANN_FILLED_RECT Filled Rectangle annotation SANN_FREEHAND Freehand annotation SANN_HIGHLIGHT_RECT Highlight rectangle annotation SANN_LINE Line annotation SANN_POINT_SIZE Sets the point size SANN_POLYGON Polygon annotation SANN_POSTIT Post-it annotation SANN_RECTANGLE Rectangle annotation SANN_TRANSPARENT_BITMAP Transparent bitmap annotation WM_LBUTTONDOWN Down button annotation ann_bblue Current blue value background drawing color
233 Chapter 17 - Annotations for RasterMaster Java
Field Description ann_bgreen Current green blue background drawing color ann_bold Bold attribute for text ann_bred Current red value background drawing color ann_crop_xe Current cropping rectangle x size ann_crop_xs Current cropping rectangle x position ann_crop_ye Current cropping rectangle y size ann_crop_ys Current cropping rectangle y position ann_cur_object_id Current type of object ann_fblue Current blue value foreground drawing color ann_fcs Current rotation angle, ANN_GRAPHIC_STRUCT ann_fgreen Current green value foreground drawing color ann_font_height Current font height ann_font_name Current selected font drawing name ann_fred Current red value foreground drawing color ann_height Height of annotated image ann_italic Italic attribute for text ann_line_style Current line styles such as solid ann_line_width Current line width for drawing ann_rc SANN_RECT ann_rotation_angle Current rotation angle Uses exact point sizes in calculating font sizes in Text ann_use_exact_points objects. The default is false. ann_width Width of annotated image annCreateDate The annotation creation date annCreateUser Indicates which user created the annotation object. Indicates if annotation object is to be deleted. If true, annDelete object will not be written back out to XML after a call to SANN_write_xml_ann_pages(). annDeleteDate Indicates date of annotation deletion. annDeleteUser Indicates user who deleted annotation. Denotes annotation height or Y axis offset in XML annHeight annotations. annID Denotes annotation ID in XML annotations. annModifyDate Indicates modification date of current annotation. annModifyUser Indicates user who performed last modification. Denotes annotation ordering in resulting XML file where 0 annOrdinal indicated first annotation object. annotatedDocumentID Indicates the document id annotated file. annotatedFileName Indicates the name of annotated file. Denotes X axis annotation start position in XML annStartX annotations. Denotes Y axis annotation start position in XML annStartY annotations. annTransparent Denotes annotation transparency level in XML
234 Chapter 17 - Annotations for RasterMaster Java
Field Description annotations. Denotes annotation type in XML annotations, based on annType supported Snowbound annotation types. Denotes annotations width or X axis offset in XML annWidth annotations. bitmapData Denotes annotated page width in XML annotations. createDate Denotes annotation creation date. createUser Indicates which user created the annotation object. double_byte Used for using double byte edit controls. fcs Specifies the object to resize. ANN_GRAPHIC_STRUCT fillColor Indicates fill color for solid annotation objects. fillTransparent Denotes the annotated page width in XML annotations. Indicates if font is bold or not in XML annotation supporting fontBold text. fontColor Indicates the font color in XML annotation supporting text. Indicates if font is italized or not in XML annotations fontItalic support. fontName Indicates the font face name. fontSize Indicates the font point size. fontStrike Indicates if font has a strike-through text. fontUnderline Indicates if the font should be underlined or not. Object type to add when using user controlled adding of graphic_id objects graphic_num Number or handle of graphic object. lineColor Denotes the line color in XML annotations. Denotes line style in XML annotations.
lineStyle Note: RasterMaster Java only supports the solid line style. lineTransparent Indicates line transparency level for XML annotation. lineWidth Indicates the line width for XML annotations. pageHeight Denotes annotated page height in XML annotations. pageWidth Denotes annotated page width in XML annotations. point_array Array of SANN_POINTs defining freehand line drawing. pointArray Indicates a point array for freehand or polygon annotations. popup Defines the popup menu. rotationAngle Indicates the rotation angle of annotation object. textString Denotes the annotated page width in XML annotations.
Snow.SnowAnn
This class is used to create or read annotation objects from a file. The default constructor for SnowAnn takes two parameters, the height and width respectively, of the image object on which to display annotations. This class represents a set of annotation objects for a particular
235 Chapter 17 - Annotations for RasterMaster Java image and all of the operations you can perform on those annotations. For method descriptions, see Class Snow.Snowbnd Methods.
Note: To construct a new SnowAnn object, you must set the height and width of the annotation object to the height and width of the related image.
Syntax public SnowAnn(int width, int height, int dpi);
Remark
Table 17.2: SnowAnn(int, int, int) Method Variables
Variable Description width Width of the annotation in pixels height Height of the annotation in pixels dpi Dots per inch
This section describes the method class Snow.SnowAnn. ann_dblclick(java.awt.Container, int, int)
This method selects the annotation under the mouse coordinates. It then activates and enables it for editing if you are using the SANN_EDIT or SANN_POSTIT object. Call this during mouse- click events.
Syntax int ann_dblclick(Container sf, int xpos, int ypos);
Remark
Table 17.3: ann_dbclick(java.awt.Container, int, int) Method Variables
Variable Description sf Container for currently displayed image xpos Position of mouse cursor on X-axis ypos Position of mouse cursor on Y-axis
Returns
Returns the position of the mouse cursor. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
GetClientRect(java.awt.Container, Snow.SANN_RECT)
236 Chapter 17 - Annotations for RasterMaster Java
This method fills a SANN_RECT object with the current height and width of the display area. It subtracts the height and width of the scrollbars for the calculation.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Syntax
int GetClientRect(Container sf, SANN_RECT rc);
Remark
Table 17.4: GetClientRect(java.awt.Container, Snow.SANN_RECT) Method Variables
Variable Description sf Container for currently displayed image Snow.SANN_RECT to be filled with display area height rc and width
Returns
Returns the current display area. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
read_xml_file(SnbdFileio fd, int page)
This method converts an XML file containing FileNet annotations.
Syntax
int read_xml_file(SnbdFileio fd, int page);
Remark
Table 17.5: read_xml_file(SnbdFileio, int) Method Variables
Variable Description fd Snowbound file descriptor page The desired page
Returns
Returns the desired page. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
resize_object(ANN_GRAPHIC_STRUCT fcs, SANN_RECT rc)
237 Chapter 17 - Annotations for RasterMaster Java
This method resizes (or moves) the specific ANN_GRAPHIC_STRUCT object. It populates the rc variable with the absolute rectangle coordinates of the new bounding box of the annotation object.
Syntax int resize_object(ANN_GRAPHIC_STRUCT, SANN_RECT);
Remark
Table 17.6: read_xml_file(SnbdFileio fd, int page) Method Variables
Variable Description fcs Specifies the object to resize Snow.SANN_RECT populated with the new object size rc and location.
Returns
Returns the status of the object to resize. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_activate_all_objects(void)
This method activates all text based annotation objects to allow text editing in the TextArea represented by these objects. Currently used only on the SANN_EDIT and SANN_POSTIT objects.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Note: In this mode, you can move, edit, and delete the object.
Syntax int SANN_activate_all_objects();
Returns
Returns the activated objects. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_activate_object(java.awt.Container, int)
238 Chapter 17 - Annotations for RasterMaster Java
This method is currently used only on the SANN_EDIT and SANN_POSTIT objects to allow editing of the text in the object.
Note: In this mode you can move, edit, and delete the object.
Syntax
int SANN_activate_object(Container sf, int graphic_num);
Remark
Table 17.7: SANN_activate_object(java.awt.Container, int) Method Variables
Variable Description sf Container class for frame or window graphic_num Specify the object to activate
Returns
Returns the Container class for the frame or window. A value of 0 indicates success. Any value less than zero is a Snowbound error code.See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_add_object(int, Snow.SANN_RECT, byte[], Snow.SANN_POINT[], int)
This method adds a new object to the current annotation. Use data_array to hold the text of a SnowAnn.EDIT or SnowAnn.POSTIT object. Use point_array for freehand annotations. Use SANN_map_wnd_to_imageto convert from screen to image coordinates.
See SANN_map_wnd_to_image(java.awt.Container, java.awt.Point) for more information.
Syntax
int SANN_add_object(int graphic_id, SANN_RECT rc, byte data[], SANN_POINT point_array[], int data_size);
Remark
Table 17.8: SANN_add_object(int, Snow.SANN_RECT, byte[], Snow.SANN_ POINT[], int) Method Variables
Variable Description A unique number for each graphic object. See graphic_id Snow.SnowAnn Annotation Object Values for a list of current objects. rc Rectangle defining outline of points for most graphics
239 Chapter 17 - Annotations for RasterMaster Java
Variable Description objects in the current image's coordinates. data Data for text in freehand annotations and edits. point_array Array of SANN_POINTs defining freehand line drawing. data_size The size in bytes for freehand or edits.
Returns
Returns the new object to the current annotation. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_deactivate_all_objects(void)
This method is used on the SANN_EDIT and SANN_POSTIT objects to disallow editing of text in all text based objects. It makes the window inactive and draws the object data statically, superimposed on the image.
In this mode you cannot move, resize, or delete the object. You must call SANN_activate_ object to enable text editing. This call deactivates all objects on the page.
See SANN_activate_object(java.awt.Container, int) for more information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Note: In this mode you cannot move, resize, or delete the object. You must call SANN_ activate_object to enable text editing. This call deactivates all objects on the page.
Syntax int SANN_deactivate_all_objects();
Returns
Returns the status of the dactivated object. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_deactivate_object(int)
This method is used on the SANN_EDIT and SANN_POSTITobjects to stop the editing of text in TextArea. It makes the window inactive and draws the object data statically, superimposed on the image.
240 Chapter 17 - Annotations for RasterMaster Java
Note: In this mode you cannot move, resize, or delete the object. You must call the SANN_ activate_objectmethod to edit the text. See SANN_activate_object (java.awt.Container, int) for more information.
Syntax
int SANN_deactivate_object(int graphic_num);
Remark
Table 17.9: SANN_deactivate_object(int) Method Variables
Variable Description graphic_num Specify the object to activate
Returns
Returns the status of the dactivated object. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_delete_all_objects(void)
This method deletes all graphics and memory associated with the current annotation object.
Notes: This action is permanent; all annotation object data is lost. After making this call, the current annotation object is not valid.
Syntax
int SANN_delete_all_objects();
Returns
Returns the status of the deleted object. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_delete_object(int)
This method deletes a graphic from the current annotation list.
241 Chapter 17 - Annotations for RasterMaster Java
Note: This action is permanent and all object data is lost.
Syntax int SANN_delete_object(int graphic_num);
Remark
Table 17.10: SANN_delete_object(int) Method Variables
Variable Description This is an internal number for each graphic returned by SANN_get_object_num. It is merely the number in a linked list of graphics objects. graphic_num Note: Use this number only after the call to SANN_get_ object_number as SANN_delete_object may change the number of existing graphics.
Returns
Returns the status of the deleted object. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_display_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int)
This method displays all current annotations (superimposes on the image) to the Graphics context pointed by g. This method always assumes the image is aspect ratio corrected into the coordinates xs, ys, xz, and yz.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Note: Before calling this method, you may want to call SANN_set_croprectto allow for zooming and scrolling. See SANN_set_croprect(int, int, int, int) for more information.
Syntax int SANN_display_annotations(Graphics g, Container c, int xs, int ys, int xz, int yz);
242 Chapter 17 - Annotations for RasterMaster Java
Remark
Table 17.11: SANN_display_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int) Method Variables
Variable Description g java.awt.Graphics context java.awt.Container in which to display the c annotations xs Starting X position ys Starting Y position xz X size of display area yz Y size of display area
Returns
Returns the status of the displayed annotations. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_draw_object(java.awt.Graphics, int, int, int, int, int)
This method draws the object (graphic_num) at the coordinates passed in (xs, ys, xz, and yz). It can be used to draw selected annotations.
Syntax
int SANN_draw_object(Graphics g, int graphic_num, int xs, int ys, int xz, int yz);
Remark
Table 17.12: SANN_draw_object(java.awt.Graphics, int, int, int, int, int) Method Variables
Variable Description g java.awt.Graphics context in which to draw graphic_num Specified object to draw xs X position at which to start drawing ys Y position at which to start drawing xz X size to draw object yz Y size to draw object
Returns
Returns the status of the drawn object. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
243 Chapter 17 - Annotations for RasterMaster Java
SANN_flipx(void)
This method reverses the image to create a mirror effect in the horizontal direction.
Syntax int SANN_flipx(void);
Returns
Returns the status of the mirror effect in the horizontal direction. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_flipy(void)
This method reverses the image to create a mirror effect in the vertical direction.
Syntax int SANN_flipy(void);
Returns
Returns the status of the reversed mirror effect in the vertical direction. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_get_croprect(Snow.SANN_RECT)
This method returns the cropping rectangle for the current annotation display area (the visible display area).
Syntax int SANN_get_croprect(SANNc_RECT rc);
Remark
Table 17.13: SANN_get_croprect(Snow.SANN_RECT) Method Variables
Variable Description rc rc.bottom, rc.top, rc.right, rc.left, rectangle coordinates
Returns
Returns the cropping rectangle for the current annotation display area (the visible display area). A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Supported File Formats for a list of error code.
244 Chapter 17 - Annotations for RasterMaster Java
SANN_get_graphic_struct(int)
This method returns theANN_GRAPHIC_STRUCT class. The class contains all information on this annotation object including type of object, color, dimensions, positions and more.
Syntax
int SANN_get_graphic_struct(int graphic_num);
Remark
Table 17.14: SANN_get_graphic_struct(int) Method Variables
Variable Description The number to identify the annotation object to return data graphic_num for.
Returns
Returns the ANN_GRAPHIC_STRUCT class. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_get_object_bounds(int, Snow.SANN_RECT)
This method returns the bounding box of the object (graphic_num) in image pixel coordinates. The coordinates are absolute.
Syntax
int SANN_get_object_bounds(int graphic_num, SANN_RECT rc);
Remark
Table 17.15: SANN_get_object_bounds(int, Snow.SANN_RECT) Method Variables
Variable Description graphic_num Object contained by rc rc Rectangle of bounding box
Returns
Returns the bounding box of the object (graphic_num) in image pixel coordinates. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_get_object_data(int, byte[])
This method is used to get the text data from a Post-it note or text annotation object.
245 Chapter 17 - Annotations for RasterMaster Java
Syntax int SANN_get_object_data(int graphic_num, byte data[]);
Remark
Table 17.16: SANN_get_object_data(int, byte[]) Method Variables
Variable Description The number to identify the annotation object to return data graphic_num for. data The byte array to return data in.
Returns
Returns the status of the object data. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_get_object_info(int)
This method returns an instance of the Snow.ANN_GRAPHIC_STRUCT class, which is the internal wrapper for the object number passed in. This has information about the size, color, and object attributes. See Snow.ANN_GRAPHIC_STRUCT for more information.
Syntax
Snow.ANN_GRAPHIC_STRUCT SANN_get_object_info(int graphic_num);
Remark
Table 17.17: SANN_get_object_info(int) Method Variables
Variable Description graphic_num Specify the object for which to return a structure pointer
Returns
Snow.ANN_GRAPHIC_STRUCT. Refer to beginning of this chapter for more information.
SANN_get_object_num(java.awt.Container, int, int)
This method tries to find the graphic_num of the annotation object whose bounding box completely surrounds the points xpos and ypos. If successful, it returns the graphic number usable by SANN_delete_objectand other methods.
See SANN_delete_object(int) for more information.
Syntax int SANN_get_object_num(java.awt.Container sf, int xpos, int ypos);
246 Chapter 17 - Annotations for RasterMaster Java
Remark
Table 17.18: SANN_get_object_num(java.awt.Container, int, int)Method Variables
Variable Description sf java.awt.Container for displayed image xpos X coordinate in the windows coordinates ypos Y coordinate in the windows coordinates
Returns
Returns the graphic number usable by SANN_delete_object and other methods. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_highlight_object(java.awt.Container, Snow.SANN_RECT, int)
This method highlights the bounding box of the annotation object specified by graphic_num. This graphic num is retrieved by the SANN_get_object_num method.
See SANN_get_object_num(java.awt.Container, int, int) for more information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Syntax
int SANN_highlight_object(java.awt.Container sf, Snow.SANN_RECT disp, int graphic_num);
Remark
Table 17.19: SANN_highlight_object(java.awt.Container, Snow.SANN_RECT, int) Method Variables
Variable Description sf java.awt.Container for displayed image disp Rectangle of client area of frame or window graphic_num Annotation object to highlight
Returns
Returns the graphic number retrieved by the SANN_get_object_num method. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_map_image_to_wnd(java.awt.Container, java.awt.Point)
247 Chapter 17 - Annotations for RasterMaster Java
This method converts the internal graphics coordinates of the image to coordinates of the current window.
Syntax int SANN_map_image_to_wnd(java.awt.Container sf, java.awt.Point pt);
Remark
Table 17.20: SANN_map_image_to_wnd(java.awt.Container, java.awt.Point) Method Variables
Variable Description sf Current display container pt Absolute X and Y coordinates to convert
Returns
Returns the current display container. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_map_wnd_to_image(java.awt.Container, java.awt.Point)
This method converts coordinates of the current window to the internal graphics coordinates of the image.
Syntax int SANN_map_wnd_to_image(java.awt.Container sf, java.awt.Point pt);
Remark
Table 17.21: SANN_map_wnd_to_image(java.awt.Container, java.awt.Point) Method Variables
Variable Description sf Current display container pt Absolute X and Y coordinates to convert
Returns
Returns the current display container. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_merge_annotations(Snowbnd, java.awt.Container)
This method will permanently merge annotations onto the Snowbound image object passed in.
248 Chapter 17 - Annotations for RasterMaster Java
You can use this method to burn in redactions. You will need to save the image after merging the annotations. Then, you should display the saved image that contains the burned in redactions (merged annotations). For an example of how to merge annotations with an image, please see the code snippet, MergeAnnotationWithImage, located at /Samples/com/snowbound/samples/snippets.
Syntax
int SANN_merge_annotations(Snowbnd snow, java.awt.Container sf);
Remark
Table 17.22: SANN_merge_annotations(Snowbnd, java.awt.Container) Method Variables
Variable Description Current Snowbound image object to merge annotations snow onto. Current display container. May be a frame, panel, or sf Jframe.
Returns
Returns the current display container. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_move_object(int, Snow.SANN_RECT)
This method moves or resizes the object (graphic_num).
Syntax
int SANN_move_object(int graphic_num, SANN_RECT rc);
Remark
Table 17.23: SANN_merge_annotations(Snowbnd, java.awt.Container) Method Variables
Variable Description graphic_num Specify the object to move. Rectangle for new object position and size. Coordinates are rc absolute.
Returns
Returns the status of the object to move. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
249 Chapter 17 - Annotations for RasterMaster Java
SANN_output_pdf(double, double, double, doublet, int, in)
This method converts the current annotation object to PDF content in a buffer.
Syntax int SANN_output_pdf(double xsize, double ysize, double x_pos, double y_pos, int angle, int error[]);
Remark
Table 17.24: SANN_output_pdf(java.awt.Graphics, java.awt.Container, int, int, int, int) Method Variables
Variable Description xsize Size of the PDF file to add in. ysize Size of the PDF file to add in. x_pos Starting X position y_pos Starting Y position angle The page angle if the PDF page is rotated error[] Error code returned
Returns
Returns a byte[] of the outbuffer with the PDF content contained. Returns null if there aer no more objects. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_print_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int)
This method prints the current annotation to the graphic context pointed by g. It always assumes the image is aspect ratio corrected into the absolute image coordinates xs, ys, xz, and yz.
Syntax int SANN_print_annotations(Graphics g, Container sf, int xs, int ys, int xz, int yz);
Remark
Table 17.25: SANN_print_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int) Method Variables
Variable Description g java.awtGraphics printer context into which to draw image sf java.awt.Container for the Snowbnd image object
250 Chapter 17 - Annotations for RasterMaster Java
Variable Description xs Starting X position ys Starting Y position xz Size of window along its X axis yz Size of window along its Y axis
Returns
Returns the status of the print annotations. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_read_ann(DataInputStream, int)
This method reads an annotation file from a DataInputStream. It supports multi-page annotation files.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Syntax
int SANN_read_ann(DataInputStream di, int page);
Remark
Table 17.26: SANN_read_ann(DataInputStream, int) Method Variables
Variable Description di DataInputStream page Page number to read
Returns
Returns the status of the DataInputStream. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_read_ann(String)
This method reads an annotation file from disk. Pathnames are absolute. It supports multi-page annotation files.
Syntax
int SANN_read_ann(String filename);
Remark
251 Chapter 17 - Annotations for RasterMaster Java
Table 17.27: SANN_read_ann(String) Method Variables
Variable Description filename Filename to read in
Returns
Returns the status of the filename to read in. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_read_ann(String, int)
This method reads an annotation file from disk. Pathnames are absolute. It supports multi-page annotation files.
Syntax int SANN_read_ann(String filename, int page);
Remark
Table 17.28: SANN_read_ann(String, int) Method Variables
Variable Description filename Filename to read in page Page number to read
Returns
Returns the status of the filename to read in. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_read_ann_stream(String, int)
This method reads an annotation file from a fully qualified URL address. It is used to load in annotations from the web. It supports multi-page annotation files.
Syntax int SANN_read_ann_stream(String filename, int page);
Remark
Table 17.29: SANN_read_ann_stream(String, int) Method Variables
Variable Description filename Filename to read in (ex. http://www.snowbound.com/file.ann) page Page number to read
252 Chapter 17 - Annotations for RasterMaster Java
Returns
Returns the status of the filename to read in. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
c
SANN_recalc_size(int, int)
This method recalculates objects’ dimensions and positions.
Syntax
int SANN_read_ann_stream(int nWidth, int nHeight);
Remark
Table 17.30: SANN_read_ann_stream(String, int) Method Variables
Variable Description nWidth The new width for an annotation object nHeight The new height for an annotation object
Returns
Returns the objects’ dimensions and positions. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_resize_object(int, Snow.SANN_RECT)
This method resizes (or moves) the object indicated by graphic_num. It populates rc with the absolute rectangle coordinates of the new bounding box of the annotation object.
Syntax
int SANN_resize_object(int graphic_num, SANN_RECT rc);
Remark
Table 17.31: SANN_resize_object(int, Snow.SANN_RECT) Method Variables
Variable Description graphic_num Specify the object to resize Snow.SANN_RECT populated with new object size and rc location
Returns
253 Chapter 17 - Annotations for RasterMaster Java
Returns the status of the object to resize. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_rotate(int)
This method rotates all annotations on the currently displayed image. Rotation is in increments of 90 degrees up to 270 degrees.
Syntax int SANN_rotate(int angle);
Remark
Table 17.32: SANN_rotate(int) Method Variables
Variable Description The amount by which to rotate annotation, in increments of angle 90 degrees.
Returns
Returns the status of the amount by which to rotate the annotation. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_set_bcolor(int, int, int)
This method sets the current background drawing color for all graphics. Only used by the Edit, Post-it, and Highlight objects.
Syntax int SANN_set_bcolor(int red, int green, int blue);
Remark
Table 17.33: SANN_set_bcolor(int, int, int) Method Variables
Variable Description red Red value 0 - 255 green Green value 0 - 255 blue Blue value 0 - 255
Returns
254 Chapter 17 - Annotations for RasterMaster Java
Returns the status of the current background drawing color for all graphics. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_set_croprect(int, int, int, int)
The cropping rectangle is essentially the size of the display container (which is usually a subclass of java.awt.Container), mapped onto the image (corrected for image scaling).
To use cropping methods with zooming, see SANN_map_wnd_to_image(java.awt.Container, java.awt.Point) and SANN_move_object(int, Snow.SANN_RECT).
This method is similar in operation to IMG_set_croprect. See SANN_set_croprect(int, int, int, int) for more information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Syntax
int SANN_set_croprect(int xs, int ys, int xe, int ye);
Remark
Table 17.34: SANN_set_croprect(int, int, int, int) Method Variables
Variable Description xs X starting coordinate ys Y starting coordinate xe X crop rectangle size ye Y crop rectangle size
Returns
Returns the status of the cropping rectangle. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_set_fcolor(int, int, int)
This method sets the current foreground drawing color for all annotation objects.
Syntax
int SANN_set_fcolor(int red, int green, int blue);
Remark
Table 17.35: SANN_set_fcolor(int, int, int) Method Variables
255 Chapter 17 - Annotations for RasterMaster Java
Variable Description red Red value 0 - 255 green Green value 0 - 255 blue Blue value 0 - 255
Returns
Returns the current foreground drawing color for all annotation objects. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_set_font(String, int, int, int)
This method sets the current type of font to use for Edit and Post-it text annotations.
Syntax int SANN_set_font(String name, int italic, int bold, int font_ height);
Remark
Table 17.36: SANN_set_font(String, int, int, int) Method Variables
Variable Description name Name of font to use italic Use italic font 0 or 1 bold Use bold font 0 or 1 font_height Size of the font in pixels
Returns
Returns the current type of font to use for Edit and Post-it text annotations. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_set_line_style(int)
This method sets the style of the line according to predefined constants. Currently only solid lines are supported.
Syntax int SANN_set_line_style(int style);
Remark
Table 17.37: SANN_set_line_style(int) Method Variables
256 Chapter 17 - Annotations for RasterMaster Java
Variable Description style Style of line
Returns
Returns the style of the line according to predefined constants. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_set_line_width(int)
This method sets the width of lines in the annotation library in pixels.
Syntax
int SANN_set_line_width(int width);
Remark
Table 17.38: SANN_set_line_width(int) Method Variables
Variable Description width Width of line in pixels
Returns
Returns the width of lines in the annotation library in pixels. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_set_scrollbars(int)
This method allows setting the type of scrollbar used in a Post-it note or text annotation object.
Syntax
int SNBDAPI SANN_set_scrollbars(int ssetting);
Remarks
Table 17.39: SANN_set_scrollbars Method Variables
Variable Description Variable to indicate the desired scrollbars.
ssetting = 0 TextArea.SCROLLBARS_NONE; ssetting ssetting = 1 TextArea.SCROLLBARS_HORIZONTAL_ ONLY; ssetting = 2 TextArea.SCROLLBARS_VERTICAL_ONLY; ssetting = 3 TextArea.SCROLLBARS_BOTH;
257 Chapter 17 - Annotations for RasterMaster Java
SANN_set_size(int, int)
This method sets the height and width of the current image being annotated. The internal format for Snowbound annotations contains this information.
When reading in other annotation file formats, you need to call this method to set the height and width of the current annotation image being annotated after reading in the annotation file.
Syntax int SNBDAPI SANN_set_size(int width, int height);
Remarks
Table 17.40: SANN_set_size Method Variables
Variable Description width Width of current image being annotated height Height of current image being annotated
SANN_write_ann(byte[], int, byte[])
This method writes out annotations to a memory buffer. The method can be used to write data back to a server. The extra_size and extra_data parameters allow the embedding of other data into the file such as the company name or any other data you wish to save.
After writing the data to the buffer you can write it to a file with a standard subclass of java.io.OutputStream.
Syntax int SANN_write_ann(byte dos[], int extra_size, byte extra_data[]);
Remark
Table 17.41: SANN_write_ann(byte[], int, byte[]) Method Variables
Variable Description dos Byte array buffer to hold data extra_size Size of extra data to write, after the first header extra_data Buffer for extra data to write
Returns
Returns the status to write out annotations. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_write_ann(String, int, byte[])
258 Chapter 17 - Annotations for RasterMaster Java
This method writes out annotations to the disk file. The extra_size and extra_data parameters allow the embedding of other data into the file such as the company name or any data you wish to put in the file. There is currently no method to retrieve extra information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Syntax
int SANN_write_ann(String filename, int extra_size, byte extra_data []);
Remark
Table 17.42: SANN_write_ann(String, int, byte[]) Method Variables
Variable Description filename File/Path name to write extra_size Size of extra data to write after the first header extra_data Buffer for extra data to write
Returns
Returns the status to write out annotations. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_write_ann_fnx(String, String, int, byte[])
This method writes FileNet annotations to the disk file as XML.
The filenames generated are pathname/annotation#.xml, where # is the annotation number. For example, if there are five annotations, calling the method will output the following files: pathname/annotation1.xml pathname/annotation2.xml pathname/annotation3.xml pathname/annotation4.xml pathname/annotation5.xml
Syntax
int SANN_write_ann_fnx(String pathname, String filenetAnnId, int extra_size, byte extra_data[]);
Remark
259 Chapter 17 - Annotations for RasterMaster Java
Table 17.43: SANN_write_ann_fnx(String, String, int, byte[]) Method Variable
Variable Description pathname Path name in which to write annotation files filenetAnnId FileNet annotation ID extra_size Size of extra data to write after the first header extra_data Buffer for extra data to write
Returns
Returns the status to write out FileNet annotations to the disk file as XML. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_write_ann_idm(String, String, String, int)
This method writes out IDM annotations to disk file.
Syntax int SANN_write_ann_idm(String pathname, String userName, String groupName, int page);
Remark
Table 17.44: SANN_write_ann_idm(String, String, String, int) Method Variable
Variable Description pathname Path name in which to write annotation file. userName Creator's user name. groupName Creator's group name. page Page number.
Returns
Returns the status to write out IDM annotations to disk file. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_write_ann_idm(String, String, int, int)
This method returns a byte array containing IDM annotations.
Syntax
260 Chapter 17 - Annotations for RasterMaster Java
int SANN_write_ann_idm(String userName, String groupName, int page, int error[]);
Remark
Table 17.45: SANN_write_ann_idm(String userName, String groupName, int page, int error[]) Method Variable
Variable Description userName Creator's user name groupName Creator's group name page Page number. Array for returning an integer error code. See Appendix D, error Snowbound Error Codes for a list of error codes.
Returns
Returns returns a byte array containing IDM annotations. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_write_ann_pages(String, int, byte[])
This method writes out annotations to the disk file. The extra_size and extra_data parameters allow the embedding of other data into the file such as the company name or any data you wish to put in the file. There is currently no method to retrieve extra information. This method appends a new page to the annotation file if one currently exists.
Syntax
int SANN_write_ann_pages(String filename, int extra_size, byte extra_data[]);
Remark
Table 17.46: SANN_write_ann_pages(String, int, byte[]) Method Variables
Variable Description filename File/Path name to write extra_size Size of extra data to write after the first header extra_data Buffer for extra data to write
Returns
Returns the status to write out annotations. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_write_ann_pages(byte[], int, byte[])
261 Chapter 17 - Annotations for RasterMaster Java
This method writes out annotations to a memory buffer. The method can be used to write data back to a server. The extra_size and extra_data parameters allow the embedding of other data into the file such as the company name or any other data you wish to save. This method appends a new page to the annotation file if one currently exists.
Syntax int SANN_write_ann_pages(byte dos[], int extra_size, byte extra_ data[]);
Remark
Table 17.47: SANN_write_ann_pages(byte[], int, byte[]) Method Variables
Variable Description dos Byte array buffer to hold data extra_size Size of extra data to write, after the first header extra_data Buffer for extra data to write
Returns
Returns the status to write out annotations to a memory buffer. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_write_ann_xml(byte[], Snow.SnowXMLWriter)
This method writes out the content of SnowXMLWriter to a byte[] array. This method should be called after the SnowXMLWriter has been wrapped in
Syntax int SANN_write_ann_xml(byte dos[], Snow.SnowXMLWriter xmlwriter) throws IOException;
Remark
Table 17.48: SANN_write_ann_xml(byte[], Snow.SnowXMLWriter) Method Variable
Variable Description dos Byte array buffer to hold annotation data SnowXMLWriter Contains XML data
Returns
262 Chapter 17 - Annotations for RasterMaster Java
Returns the status to writes out the content of SnowXMLWriter to a byte[] array. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
SANN_write_ann_xml_document(Snow.SnowXMLWriter)
This method writes out
Syntax
int SANN_write_ann_xml_document(Snow.SnowXMLWriter xmlwriter) throws IOException;
Remark
Table 17.49: SANN_write_ann_xml_document(Snow.SnowXMLWriter) Method Variable
Variable Description Contains
Returns
SnowXMLWriter containing wrapped
SANN_write_ann_xml_page(Snow.SnowXMLWriter)
This method writes out
Syntax
int SANN_write_ann_xml_page(Snow.SnowXMLWriter xmlwriter)throws IOException;
Remark
Table 17.50: SANN_write_ann_xml_page(Snow.SnowXMLWriter) Method Variable
Variable Description Can be empty or contain
263 Chapter 17 - Annotations for RasterMaster Java
Returns
SnowXMLWriter containing updated
This method deletes the currently selected annotation object. It is used by a built in annotation editing pop-up menu to fire the SANN_delete_objectmethod on the currently selected annotation object.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Syntax int ui_delete(java.awt.Container sf);
Remark
Table 17.51: ui_delete(java.awt.Container) Method Variables
Variable Description sf java.awt.Container for the currently displayed image
Returns
Returns the deleted annotation object. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. ui_exit(void)
This method deselects the currently selected annotation object. It is used by the pop-up menu to set the current graphic_id to -1.
Syntax int ui_exit();
Returns
Returns the deselected annotation object. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. ui_rotate_object(java.awt.Container)
264 Chapter 17 - Annotations for RasterMaster Java
This method rotates the currently selected annotation object. It is used by the built-in annotation editing pop-up menu to fire the SANN_rotate_object method on the currently selected annotation object..
Syntax
int ui_rotate_object(java.awt.Container sf);
Remark
Table 17.52: ui_rotate_object(java.awt.Container) Method Variables
Variable Description sf java.awt.Container for currently displayed image
Returns
Returns the status of the rotated annotation object. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
ui_startmove(java.awt.Container)
This method notifies the annotation library that the current annotation object is being moved.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Syntax
int ui_startmove(java.awt.Container sf);
Remark
Table 17.53: ui_startmove(java.awt.Container) Method Variables
Variable Description sf java.awt.Container for currently displayed image
Returns
Returns the status of the moved annotation object. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
ui_startresize(java.awt.Container)
This method notifies the annotation library that the current annotation object is being resized.
265 Chapter 17 - Annotations for RasterMaster Java
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the The Viewing and Annotations Sample sample.
Syntax int ui_startresize(java.awt.Container sf);
Remark
Table 17.54: ui_startresize(java.awt.Container) Method Variables
Variable Description sf java.awt.Container for currently displayed image
Returns
Returns the status of the resized annotation object. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. ui_wm_lbuttondown(java.awt.Container, int, int, byte[])
This method begins tracking mouse movements when the mouse button is pressed. Call this method during the mouse down or mouse pressed events.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Syntax int ui_wm_lbuttondown(Container sf, int xpos, int ypos, byte[] textbuff);
Remark
Table 17.55: ui_wm_lbuttondown(java.awt.Container, int, int, byte[]) Method Variables
Variable Description sf java.awt.Container for currently displayed image. xpos Position of mouse cursor on X-axis. ypos Position of mouse cursor on Y-axis. textbuff Used internally. Set to null.
Returns
266 Chapter 17 - Annotations for RasterMaster Java
Returns the status of the tracked mouse movements. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
ui_wm_lbuttonup(java.awt.Container, int, int, byte[])
This method notifies the annotation library that the mouse button has been released. Call this method during the mouse release or mouse up event.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Syntax
int ui_wm_lbuttonup(java.awt.Container sf, int xpos, int ypos, byte [] textbuff);
Remark
Table 17.56: ui_wm_lbuttonup(java.awt.Container, int, int, byte[]) Method Variables
Variable Description sf java.awt.Container for currently displayed image. xpos Position of mouse cursor on X-axis. ypos Position of mouse cursor on Y-axis. textbuff Used internally. Set to null.
Returns
Returns the status of the released mouse movements. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
ui_wm_mousemove(java.awt.Container, int, int, byte)
This method notifies the library of the current mouse coordinates. Call this method during mouse move events.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Viewing and Annotations Sample sample.
Syntax
int ui_wm_mousemove(java.awt.Container sf, int xpos, int ypos, byte [] textbuff);
Remark
267 Chapter 17 - Annotations for RasterMaster Java
Table 17.57: ui_wm_lbuttonup(java.awt.Container, int, int, byte[]) Method Variables
Variable Description sf java.awt.Container for currently displayed image. xpos Position of mouse cursor on X-axis. ypos Position of mouse cursor on Y-axis. textbuff Used internally. Set to null.
Returns
Returns the status of the current mouse coordinates. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. xml_boolean(byte)
This method converts a boolean string to boolean value.
Syntax int xml_boolean(byte[] pString);
Remark
Table 17.58: xml_boolean(byte[]) Method Variables
Variable Description pString String to convert
Returns
Returns the status of the boolean value. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. xml_color(byte, short[], short[], short[])
This method converts color integer into r,g,b.
Syntax int xml_color(byte[] pString, short[] r, short[] g, short[] b);
Remark
Table 17.59: xml_color(byte[], short[], short[], short[]) Method Variables
268 Chapter 17 - Annotations for RasterMaster Java
Variable Description pString Integer value as ascii string r Red color component g Green color component b Blue color component
Returns
Returns the status of the color integer. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
xml_convert(ANN_GRAPHIC_STRUCT,byte[], byte[], int, int, int, int, int)
This method converts an XML FileNet annotation file to a Snowbound annotation file.
Syntax
int xml_convert(ANN_GRAPHIC_STRUCT pFcs, byte[] pKeyword, byte[] pValue, int page, int[] xmax, int[] ymax, int[] nPoints, int[] bDone);
Remark
Table 17.60: XML_convert(ANN_GRAPHIC_STRUCT,byte[], byte[], int, int, int, int, int) Method Variables
Variable Description pFcs Annotation object list pKeyword XML keyword pValue Value page page number xmax Maximum x value ymax Maximum y value nPoints Number of points bDone
Returns
Returns the status of the annotation file. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
xml_find_page(SnbdFileio fd, int page)
This method finds the desired XML annotation page.
Syntax
269 Chapter 17 - Annotations for RasterMaster Java int xml_find_page(SnbdFileio fd, int page);
Remark
Table 17.61: xml_find_page(SnbdFileio, int) Method Variables
Variable Description fd Snowbound file descriptor page The desired page
Returns
Returns the desired page. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. xml_inches_pixels(double)
This method converts converts inches to pixels.
Syntax int xml_inches_pixels(double dVal);
Remark
Table 17.62: xml_inches_pixels(double) Method Variables
Variable Description dVal Value to convert
Returns
Returns the converted value in pixels. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. xml_read(SnbdFileio fd, int page)
This method reads from the XML file into a buffer.
Syntax int xml_read(SnbdFileio fd, byte[] pBuffer, int[] nPos, int[] nBytesToRead);
Remark
Table 17.63: xml_read(SnbdFileio, byte[]. int, int) Method Variables
Variable Description fd Snowbound file descriptor
270 Chapter 17 - Annotations for RasterMaster Java
Variable Description pBuffer Buffer to hold data read in nPos Current buffer position nBytesToRead Size of buffer
Returns
Returns the size of the buffer. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Overview of Built-In Annotation Editing
There are different user interface methodalities available when using built-in annotations. They are:
l Adding objects
l Editing the text in edit and Post-it objects
l Moving objects
l Resizing objects
l Deleting objects
See the sample DemoApp.java (Samples\com\snowbound\samples\annapp) for code which demonstrates how to add built-in annotation event handling to your application.
Notes: Edit and Post-it objects must be deactivated to avoid moving and deleting. See SANN_ activate_object(java.awt.Container, int) and SANN_deactivate_object(int) for more information. The built-in annotation editing uses the JDK 1.0 event handling model. The SANN ui methods (SnowAnn.ui_*()) notify the library of user interface events. Use these methods to turn on the built-in editing. See ui_delete (java.awt.Container) through ui_wm_mousemove(java.awt.Container, int, int, byte) for more information.
Using Built-In Annotation Editing
This section describes how to add, edit, move, resize, and delete annotation objects.
Adding New Objects
271 Chapter 17 - Annotations for RasterMaster Java
To add a new object, set the graphic_id parameter to one of the object numbers defined in Snow.SnowAnn .
Table 17.64: Snow.SnowAnn Annotation Object Values
Type Object Value public static final int SANN_FILLED_RECT = 1 public static final int SANN_HIGHLIGHT_RECT = 2 public static final int SANN_RECTANGLE = 3 public static final int SANN_LINE = 4 public static final int SANN_ELLIPSE = 5 public static final int SANN_FILLED_ELLIPSE = 6 public static final int SANN_FREEHAND = 7 public static final int SANN_BITMAP = 8 public static final int SANN_POSTIT = 9 public static final int SANN_POLYGON = 10 public static final int SANN_FILLED_POLYGON = 11 public static final int SANN_ARROW = 12 public static final int SANN_EDIT = 13 public static final int SANN_BUBBLE = 15
Creating Annotation Text and Objects
Table 17.65: Text and Post-it Objects
Object Action or Result Drag the mouse to draw a rectangle to the desired size. Edit and Post-it When the mouse is released, an editable text box appears. Most rectangles Drag the mouse to draw a rectangle to the desired size. Mouse click at the vertices of each point for the polygon. A Polygons small box is drawn at the first point. The polygon is finished when the last point is on this box.
Moving Objects
To move an annotation object:
1. Left-click on the object to display a pop-up window.
2. Select move. A box is drawn around the object allowing you to position it elsewhere on the screen.
3. Left-click again to position the object where you want it.
Resizing Objects
To resize an annotation object:
272 Chapter 17 - Annotations for RasterMaster Java
1. Left-click on the object to display a pop-up window.
2. Select resize. The object is highlighted and boxes on the corners and middle of the top, bottom, left, and right edges are drawn.
3. Click and drag any of the boxes to resize the object.
Deleting Objects
To delete an annotation object:
1. Left-click on the object to display a pop-up window.
2. Select delete. The object is removed from the page and from the internal list of objects.
Using Double Byte Characters with RasterMaster Java Annotations
Double byte characters such as Asian character sets are supported in the RasterMaster Java annotation library. To use double byte annotations, set the double_byte field to true as in the following example: sann = new SnowAnn();sann.double_byte = true;
When creating any type of text annotation object, space will be reserved to allow for double byte characters. Double byte characters can be typed in the active text controls.
When saving out to an annotation file, the double byte characters will be preserved. For the XML annotation file format, a tag for double byte characters will also be written to the file. When reading in this file, the double_byte field will be read from the file and updated. If you are saving and reading the binary RasterMaster Java annotation file format, you will have to set the double_byte field to true to allow the library to read and save the file properly.
If you are having trouble using double byte characters, please see the following Troubleshooting.
Methods Used for Viewing and Annotations
The Viewing and Annotations Sample is an image viewer that demonstrates the following image manipulations: altering the viewable size, changing the orientation, changing the size and resolution, making corrections, and flipping through pages of a multi-page file. You can find the samples in the following directory: [RM Java install dir] \Samples\com\snowbound\samples.
273 Chapter 17 - Annotations for RasterMaster Java
This sample also demonstrates several annotation methods, such as adding edits, bitmaps, lines, sticky notes, and more through a variety of methods. These annotations can be in both text and graphic format.
For more information on the methods used in The Viewing and Annotations Sample, click on one of the links below:
l IMG_decompress_bitmap(String, int)
l IMG_deskew_bitmap(int)
l IMG_despeckle_bitmap(int)
l IMG_display_bitmap(java.awt.Graphics, int, int, int, int)
l IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int)
l IMG_erase_rect(int, int, int, int, int, int, int)
l IMG_flip_bitmapx(void)
l IMG_flip_bitmapy(void)
l IMG_get_deskew_angle(int[], int, int)
l IMG_invert_bitmap(void)
l IIMG_merge_block(Snow.Snowbnd, int, int, int)
l IMG_print_applet_pages(java.awt.Container, int)
l IMG_resize_bitmap(int, int)
l IMG_rotate_bitmap(int)
l IMG_save_bitmap(String, int)
l IMG_scroll_bitmap(java.awt.Container, java.awt.Event)
l IMG_window_level(int, int, int)
l SANN_read_ann(DataInputStream, int)
l SANN_set_croprect(int, int, int, int)
l SANN_display_annotations(java.awt.Graphics, java.awt.Container, int, int, int, int)
274 Chapter 17 - Annotations for RasterMaster Java
l GetClientRect(java.awt.Container, Snow.SANN_RECT)
l SANN_highlight_object(java.awt.Container, Snow.SANN_RECT, int)
l ui_delete(java.awt.Container)
l ui_startmove(java.awt.Container)
l ui_startresize(java.awt.Container)
l ui_wm_lbuttondown(java.awt.Container, int, int, byte[])
l ui_wm_mousemove(java.awt.Container, int, int, byte)
l ui_wm_lbuttonup(java.awt.Container, int, int, byte[])
l SANN_write_ann(byte[], int, byte[])
l SANN_activate_all_objects(void)
l SANN_deactivate_all_objects(void)
l SnowAnn Sann = new SnowAnn(int, int);
l Snowbnd()
275 Chapter 18 - Scanning
Chapter 18 - Scanning
This chapter describes how to do scanning in RasterMaster Java. The Scanning Sample gives a quick demonstration of how to use the scanning methods. You can find the samples in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. For more information, please see RasterMaster Java Samples on how to find and run The Viewing and Annotations Sample.
Using the Java Scanning Interface
The Java scanning interface is used in conjunction with Snowbound’s RasterMaster Imaging SDK DLL. The file used is called scandll.dll. This file is the interface between the DLL and Snowbound’s RasterMaster Java.
Installing the scandll.dll
The easiest way to put this in your path is to place the file in your \Windows\System32 directory. The RasterMaster native DLL should also be in your path.
Using the scanInterface.class for JNI Declarations
When writing a Java application that uses the scanning DLL, you must always use the scanInterface class. This makes the scanning calls to the native product. Since this has the JNI declarations of the scanning calls, these calls mirror the calls in the native library.
Methods Used for Scanning
The Scanning Sample demonstrates how to use scanning. You can find the samples in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. For more information on the methods used in The Scanning Sample, click on one of the links below:
IMG_scan_acquire()
IMG_scan_acquire_feeder()
IMG_scan_feeder_close()
IMG_scan_open_source()
IMG_scan_get_source_list()
IMG_scan_pages()
IMG_scan_get_cap()
IMG_scan_set_cap()
IMG_scan_set_caps()
276 Chapter 18 - Scanning
IMG_scan_setup()
IMG_get_scanned_image_bytes(int)
IMG_get_scanned_image(int)
IMG_scan_acquire()
IMG_scan_acquire()
This method is a TWAIN scanning routine. It scans an image on the current installed scanner or input device and returns the standard library image handle. IMG_scan_open_source() must be called first.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Scanning Sample.
Note: If you are calling IMG_scan_acquire() without the scanning UI on, the SCAN_ CAPS structure will override any individual CAPS you have set. Therefore, you should always be sure to use IMG_scan_set_caps() if you are not using the scanner UI, and want to set any of the following CAPS: bits per pixel, left margin, top margin, right margin, bottom margin, horizontal resolution, or vertical resolution.
Syntax
int IMG_scan_acquire(int showui);
Remarks
Table 18.1: IMG_scan_acquire Method Variables
Variable Description 0 = Do not display TWAIN dialog box. showui 1 = Display TWAIN input dialog box.
Returns
The standard library image handle. Any positive value (as well as 0) is a valid return.
IMG_scan_acquire_feeder()
This method is a TWAIN scanning method that allows scanning from a scanner with an automatic document feeder. Call this method in a loop until the NO_MORE_PAGES error is returned. Then close the scanner with the IMG_scan_feeder_close() call.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Scanning Sample.
277 Chapter 18 - Scanning
Syntax int IMG_scan_acquire_feeder(int showui);
Remarks
Table 18.2: IMG_scan_acquire_feeder Method Variables
Variable Description 0 = Do not display TWAIN dialog box. showui 1 = Display TWAIN input dialog box.
Returns
The standard library image handle. Any positive value (as well as 0) is a valid return.
IMG_scan_feeder_close()
This method is a TWAIN method used to close the scanner after calls to IMG_scan_ acquire_feeder(). Use this after receiving the NO_MORE_PAGES return from IMG_ scan_acquire_feeder().
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Scanning Sample.
Syntax int IMG_scan_feeder_close(void);
Returns
The standard library image handle. Any positive value (as well as 0) is a valid return.
IMG_scan_open_source()
This method is a TWAIN scanning method that allows setting the desired scan or input device. Displays a dialog box to select available input devices.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Scanning Sample.
Syntax int IMG_scan_open_source(void);
Returns
The standard library image handle. Any positive value (as well as 0) is a valid return.
IMG_scan_get_source_list()
278 Chapter 18 - Scanning
This method calls the native SDK method from ScanInterface to get a list of scanners.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Scanning Sample.
Syntax
String[] IMG_get_source_list();
Returns
List of available scanning sources.
IMG_scan_pages()
This is a TWAIN scanning routine. It scans all pages from the currently selected scanner or input device and saves to the path\filename specified by filename in the image format file type.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Scanning Sample.
Notes: For multi-page file types such as TIF, DCX, or MO:DCA/IOCA, you must specify a valid filename. All pages will be stored in a single multi-page file. For other file types, the filename can only contain a path.
The images created are 00000000.img and 00000001.img for each page. Normally the showui will be turned off for multipage scanning.
Syntax
int IMG_scan_pages(String filename, int filetype, int show_ui);
Remarks
Table 18.3: IMG_scan_pages Method Variables
Variable Description filename Output file name to create as scanned image. File type from imglib.h for format to save compressed filetype images to. 0 = Do not display TWAIN dialog box. showui 1 = Display TWAIN input dialog box.
Returns
The standard library image handle. Any positive value (as well as 0) is a valid return.
IMG_scan_get_cap()
279 Chapter 18 - Scanning
This method returns the current setting of the specified TWAIN capability.
IMG_scan_get_cap() maps directly to the #defines from the TWAIN specification. Use the following example to get the orientation: int orient = IMG_scan_get_cap(hwnd,ICAP_ORIENTATION);
TWAIN scans the whole image and returns a bitmap contain the image based on the current scanning size of height, width, and DPI.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Scanning Sample.
Syntax int IMG_scan_get_cap(int cap);
Remarks
Table 18.4: IMG_scan_get_cap Method Variables
Variable Description cap Current TWAIN 1.7 capability to get.
Returns
The current setting of the specified TWAIN capability. Any positive value (as well as 0) is a valid return.
IMG_scan_set_cap()
This method sets the value of the specified TWAIN capability.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Scanning Sample.
Syntax int IMG_scan_set_cap(int cap, int value);
Remarks
Table 18.5: IMG_scan_set_cap Method Variables
Variable Description cap Current TWAIN 1.7 capability to set. value New setting for TWAIN capability.
Returns
280 Chapter 18 - Scanning
The current setting of the specified TWAIN capability. Any positive value (as well as 0) is a valid return.
IMG_scan_set_caps()
This method sets scanning parameters such as height, width, and bits per pixel for the current scanner.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Scanning Sample.
Syntax
int IMG_scan_set_caps(int bitspix, double left, double top, double right, double bottom, int hres, int vres);
Remarks
Table 18.6: IMG_scan_set_caps Method Variables
Variable Description bitspix Bits per pixel left Left margin top Top margin right Right margin bottom Bottom margin hres Horizontal resolution vres Vertical resolution
Returns
The current setting of the specified TWAIN capability. Any positive value (as well as 0) is a valid return.
IMG_scan_setup()
This method is a 1.7 TWAIN method that allows the caller to bring up the TWAIN driver’s user interface to set scanning parameters. After called the parameters will be saved.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Scanning Sample.
Note: No scanning will occur unless one of the other scan acquiring methods are called.
Syntax
int IMG_scan_setup(void);
281 Chapter 18 - Scanning
Returns
The current setting of the specified TWAIN capability. Any positive value (as well as 0) is a valid return.
IMG_get_scanned_image_bytes(int)
This method returns the image data for a given handle. Should be called after IMG_scan_ acquire to get the data back into the java application. See in The Scanning Sample for demonstrated use of this method.
Syntax byte[] IMG_get_scanned_image_bytes(int imghandle);
Remarks
Table 18.7: IMG_get_scanned_image_bytes Method Variables
Method Description imghandle Image data as a byte array.
Returns
Image data as a byte array.
IMG_get_scanned_image(int)
This method returns the image data for a given handle. Should be called after IMG_scan_ acquire to get the data back into the java application. See in The Scanning Sample for demonstrated use of this method.
Syntax
DataInputStream IMG_get_scanned_image_bytes(int imghandle);
Remarks
Table 18.8: IMG_get_scanned_image_bytes Method Variables
Method Description imghandle Image handle for which to return data
Returns
Image data as a byte array
Java Scanning Sample
282 Chapter 18 - Scanning
This sample demonstrates how to use the Snowbound Java Image Library to accomplish the basic scanning tasks listed below:
l Acquire an Image
l Change TWAIN Source
l Acquire from a Feeder
l Acquire from a Feeder Full-Duplex
l Enable/Disable TWAIN UI
l Enable/Disable Duplex Scanning
l Scan Pages from Feeder directly to File
l Get Scan Cap
Listed below are the methods and methods used in this sample:
IMG_get_scanned_image_bytes(int)
IMG_scan_feeder_close()
IMG_scan_acquire_feeder()
IMG_scan_open_source()
IMG_scan_get_source_list()
IMG_scan_acquire()
IMG_scan_pages()
IMG_scan_get_cap()
Running the Sample
You can run this sample from the classes directory: java -classpath .;
283 Chapter 19 - Class Snow.Snowbnd Methods
Chapter 19 - Class Snow.Snowbnd Methods
This chapter describes the available methods for the Snow.Snowbnd class. display_angle(int)
This method rotates the image at display time. The data itself is not changed, but the image is painted at the requested angle. This method is extremely fast, and is the recommended method for rotating when it is unnecessary to permanently change the image data.
See IMG_rotate_bitmap(int) for more information.
Syntax void display_angle(int angle);
Remark
Table 19.1: display_angle(int) Method Settings
Setting Description The display angle. Valid values are 0, 90, 180, and 270 angle degrees.
Example 19.1: display_angleSample
if (myPanel.Simage != null) { myPanel.Simage.display_angle(0); myPanel.repaint(); } finalize(void)
This method is a recommended call when a Snowbnd object is no longer needed.
Notes: If scrollbars are used, failure to call this method may result in a resource leak. Calling this method before the system has completed all requested operations may
284 Chapter 19 - Class Snow.Snowbnd Methods
result in NullPointerExceptions or ArrayIndexOutOfBoundsExceptions. It is important to be particularly vigilant when calling this method in multithreaded environments.
Syntax
void finalize();
fit_to_height(int)
This method turns on an internal flag that forces the IMG_display_bitmap_aspectmethod to display by fitting the width of the image to the height of the Container, minus the height of the scroll bars, if any.
See IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) for more information.
See IMG_erase_rect(int, int, int, int, int, int, int) for more information.
Syntax
void fit_to_height(int flag);
Remark
Table 19.2: fit_to_height(int) Method Variables
Variable Description 0 = Method is off flag 1 = Method is on
Example 19.2: fit_to_heightSample
myPanel1.zoom = 0; myPanel1.Simage.fit_to_height(1); myPanel1.repaint();
fit_to_width(int)
This method turns on an internal flag that forces the IMG_display_bitmap_aspect method to display by fitting the width of the image to the width of the Container, minus the width of the scroll bars, if any.
See IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int)for more information.
285 Chapter 19 - Class Snow.Snowbnd Methods
See IMG_erase_rect(int, int, int, int, int, int, int) for more information.
Syntax void fit_to_width(int flag);
Remark
Table 19.3: fit_to_width(int) Method Settings
Setting Description 0 Method is off 1 Method is on
Example 19.3: fit_to_widthSample
myPanel1.zoom = 0; myPanel1.Simage.fit_to_width(1); myPanel1.repaint();
getBitsPerPixel(void)
This method returns the bit depth of the image. See Appendix A, Supported File Formats for more information on the number of bits per pixel of your image.
Syntax int getBitsPerPixel();
Returns
Returns the bit depth of the image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. get_fit_to_height()
This method returns the value set by fit_to_height(int).
Syntax int get_fit_to_height();
Returns
286 Chapter 19 - Class Snow.Snowbnd Methods
Returns the value set by fit_to_height(int). A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
get_fit_to_width()
This method returns the value set by fit_to_width(int).
Syntax
int get_fit_to_width();
Returns
Returns the value set by fit_to_width(int). A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
getHeight(void)
This method returns the height of the image in pixels.
Syntax
int getHeight();
Returns
Returns the height of the image in pixels. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
getInitialZoom(int, int)
This method calculates the first zoom increment given the image’s height and width. Sometimes images are smaller than the containers in which they display. In that case, the image fits into the container either by height or width. The zoom increment is simply the ratio of screen pixels to image pixels.
For example, if this method returns 35, two zoom operations with a normal zoom increment of 25 are required before the image is noticeably zoomed.
Notes: For the first zoom operation on an image, assuming the scrollbars are off, always zoom
287 Chapter 19 - Class Snow.Snowbnd Methods
the image by at least the amount returned from this method. The getInitialZoom(int, int) method is based on the width and height of the panel. Scrolling will not work unless the image fills the entire panel.
Syntax int getInitialZoom(int xsize, int ysize);
Remark
Table 19.4: getInitialZoom(int, int) Method Variables
Variable Description xsize Panel width in pixels ysize Panel height in pixels getWidth(void)
This method returns the width of the image in pixels.
Syntax int getWidth();
Returns
Returns the width of the image in pixels. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. getXdpi(void)
This method returns the X resolution, in DPI (dots per inch), of the image.
Syntax int getXdpi();
Returns
Returns the X resolution, in DPI (dots per inch), of the image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. getYdpi(void)
288 Chapter 19 - Class Snow.Snowbnd Methods
This method returns the Y resolution, in DPI(dots per inch), of the image.
Syntax
int getYdpi();
Returns
Returns the Y resolution, in dpi (dots per inch), of the image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_antique_effect(void)
This method converts color images to look as though they are antique photos. It replaces colors with sepia tones, which are reddish brown monochrome tints. When applied to a photo, they give the picture a warm, antique feeling.
Note: This method only works with 24-bit color images.
Syntax
int IMG_antique_effect();
IMG_auto_crop_bitmap(int, int)
This method finds and clips any white border around the image in all directions. The border is discarded and the image is resized to the new cropped rectangle plus the margin.
The margin may be a value of 0.
Note: This method only works with 1-bit images. If you use this method with an image that is not a 1-bit image, you will get a PIXEL_DEPTH_UNSUPPORTED (-21) error message. See Appendix D, Snowbound Error Codes for a list of error codes.
Syntax
int IMG_auto_crop_bitmap(int hdib, int margin);
Remark
Table 19.5: IMG_auto_crop_bitmap(int, int) Method Variables
289 Chapter 19 - Class Snow.Snowbnd Methods
Variable Description hdib Standard RasterMaster® SDK image handle margin Number of pixels to add to the autocrop rectangle
Returns
Returns the standard RasterMaster® SDK image handle. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_auto_orient(Snow.Snowbnd, int)
This method returns the orientation of the image. The value is 90 or 0. If the value is 90, you may want to fix the image by using IMG_rotate_bitmap() as follows: IMG_auto_orient(imghandle,angle) if (angle == 90) IMG_rotate_bitmap(imghandle,andle[0] * 100);
See IMG_rotate_bitmap(int) for more information.
Syntax int IMG_auto_orient(Snowbnd hdib, int *p_angle);
Remark
Table 19.6: IMG_auto_orient(Snow.Snowbnd, int)Method Variables
Variable Description hdib Standard RasterMaster® SDK image object. Angle returned as the current orientation. Either 90 or 0 is p_angle returned.
Returns
Returns the orientation of the image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_create_thumbnail(int, int)
This method intelligently resizes down images. It supports any pixel depth and chooses IMG_ resize_bicubic for color images or IMG_resize_to_gray for 1-bit black and white images. This method is excellent for creating thumbnails.
1-bit images are converted to grayscale with our “scale to gray” algorithm. 8 and 24-bit images are resized with our bicubic interpolation algorithm.
290 Chapter 19 - Class Snow.Snowbnd Methods
If you experience diminished quality when resizing, try calling IMG_create_thumbnail to look at neighboring pixels when resizing for better quality.
JPEG is not the best compression to use for converting text. JPEG works for pictures and not images with hard black to white transitions. For display on a lower resolution screen and to see better results when zoomed, try resizing the image with IMG_create_thumbnail(), then convert to JPEG.
Use IMG_create_thumbnail to preserve aspect ratio when converting to a thumbnail. This will create a gray scale aliased bitmap that must be saved with TIFF_LZW or TIFF_JPEG.
Syntax
int IMG_create_thumbnail(int xsize, int ysize);
Remark
Table 19.7: IMG_create_thumbnail(int, int) Method Variables
Variable Description xsize Destination width of image after resizing ysize Destination height of image after resizing
IMG_decompress_bitmap(String, int)
This method decompresses an image from the local disk. This standard method can be used by applications, signed applets, or applets for which disk read permissions have been granted. As with all decompression methods, it automatically detects the file format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l Simple Conversion: The SimpleConvert Sample
l Simple Conversion with Timeouts: The HangDetector Sample
l Saving to Searchable PDF: The saveSearchablePDF Sample
l The SilentPrint Sample
l The Swing Sample
l The Thumbnails Sample
l Working with Vector PDF vs. Raster PDF: The VectorPDF Sample
291 Chapter 19 - Class Snow.Snowbnd Methods
Syntax int IMG_decompress_bitmap(String st, int page);
Remark
Table 19.8: IMG_decompress_bitmap(String, int) Method Variables
Variable Description st Path and filename of the image to decompress page Page number for the multipage image file
Returns
Returns the status of the decompressed image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.4: IMG_decompress_bitmap Sample
FileDialog fd = new FileDialog(this,"Open " + "Bitmap",FileDialog.LOAD); fd.show(); FileName = fd.getDirectory() + fd.getFile(); if (FileName != null { tSimage = new Snow.Snowbnd(); tSimage.IMG_decompress_bitmap(FileName,0); }
OpenFileDialog fd = new OpenFileDialog(); DialogResult dr = fd.showDialog; if (dr == System.Windows.Forms.DialogResult.OK) { tSimage = new Snow.Snowbnd(); tSimage.IMG_decompress_bitmap(fd.FileName,0); }
IMG_decompress_bitmap(java.io.DataInputStream, int)
This method decompresses data from a DataInputStream and automatically detects the file format. It only decompresses an image from a DataInputStream and created from a
292 Chapter 19 - Class Snow.Snowbnd Methods
ByteArray. Then, you can call decompress on a ByteArray or create a DataInputStream from this ByteArray.
Note: You cannot read from an InputStream because it does not allow random access to the data. You must use either a string or a DataInputStream that was created from a ByteArray.
Syntax
int IMG_decompress_bitmap(java.io.DataInputStream di, int page);
Remark
Table 19.9: IMG_decompress_bitmap(java.io.DataInputStream, int) Method Variables
Variable Description di Java.io.DataInputStream page Page number if reading from multipage image file
Returns
Returns the status of the DataInputStream. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.5: IMG_decompress_bitmapSample
java.io.RandomAccessFile ras; int length;byte buff[]; try { ras = new java.io.RandomAccessFile (st,"r"); length = (int)ras.length(); buff = new byte[length]; ras.readFully(buff,0,length); } catch (IOException ioe) { return -2; } java.io.DataInputStream di; di = new java.io.DataInputStream(new java.io.ByteArrayInputStream(buff) ) stat = tSimage.IMG_decompress_bitmap(di, page);
293 Chapter 19 - Class Snow.Snowbnd Methods
IMG_decompress_bitmap_fd(String, int, int)
This method works the same as IMG_decompress_bitmap but can be used for image formats that are embedded in a larger file and do not start at the beginning of a file.
Syntax int IMG_decompress_bitmap_fd(String bm_name, int offset, int page);
Remark
Table 19.10: IMG_decompress_bitmap_fd(String, int, int) Method Variables
Variable Description bm_name Filename of image to decompress. offset Offset of start of image format in bytes. Image or page number to decompress if multipage file page format. Set to 0 for first page.
Returns
Returns the filename of the image to decompress. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_decompress_bitmap_stream(String, int)
This method reads images from a standard URL. This method automatically detects the file format and is normally used by applets.
Syntax int IMG_decompress_bitmap_stream(String st, int page);
Remark
Table 19.11: IMG_decompress_bitmap_stream(String, int) Method Variables
Variable Description URL and filename of the image to decompress, for example, st http://www.snowbound.com/image.tif page Page number for multipage file
Returns
Returns the URL and filename of the image to decompress. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
294 Chapter 19 - Class Snow.Snowbnd Methods
IMG_decompress_bitmap_stream_onthefly (String, int, java.awt.Container)
This method decompresses and displays partially downloaded image data from a URL. The image begins to display even before all image data is downloaded.
This special method is used by applets. As with all decompression methods, it automatically detects the file format.
Notes: A display container is required for this method. This method should not be used when there are no Graphical User Interface classes.
Syntax
int IMG_decompress_bitmap_stream_onthefly(String st, int page, java.awt.Container sf);
Remark
Table 19.12: IMG_decompress_bitmap_stream_onthefly(String, int, java.awt.Container) Method Variables
Variable Description URL and file name of image to decompress, for example, st http://www.snowbound.com/image.tif page Page number for multipage files Container which can get the panel or frame where the Container sf application or applet resides
Returns
Returns the URL and filename of the image to decompress. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_decompress_fax(java.lang.String, int, int, int, int, int)
This method decompresses compressed fax data from proprietary image file formats which use the CCITT G3 or G4 compression algorithms. The path name is the absolute path to the file.
295 Chapter 19 - Class Snow.Snowbnd Methods
The developer is responsible for reading any header information such as height, width, fill order, or compression. Call this method to decompress the data and convert it into a Snow.DIB in memory.
Syntax int IMG_decompress_fax(String bm_name, int xsize, int ysize, int type, int fill_order, int offset);
Remark
Table 19.13: IMG_decompress_fax(java.lang.String, int, int, int, int, int) Method Variables
Variable Description Absolute path and file name to the file on the local file bm_name system xsize Width, in pixels, of the image after decompression ysize Height, in pixels, of the image after decompression 2 = Group 3 2d image type 3 = Group 3 4 = Group 4 fax Bit order in each byte. Normal values: fill_order 0 = CALS, Intel byte order (MSB -> LSB) 2 = G3 and G4, Motorola byte order (LSB -> MSB) offset Absolute position of the first byte of compressed data
Returns
Returns the absolute path and filename to the file on the local file system. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int)
This method decompresses fax or proprietary image formats which use the CCITT G3 or G4 compression algorithms.
The developer is responsible for reading any header information such as height, width, fill order, or compression. Call this method to decompress the data and convert it into a Snow.DIB in memory.
Syntax int IMG_decompress_fax(java.io.DataInputStream di, int xsize, int ysize, int type, int fill_order, int offset);
296 Chapter 19 - Class Snow.Snowbnd Methods
Remark
Table 19.14: IMG_decompress_fax(java.io.DataInputStream, int, int, int, int, int) Method Variables
Variable Description di DataInputStream containing compressed file data xsize Width, in pixels, of the image after decompression ysize Height, in pixels, of the image after decompression 2 = Group 3 2d image type 3 = Group 3 4 = Group 4 fax Bit order in each byte. Normal values: fill_order 0 = CALS, Intel byte order (MSB -> LSB) 2 = G3 and G4, Motorola byte order (LSB -> MSB) offset Absolute position of the first byte of compressed data
Returns
Returns the status of the DataInputStream. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_decompress_multipage_bitmap_stream_onthefly (String, int, java.awt.Container)
This method decompresses and displays partially downloaded image data from a URL. The image begins to display even before all image data is downloaded. After the first page is decompressed and downloaded, the other pages of a multi-page file are downloaded in the background. This allows subsequent pages to be available faster.
This special method is used by applets. As with all decompression methods, it automatically detects the file format.
Notes: A display container is required for this method. This method should not be used when there are no Graphical User Interface classes.
Syntax
int IMG_decompress_multipage_bitmap_stream_onthefly(String st, int page, java.awt.Container sf);
Remark
297 Chapter 19 - Class Snow.Snowbnd Methods
Table 19.15: IMG_decompress_multipage_bitmap_stream_onthefly(String, int, java.awt.Container) Method Variables
Variable Description URL and filename of image to decompress, for example, st http://www.snowbound.com/image.tif page Page number for multipage files Container which can get the panel or frame where the application Container sf or applet resides
Returns
Returns the URL and filename of the image to decompress. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_deskew_bitmap(int)
This method is a fast rotate for 1-bit skewed images. Use this method after IMG_get_ deskew_angle returns a skew angle. This method rotates only from -45 to 45 degrees, but is much faster thanIMG_rotate_bitmap for 1-bit images. For best results, use values of -20 to 20.
See IMG_get_bitmap_block(int, int, int, int) and IMG_rotate_bitmap(int) for more information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples.This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Note: When a call is made toIMG_deskew_bitmap, the internal Snowbound image object is stored in memory for viewing. The method needs to be saved to the library for the change to be permanent.
Syntax int IMG_deskew_bitmap(int rot_angle);
Remark
Table 19.16: IMG_deskew_bitmap(int) Method Variables
Variable Description rot_angle Angle to rotate image
298 Chapter 19 - Class Snow.Snowbnd Methods
Returns
Returns the angle to rotate the image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_despeckle_bitmap(int)
This method removes noise (random pixel data) from 1-bit images. This method works only with 1-bit images. The quality variable can accept a range of 100 values. A similar method is also available called IMG_despeckel_bitmap.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Note: When a call is made to IMG_despeckel_bitmap, the internal Snowbound image object is stored in memory for viewing. The method needs to be saved to the library for the change to be permanent.
Syntax
int IMG_despeckel_bitmap(int quality);
Remark
Table 19.17: IMG_despeckel_bitmap(int) Method Settings
Setting Description 1 Minimum noise reduction 30 Normal noise reduction 100 Maximum noise reduction
Returns
Returns the status of the noise reduction. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_display_bitmap(java.awt.Graphics, int, int, int, int)
299 Chapter 19 - Class Snow.Snowbnd Methods
This method displays the current image at the current X and Y coordinates, and is not corrected for aspect ratio. To use RasterMaster® SDK’s automatic aspect ratio correction during display, use IMG_display_bitmap_aspect.
See IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) for more information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
l The Thumbnails Sample
Syntax int IMG_display_bitmap(Graphics g, int xpos, int ypos, int xsize, int ysize);
Remark
Table 19.18: IMG_display_bitmap(java.awt.Graphics, int, int, int, int) Method Variables
Variable Description g Graphics context xpos Starting X position for drawing the image ypos Starting Y position for drawing the image xsize Horizontal size of displayed image ysize Vertical size of displayed image
Returns
Returns the status of the X and Y coordinates. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int)
This method displays the current image, corrected for aspect ratio, at the current X and Y coordinates. It also displays scroll bars if the image is zoomed (zoom != 0 and zoom > Snowbnd.getInitialZoom()).
300 Chapter 19 - Class Snow.Snowbnd Methods
RasterMaster Java automatically detects whether or not Swing is present, and uses the correct scroll bar for AWT or Swing.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l Simple Conversion: The SimpleConvert Sample
l The Swing Sample
Syntax
int IMG_display_bitmap_aspect(Graphics g, Container f, int xpos, int ypos, int xsize, int ysize, int zoom);
Remark
Table 19.19: IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) Method Variables
Variable Description g Graphics context f Current java.awt.Container for image xs Starting X position for drawing the image ys Starting Y position for drawing the image xsize Horizontal size of displayed image ysize Vertical size of displayed image Zoom factor zoom 0 = Display entire image 100 = One-to-one pixel display (one pixel per screen)
Returns
Returns the status of the X and Y coordinates. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.6: IMG_display_bitmap_aspectSample
public void paint (Graphics g) { if (Simage != null) { in = getInsets(); /* NOTE THAT Microsoft JVIEW.EXE has a bug and does not start the origin at 0,0 under the title bar. Comment this next line
301 Chapter 19 - Class Snow.Snowbnd Methods
to fix Jview.exe. All other Java Machines work fine.*/ g.translate(in.left, in.top); d = getSize(); d.width = (in.right + in.left); d.height = (in.top + in.bottom); if (cropped == 0) stat = Simage.IMG_display_bitmap_aspect(g, this, 0,0,d.width,d.height, zoom); else Simage.IMG_display_bitmap(g,0,0,d.width,d.height); if (select) snbd_draw_pen(); } }
IMG_display_bitmap_smooth(java.awt.Graphics, java.awt.Container, int, int, int, int, int)
This method displays the current image, corrected for aspect ratio, at the current X and Y coordinates. The zoom value is a percentage of the image display to the container size. A value of zero will fill the current container with a best fit, either fit to width or fit to height. For example, a value of 10 will zoom the image 10% larger than the container size. This will crop the image slightly. A negative value will shrink the image by the percentage and center in the container.
Syntax int IMG_display_bitmap_smooth(Graphics hdc, Container sf, int xs, int ys, int xsize, int ysize, int zoom);
Remark
Table 19.20: IMG_display_bitmap_smooth (java.awt.Graphics, java.awt.Container, int, int, int, int, int) Method Variables
Variable Description hdc Graphics port to draw into sf Container to draw into xs Starting X coordinate of container ys Starting Y coordinate of container xsize Xsize coordinate of container ysize Ysize coordinate of container zoom Zoom level
Returns
302 Chapter 19 - Class Snow.Snowbnd Methods
Returns the status of the X and Y coordinates. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.7: IMG_display_bitmap_smoothSample
public void paint (Graphics g) { if (Simage != null) { d = getSize(); in = getInsets(); d.width -= (in.right + in.left); d.height -= (in.top + in.bottom);
in = getInsets(); /* NOTE THAT Microsoft JVIEW.EXE has a bug and does not start the origin at 0,0 under the title bar. Comment this next line to fix Jview.exe. All other JVMs work fine.*/ g.translate(in.left, in.top); stat = Simage.IMG_display_bitmap_smooth(g, this, 0, 0, d.width, d.height,zoom); } } public void update(Graphics g) { // If the container is showing, be sure to repaint it, otherwise // repainting it is unnecessary and will cause update flashing if ((Simage == null) || (Simage.dis_crop_xe == Simage.dis_width) || (Simage.dis_crop_ye == Simage.dis_height)) { g.setColor(getBackground()); g.fillRect(0, 0, d.width, d.height); g.setColor(getForeground()); }
paint(g); }
IMG_erase_rect(int, int, int, int, int, int, int)
This method fills the inside or outside of the specified rectangle (xs, ys, xsize, and ysize parameters) with the color passed in. It can be used to remove borders, for instance.
303 Chapter 19 - Class Snow.Snowbnd Methods
For 24-bit images, the color value must be a RGB-packed pixel; 1 byte red, 1 byte green, and 1 byte blue. For 1-bit black and white images, only the least significant bit is used.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax int IMG_erase_rect(int xs, int ys, int xsize, int ysize, int color, int in_outflag, int operation);
Remark
Table 19.21: IMG_erase_rect(int, int, int, int, int, int, int) Method Variables
Variable Description xs Start X coordinate of rectangle in pixels ys Start Y coordinate of rectangle in pixels xsize Width of rectangle in pixels ysize Height of rectangle in pixels color Color to fill 1 = fill inside rectangle in_outflag 0 = fill outside rectangle to the borders of the image 1 = xor image rectangle operation 0 = fill image
Example 19.8: IMG_erase_rectSample
if (ssb.Simage != null) { int width = ssb.Simage.getWidth(); int height = ssb.Simage.getHeight();
ssb.Simage.IMG_erase_rect(width / 20, height / 20, width (width / 10), height (height / 10),0xffffff, 0, 0); } repaintRefresh();
IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int,
304 Chapter 19 - Class Snow.Snowbnd Methods
byte[])
This method allows filling an area of a bitmap with specified patterns found in the pattern argument.
Syntax
int IMG_fill_bitmap_pattern(int xs, int ys, int xsize, int ysize, int pattern_width, int pattern_height, int x_offset, int y_offset, int byte pattern[]);
Remark
Table 19.22: IMG_fill_bitmap_pattern(int, int, int, int, int, int, int, int, byte[]) Method Variables
Variable Description xs Start X position of image to fill ys Start Y position of image to fill xsize Width of pattern area to fill ysize Height of pattern area to fill pattern_width Width of data in pattern array pattern_height Height of data in pattern array pattern_xoffset X offset of data in pattern array pattern_yoffset Y offset of data in pattern array byte pattern [] Array of pattern data bytes
IMG_flip_bitmapx(void)
This method flips the image horizontally to produce a mirror image. Positive X coordinates along the X-axis are swapped with negative X coordinates, and vice versa.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax
int IMG_flip_bitmapx();
Returns
305 Chapter 19 - Class Snow.Snowbnd Methods
Returns the status of the X coordinate. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_flip_bitmapy(void)
This method flips the image vertically to produce a mirror image. Positive Y coordinates along the Y-axis are swapped with negative Y coordinates, and vice versa.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax int IMG_flip_bitmapy();
Returns
Returns the status of the Y coordinate. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_get_bitmap_block(int, int, int, int)
This method returns a block of data from the current image and creates a Snowbnd object, where the data is specified by the rectangle constructed from the image’s coordinates. The image can then be displayed, rotated, saved, and more.
Syntax
Snow.Snowbnd IMG_get_bitmap_block(int xs, int ys, int xsize, int ysize);
Remark
Table 19.23: Snow.Snowbnd IMG_get_bitmap_block(int, int, int, int) Method Variables
Variable Description xs Starting X position for the image block ys Starting Y position for the image block xsize Horizontal size of the image block in pixels ysize Vertical size of the image block in pixels
306 Chapter 19 - Class Snow.Snowbnd Methods
Returns
A new Snowbnd object
IMG_get_deskew_angle(int[], int, int)
This method returns the skew angle for 1-bit images. When scanning multiple pages, images are often slightly skewed or rotated. The values returned in the p_angle[] array should be passed to IMG_deskew_bitmap.
See IMG_deskew_bitmap(int) for more information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax
int IMG_get_deskew_angle(int p_angle[], int start_angle, int end_ angle);
Remark
Table 19.24: IMG_get_deskew_angle(int[], int, int) Method Variables
Variable Description Integer array to return the rotation or skew angle; this p_angle array can have a single element Minimum angle to start (no less than -45 degrees; -20 is start_angle optimum) Maximum angle to test for (no more than 45 degrees; 20 end_angle is optimum)
Returns
Returns the skew angle for 1-bit images. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.9: IMG_deskew_bitmapSample
if (Simage != null) stat = Simage.IMG_get_deskew_angle(pangle, -15, 15);
307 Chapter 19 - Class Snow.Snowbnd Methods
if (stat >= 0 && pangle[0] != 0) { Simage.IMG_deskew_bitmap(pangle[0]); repaintRefresh(); }
IMG_get_version(int[], int[])
This method returns the RasterMaster Javaversion id in the two integers that you provide. The first parameter is the major version number and the second is the minor version number. Together, these form the current version number for the RasterMaster® SDK base library. For example, 13 and 0 are version 13.0.
Syntax int IMG_get_version(int major[], int minor[]);
Remark
Table 19.25: IMG_get_ version(int[], int[]) Method Variables
Variable Description Major version number. For example, returns 13 in version major number 13.0. Minor version number. For example, returns 0 in version minor number 13.0.
Returns
Returns the RasterMaster Java version id. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.10: IMG_get_version Sample
int majorVersion[]={0}; int minorVersion[]={0}; s.IMG_get_version(majorVersion, minorVersion); System.out.println("RasterMaster Java version: " + majorVersion[0] + "." + minorVersion[0]);
IMG_histogram_equalize()
308 Chapter 19 - Class Snow.Snowbnd Methods
This method is a histogram equalization which improves the dynamic range of 8-bit gray scale images by remapping pixels based on a probability algorithm. This method works only with 8-bit images.
Syntax
int IMG_histogram_equalize();
Returns
Returns the status of the histogram equalize operation. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_invert_bitmap(void)
This method inverts the current image, changing pixels by a simple XOR operation applied to each byte of the image in memory. For bi-level images, this method changes black to white and white to black.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax
int IMG_invert_bitmap(void);
Returns
Returns the invert status of the current image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_merge_block(Snow.Snowbnd, int, int, int)
This method draws a source image on top of the current image at the x and y coordinates (xpos and ypos) passed in.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
The Viewing and Annotations Sample
The Swing Sample
309 Chapter 19 - Class Snow.Snowbnd Methods
Note: The images must have compatible bit depths.
Syntax int IMG_merge_block(Snowbnd shdib, int xpos, int ypos, int operation);
Remark
Table 19.26: IMG_merge_block(Snow.Snowbnd, int, int, int) Method Variables
Variable Description shdib Source Snowbound image class within which to merge xpos Starting x merge position ypos Starting y merge position 0 = draw entire image operation 1 = draw only the black part of 1-bit images
Returns
Returns the source Snowbound image class within to merge. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.11: IMG_merge_blockSample
if (Simage != null) { FileDialog fd = new FileDialog(this,"Open Bitmap",FileDialog.LOAD); fd.show();
FileName = fd.getDirectory() + fd.getFile(); if (FileName != null) { Simage = new Snow.Snowbnd(); tSimage.IMG_decompress_bitmap(FileName,0); Simage.IMG_merge_block(tSimage,31,31,0); tSimage = null; System.gc(); } }
IMG_print_applet(java.awt.Container, int)
310 Chapter 19 - Class Snow.Snowbnd Methods
This method prints images loaded into an applet. This method automatically determines in which browser the applet is being displayed, and performs high-resolution corrections for that browser. It also formats the document for high-resolution printing.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the Viewing and Annotating Documents sample.
Syntax
int IMG_print_applet(Container C, int res);
Remark
Table 19.27: IMG_print_applet(java.awt.Container, int) Method Variables
Variable Description C java.awt.Container into which image is displayed Dots per inch for printed document (must be the same as res the printer resolution)
Returns
Returns the status of Java.awt.Container of the displayed image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.12: IMG_print_appletSample
void button4_clicked(Event e) { IMG_print_applet(this, 300); }
IMG_print_applet_pages(java.awt.Container, int)
This method prints high-resolution multipage documents from applets.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the Viewing and Annotating Documents sample.
Notes: Results may vary depending on the web browser that is used. The resolution passed into this method must match the printer resolution. For example, if the printer is set to print at 300 DPI, make res = 300. Call this method for each page,
311 Chapter 19 - Class Snow.Snowbnd Methods
pass c as null after the last page. A print dialog displays (in Windows), and the print job begins.
Syntax int IMG_print_applet_pages(Container c, int res);
Remark
Table 19.28: IMG_print_appiet_pages(java.awt.Container, int) Method Variables
Variable Description c Java.awt.Container of displayed image res Resolution in DPI (dots per inch) of the destination image
Returns
Returns the status of Java.awt.Container of the displayed image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.13: IMG_print_applet_pagesSample
void button5_clicked(Event e) { //for a 3 page document for(int i = 0; i < 3; i++) { Simage.IMG_decompress_bitmap_stream_onthefly(st, i,this); IMG_print_applet_pages(this, 300); } IMG_print_applet_pages(null, 0); }
IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int)
This method prints the current image at the specified coordinates.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
312 Chapter 19 - Class Snow.Snowbnd Methods
l The SilentPrint Sample
l The Swing Sample
l Working with Vector PDF vs. Raster PDF: The VectorPDF Sample
Syntax
int IMG_print_bitmap(Graphics g, int xs, int ys, int xsize, int ysize, int res);
Remark
Table 19.29: IMG_print_bitmap(java.awt.Graphics, int, int, int, int, int) Method Variables
Variable Description g Graphics port xs Starting X position ys Starting Y position xsize Horizontal size ysize Vertical size res Print resolution in DPI (dots per inch). Usually set to 300.
Returns
Returns the status of specified coordinates of the displayed image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_remove_red_eye(int, int, int, int)
This method detects and converts photos of people with very red eyes to more natural colors.
Notes: If xpos, ypos, xsize, or ysizeis set to -1, the entire photo is searched. For best results, refine the search area. This method works only with 24-bit color images.
Syntax
int IMG_remove_red_eye(int xpos, int ypos, int xsize, int ysize);
Remarks
Table 19.30: IMG_remove_red_eye(int, int, int, int) Method Variables
313 Chapter 19 - Class Snow.Snowbnd Methods
Variable Description xpos Starting top left area for x coordinate ypos Starting top left area for y coordinate xsize Width of area to search ysize Height of area to search
IMG_resize_bitmap(int, int)
This method changes the internal size of the image according to the input parameters. The size of the source image is not relevant.
The parameters are the page height and width measured in pixels. For an A4 size page at 200 DPI, set IMG_resize_bitmap(2336, 1656) as shown in the following example:
11.69 inches high * 200 dpi = 2336 height in pixels 8.27 inches wide * 200 dpi = 1656 width in pixels
To preserve aspect ratio: hres is the destination width. vres the destination height.
Set the width and height to the original width and height of the image after decompress as shown in the following example:
Example 19.14: Preserving Aspect Ratio
vres = (int)((long)height * hres / width); IMG_resize_bitmap(hres,vres);
See IMG_resize_bitmap_bicubic(int, int) for important details on the algorithm (linear interpolation) used by this method, and for more details on creating high-quality thumbnails.
Note: IBM AFP printers require the width of an image to be an exact multiple of 8. To be on the safe side, set the width to a multiple of 8.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
314 Chapter 19 - Class Snow.Snowbnd Methods
Note: Do not use this method for zooming; you will permanently alter the image data.
Syntax
int IMG_resize_bitmap(int hres, int vres);
Remark
Table 19.31: IMG_resize_bitmap(int, int) Method Variables
Variable Description hres New horizontal size of the image vres New vertical size of the image
Returns
Returns the size of the horizontal or vertical image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_resize_bitmap_bicubic(int, int)
This method scales down images using a bicubic interpolation algorithm. It is good for creating high-resolution color image thumbnails. Since this operation is floating-point intensive, it is not as fast as IMG_resize_bitmap which uses a linear interpolation.
Bicubic interpolation takes a four pixel by four pixel block and produces an average of those pixels by weighting the value of the pixel in the average based on its distance from the origin pixel. Pixels farther away have less effect on the resulting pixel’s value than do its nearest neighbors.
Linear interpolation takes two pixels, separated by x pixels, and averages the two pixels to create an in-between value. These three pixels (the two original pixels and the newly created in- between pixel), are used to represent the original x + 2 pixels (the two original pixels as end points plus all of the pixels in between).
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in The Thumbnails Sample.
Syntax
int IMG_resize_bitmap_bicubic(int xsize, int ysize);
Remark
Table 19.32: IMG_resize_bitmap_bicubic(int, int) Method Variables
315 Chapter 19 - Class Snow.Snowbnd Methods
Variable Description xsize Target width of image in pixels ysize Target height of image in pixels
Returns
Returns the target width or height of the image in pixels. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_rotate_bitmap(int)
This method rotates the current image clockwise by display angle. This permanently rotates the image in memory. For fast rotation at display time (image is not altered in memory), call display_angle. See Class Snow.Snowbnd Methods for more information.
Note: It is expected behavior that the image is smaller in each rotation using IMG_rotate_ bitmap. If an image is rotated by 90 degrees, RasterMaster Java flips from portrait to landscape (or vice-versa) and preserves the page content. If the image is rotated by something other than 90 degrees, RasterMaster Java shrinks the page so that all the content is preserved. RasterMaster Java does not crop the edges during the rotation.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Syntax int IMG_rotate_bitmap(int angle);
Remark
Table 19.33: IMG_rotate_bitmap(int) Method Variables
Variable Description Angle to rotate image by, in hundredths of a degree. For angle example, to rotate an image by 90 degrees, enter 9000.
Returns
Returns the angle to rotate image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
316 Chapter 19 - Class Snow.Snowbnd Methods
IMG_save_bitmap(byte, int)
This method saves the current Snowbnd image object to a byte array. Multi-page saving to a byte array is supported for MO:DCA and TIFF only. There is no way to know how large the image will be once compressed.
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the Class Snow.Snowbnd Methods method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats in Appendix A, Supported File Formats for details on what bit-depths are available for each format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l Simple Conversion with Timeouts: The HangDetector Sample
l The Swing Sample
Notes: To save multiple pages for other formats, see IMG_save_bitmap(int, int, int, int) and Snowbound Error Codes for more information. This method returns a length of the compressed image in the byte array.
Syntax
byte[]IMG_save_bitmap(byte array[] b, int comp_type);
Remark
Table 19.34: IMG_save_bitmap(byte, int) Method Variables
Variable Description array Byte array in which to save. Output file format to write. See Appendix A, Supported File Formats for more information on supported file comp_type formats. The output constants for currently supported and unsupported file types are defined in Appendix A, Supported File Formats.
Returns
Returns the value of the output file size in bytes.
317 Chapter 19 - Class Snow.Snowbnd Methods
IMG_save_bitmap(byte, int, int, int)
This method saves the current Snowbnd image object to a returned byte array. Multi-page TIFF and PDF file formats are supported.
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the Class Snow.Snowbnd Methods method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats in Appendix A, Supported File Formats for details on what bit-depths are available for each format.
Notes: To save multiple pages for other formats, see IMG_save_bitmap(String, int)for more information. This method returns a length of the compressed image in the byte array.
Syntax int IMG_save_bitmap(byte dos[], int buff_inc, int comp_type, int error[]);
Remark
Table 19.35: IMG_save_bitmap(byte, int, int, int) Method Variables
Variable Description dos Buffer to use. buff_inc Amount that the buffer will grow if needed. Output file format to write. See Appendix A, Supported File Formats for more information on supported file comp_type formats. The output constants for currently supported and unsupported file types are defined in Supported File Formats . Returns the size of the data. If the value is less than 0, error then an error code is displayed.
Returns
Returns the value of the output file size in bytes.
IMG_save_bitmap(int, int, int, int)
318 Chapter 19 - Class Snow.Snowbnd Methods
This method is designed to allow saving to a byte array without knowing or guessing the final size of the compressed image or document. First, the initial size parameter is allocated. If the output data saved becomes larger than the initial size, then the buffer is reallocated toinitial_size plus the increment size specified bybuff_inc. Each time the output data becomes larger than the current buffer size when saving, the buffer is increased in size by the increment size. The caller must be careful in choosing the buffer increment size. If the buffer increment is too small, multiple reallocations will cause the saving process to be slow. If it is too large, too much memory will be allocated.
Note: Snowbound Software recommends an increment size of 10-25% of the initial buffer size.
Group 4 compression found in TIFF and AFP file formats typically compress at a rate of 10:1. You can choose an initial size of 1/8 to 1/10 of the uncompressed size.
A JPEG file format typically compresses at a rate of 10:1.
An LZW file format found in TIFF and GIF file formats compress at a rate of about 3:1. A .zip or flate file found in a PNG file format also compresses at a rate of about 3:1.
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the Class Snow.Snowbnd Methods method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats in Appendix A, Supported File Formats for details on what bit-depths are available for each format.
Note: Compression results for your images may vary. For best results, test a number of images to see what the resultant output size will be. Also, it is suggested to test out smaller and larger increment sizes to find the best level of performance.
Syntax
byte[] IMG_save_bitmap(int initial_size, int buff_inc, int comp_ type, int error[]);
Remark
Table 19.36: IMG_save_bitmap(int, int, int, int) Method Variables
Variable Description initial_size The buffer is initially allocated to this size exactly. buff_inc The amount to grow the buffer if needed. Output file format to write. See Supported File Formats comp_type for more information on supported file formats. The output
319 Chapter 19 - Class Snow.Snowbnd Methods
Variable Description constants for currently supported and unsupported file types are defined in Supported File Formats Returns the size of the data. If the value is less than zero, error it is an error code.
Returns
Returns the value of the output file size in bytes.
IMG_save_bitmap(String, int)
This method saves the current Snowbnd image object to the format specified by comp_type. The string value is the output file.
TIFF is a multi-page file format. If the image name already exists, a new page or image is appended to the local file, leaving the current images unchanged. If the file does not exist, it is created with only one page.
You can save images as black and white, grayscale or color by specifying the appropriate bit depth and choosing an output format that supports that bit depth. To determine the bit depth of the image you have loaded, you may use the Class Snow.Snowbnd Methods method.
See Color Manipulation Methods for more information on changing the color and bit-depth of an image. See the Supported Bit Depths for Image Formats inSupported File Formats for details on what bit-depths are available for each format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l Simple Conversion: The SimpleConvert Sample
l The Swing Sample
Note: Only applications and signed applets can save to a file.
Syntax int IMG_save_bitmap(String st, int comp_type);
Remark
Table 19.37: IMG_save_bitmap(String, int) Method Variables
320 Chapter 19 - Class Snow.Snowbnd Methods
Variable Description st Output filename in which to save. Output file format to write. See Appendix A, Supported File Formats for more information on supported file comp_type formats. The output constants for currently supported and unsupported file types are defined in Supported File Formats .
Returns
Returns the value of the output file size in bytes.
IMG_save_document(String, byte, int)
This method saves to a searchable PDF file.
Note: Only applications and signed applets can save to a file.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the Saving to Searchable PDF: The saveSearchablePDF Sample.
Syntax
int IMG_save_document(String bm_name, byte vbuff[], int filetype);
Remark
Table 19.38: IMG_save_document(String, byte, int) Method Variables
Variable Description bm_name Name of file to save to. vbuff[] Byte array of extracted text and graphics. File type to save to. Currently, the file type to save to is filetype only PDF.
Returns
Returns the filename or file type to save to. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_save_document(byte, byte, int)
This method saves to a searchable PDF file.
321 Chapter 19 - Class Snow.Snowbnd Methods
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the Saving to Searchable PDF: The saveSearchablePDF Sample.
Syntax int IMG_save_document(byte dos[], byte vbuff[], int filetype);
Remark
Table 19.39: IMG_save_document(String, byte, int) Method Variables Variable Description dos[] Destination byte array buffer to save to. vbuff[] Byte array of extracted text and graphics. File type to save to. Currently, the file type to save to is filetype only PDF.
Returns
Returns the filename or file type to save to. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_scroll_bitmap(java.awt.Container, java.awt.Event)
This method scrolls the bitmap. It essentially moves the current cropping rectangle in the direction indicated by the ScrollBar thumb. For users who do not want the scrollbars visible, a similar effect can be achieved by moving the cropping rectangle around using IMG_set_ croprect.
See Class Snow.Snowbnd Methods for more information.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the The Viewing and Annotations Sample.
Note: A HandleEvent method for scrolling is not needed because it is handled internally.
Syntax int IMG_scroll_bitmap(Container sf, Event evt);
Remark
322 Chapter 19 - Class Snow.Snowbnd Methods
Table 19.40: IMG_scroll_bitmap(java.awt.Container, java.awt.Event) Method Variables
Variable Description sf Current frame or window. evt Event object passed to the event handler.
Returns
Returns the status of the current frame or window. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.15: IMG_scroll_bitmapSample
public boolean handleEvent (Event evt) { switch(evt.id) { case Event.SCROLL_LINE_UP: case Event.SCROLL_LINE_DOWN: case Event.SCROLL_PAGE_UP: case Event.SCROLL_PAGE_DOWN: case Event.SCROLL_ABSOLUTE: { Simage.IMG_scroll_bitmap(this,evt); return true; } } return super.handleEvent(evt); }
IMG_set_croprect(int, int, int, int)
This method sets dis_crop_xs, dis_crop_xe, dis_crop_ys, anddis_crop_ye. The cropping rectangle is essentially the size of the display container (which is usually a subclass of System.Windows.Forms.Paneljava.awt.Container), mapped onto the image (corrected for image scaling).
To use cropping methods with zooming, see map_wnd_to_image(java.awt.Container, java.awt.Point) and map_image_to_wnd(java.awt.Container, java.awt.Point).
323 Chapter 19 - Class Snow.Snowbnd Methods
Notes: This method is interchangeable with set_croprect(int, int, int, int). Crop values are static and cannot be used in a multi-threading environment.
Syntax void IMG_set_croprect(int xs, int ys, int xsize, int ysize);
Remark
Table 19.41: IMG_set_croprect(int, int, int, int) Method Variables
Variable Description Coordinate on the X axis for the upper edge of the xs cropping rectangle. Coordinate on the Y axis for the left edge of the cropping ys rectangle. xsize Width of the cropping rectangle in image pixels. ysize Height of the cropping rectangle in image pixels.
IMG_sharpen_bitmap(int)
This method sharpens or blurs the image. Positive values sharpen the image using a Laplacian method while negative values blur the image using an image-averaging filter.
Syntax int SNBDAPI IMG_sharpen_bitmap(int sharpness);
Remark
Table 19.42: IMG_sharpen_bitmap(int) Method Variables
Variable Description sharpness Integer value from -127 to 127
Returns
Returns the sharpen bitmap operation. A value of 0 indicates success. Returns a FORMAT_ NOT_ALLOWED error message for 1-bit (black and white) images and for 4-bit or 8-bit color images. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.16: IMG_sharpen_bitmapSample
324 Chapter 19 - Class Snow.Snowbnd Methods
Snowbnd snow = new Snowbnd(); snow.IMG_decompress_bitmap("c:/test.tif", 0); snow.IMG_sharpen_bitmap(127); // sharpens snow.IMG_save_bitmap("c:/test.sharpened.tif", 0);
Snowbnd snow = new Snowbnd(); snow.IMG_decompress_bitmap("c:/test.tif", 0); snow.IMG_sharpen_bitmap(-127); // blurs snow.IMG_save_bitmap("c:/test.blurred.tif", 0);
IMG_shift_bitmap(int, int)
This method shifts the image data along the x and y axes, positively or negatively according to the parameters passed in. Values are relative.
Note: The height and width of the image do not change, so any data shifted beyond the border of the image is permanently lost.
Syntax
int IMG_shift_bitmap(int xoffset, int yoffset);
Remark
Table 19.43: IMG_shift_bitmap(int, int) Method Variables
Variable Description Positive or negative horizontal distance to move image xoffset data. yoffset Positive or negative vertical distance to move image data.
Returns
Returns the status of the horizontal or vertical distance to move image data. A value of 0 indicates success. Any value less than zero is a Snowbound error code.See Appendix D, Snowbound Error Codes for a list of error codes.
IMG_window_level(int, int, int)
This method changes the range of displayed pixels. It performs window leveling in 8 and 16-bit gray scale images.
325 Chapter 19 - Class Snow.Snowbnd Methods
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Viewing and Annotations Sample
l The Swing Sample
Note: If the min and max values are set to zero, the method automatically calculates the min and max values by analyzing the image.
Syntax int IMG_window_level(int min, int max, int on_off);
Remark
Table 19.44: IMG_window_level(int, int, int) Method Variables
Variable Description min Minimum value of window level. max Maximum value of window level. 1 = On on_off 0 = Off
Returns
Returns the status of the minimum or maximum value of the window level. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.17: IMG_window_levelSample
if (Simage.getBitsPerPixel() == 16) Simage.IMG_window_level(0,0,1);
IMGLOW_append_page(String, byte, int)
This method allows the appending of content for individual pages without any changes. This allows appending or creation of files to preserve the exact content of PDF pages.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples\vectorpdf. This method is used The VectorPDFPageManipulation Sample.
326 Chapter 19 - Class Snow.Snowbnd Methods
Syntax
public int IMGLOW_append_page(String filename, byte buff[],int format);
Remark
Table 19.45: IMGLOW_append_page(String, byte, int) Method Variables
Variable Description filename Sets the filename of the source file to append a page to. buff A bytearray containing the page to append. Integer value to specify the file format. Currently TIFF and format PDF
Returns
Returns the resulting document with the specified page appended. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_delete_page(String, int, int)
This method returns the ability to delete the specified page from a multi-page document. The content of the resulting document is returned unchanged in the form of a byte array.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples\vectorpdf. This method is used in the The VectorPDFPageManipulation Sample.
Syntax
public int IMGLOW_delete_page(String, int, int);
Remark
Table 19.46: IMGLOW_delete_page(String, int, int) Method Variables
Variable Description bm_name Sets the filename of the source file to append a page to. buff A bytearray containing the page to append. format One integer array to return an error code >= 0 is no error.
Returns
327 Chapter 19 - Class Snow.Snowbnd Methods
Returns a byte array of the resulting document with the specified page deleted. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_delete_page(DataInputStream, int, int)
This method returns the ability to delete the specified page from a multi-page document. The content of the resulting document is returned unchanged in the form of a byte array.
Syntax public int IMGLOW_delete_page(DataInputStream, int, int);
Remark
Table 19.47: IMGLOW_delete_page(DataInputStream, int, int) Method Variables
Variable Description The DataInputStream containing the multi-page di document to delete the page from. buff The page index to delete starting at 0. format One integer array to return an error code >= 0 is no error.
Returns
Returns a byte array of the resulting document with the specified page deleted. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char)
This method can be used to detect blank pages. It can also be used to detect pages that are essentially blank though there are some scan artifacts or other “dirt” on them.
This method returns the percentage of pixels present that are not equal to the passed detection or background color. If autodetect is set to 1, then the detection or background color will be determined automatically and will correspond to the dominant color in the image. The tolerance value can be set to allow for a more lenient color matching the algorithm.
Syntax
328 Chapter 19 - Class Snow.Snowbnd Methods
double SNBDAPI IMGLOW_detect_blank_page(int hdib, char autodetect, int red, int green, int blue, int tolerance, char isLowQuality, char isLowMemory);
Remark
Table 19.48: IMGLOW_detect_blank_page(int, char, int, int, int, int, char, char) Method Variable
Variable Description hdib Standard RasterMaster® SDK image handle. Auto-detect the background color (0: no; 1: yes). 1 will autodetect force the system to ignore the passed color. 24-bpp: Red component of the detection color. May have the value of [0-255]. 1-bpp/4-bpp/8-bpp: Index value of red the detection color. May have the value of [0-1], [0-127], and [0-255], respectively. Green component of the detection color. Ignored for non- green 24-bpp images. May have the value of [0-255]. Blue component of the detection color. Ignored for non- blue 24-bpp images.May have the value of [0-255]. Per color-channel pixel-value match tolerance linear tolerance distance value. Use this value in comparing background pixels. This number is in the range [0-255]. Execute the low-quality version of the autodetect algorithm (0: no; 1: yes). The low-quality version will not isLowQuality guarantee the global maximum, but it will execute much faster. The tolerance level is not taken into consideration. Execute the low-memory version of the autodetect algorithm (0: no; 1: yes). The low-memory version will not isLowMemory guarantee the global maximum. The tolerance level is not taken into consideration. This setting is only for 24-bpp images.
Returns
Double. The percentage of pixels on the page that are not equal to the background color. If the percentage is zero or near zero the page is blank. Note the percentage is a floating point number. For example, a return value of 50.26 means 50.26% of the page is non-blank. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_detect_color()
329 Chapter 19 - Class Snow.Snowbnd Methods
This method checks all pixels to determine if the image is color or gray scale. In documents with a mix of black and white and color pages, you can improve performance and reduce the output document size by ensuring the black and white pages are saved as 1-bit per pixel (monochrome) rather than 24-bits per pixel (color). Use this method to detect the presence of gray scale or color pixels on the current page. If the bit depth returned by this method is less than the bit-depth returned by Class Snow.Snowbnd Methods in biBitCount, then you should consider converting to a lower bit per pixel format. Snowbound Software recommends converting to CCITT_TIFF_G4 format for black and white text images.
Notes: The quality of the conversion to black and white or grayscale can be enhanced by specifying the alias and alias quality. We highly recommend the JPEG compression format as the best compression available in our library for photo type images.
Syntax int SNBDAPI IMGLOW_detect_color(void);
Returns
Returns the bits per pixel of the image. If this method returns 1, then this image contains only black and white pixels. If this method returns 8, then this image contains gray scale data such as black and white photo or shaded graphics. If this method returns 24, then this image contains at least some content that uses full color. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.18: IMGLOW_detect_colorSample
public int IMGLOW_detect_color()
int pages = tSimage.IMGLOW_get_pages(st);
System.out.println("Pages - " + pages);
int x,bits_pix; for (x = 0;x < pages; x++) { stat = tSimage.IMG_decompress_bitmap(st,x); bits_pix = tSimage.IMGLOW_detect_color(); if (bits_pix == 24)
tSimage.IMG_save_bitmap("c:\\temp\\mix_ java.tif",Snow.Defines.TIFF_LZW); else
330 Chapter 19 - Class Snow.Snowbnd Methods
{ if (bits_pix == 8) tSimage.IMG_thresh_mono();
tSimage.IMG_save_bitmap("c:\\temp\\mix_ java.tif",Snow.Defines.TIFF_G4_FAX); } }
IMGLOW_extract_page(String, int, int)
This method extracts the specified page from a multi-page PDF or TIFF document.
This method extracts the specified page from a multi-page document. IMGLOW_extract_ page differs from IMG_decompress_image in that it preserves the format of the original page rather than converting it to the Snowbound common raster format. The currently supported input formats are raster PDF, searchable PDF and TIFF.
Syntax
byte[] IMGLOW_extract_page(String bm_name, int page, int error[]);
Remarks
Table 19.49: IMGLOW_extract_page(String, int, int) Method Variables
Variable Description The filename of the multi-page document from which to bm_name extract page. page The page number to extract starting at 0. One integer array for returning an error code, where non- error zero implies an error code and zero implies no error.
Returns
byte[]. A byte array of the extracted page.
IMGLOW_extract_page(java.io.DataInputStream, int, int)
This method allows the extraction of a PDF or TIFF page into a returned buffer. The page parameter will specify the page number starting at 0. An entire complete TIFF or PDF file of a single page will be returned.
Syntax
331 Chapter 19 - Class Snow.Snowbnd Methods
byte[] IMGLOW_extract_page(java.io.DataInputStream di, int page, int error[]);
Remarks
Table 19.50: IMGLOW_extract_page(java.io.DataInputStream, int, int) Method Variables
Variable Description di DataInputStream. page The page number to extract starting at 0. One integer array for returning an error code, where non- error zero implies an error code and zero implies no error.
Returns byte[]. A byte array of the extracted page.
IMGLOW_extract_text(String, int, int, int)
This method extracts text from PTOCA, PCL, PDF, MS Word, AFP, RTF and MS Excel files. It returns the buffer of extracted text in ASCII format.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Loadandsave Sample
l The Printing Sample
Syntax byte[] IMGLOW_extract_text(String bm_name, int length[], int error [], int page);
Remarks
Table 19.51: IMGLOW_extract_text(String, int, int, int) Method Variables
Variable Description bm_name Name of file from which to extract text. Array for returning a single integer to specify the length of length the buffer to receive extracted text. error Array for returning an integer code. page Page number of file from which to extract text.
Returns
332 Chapter 19 - Class Snow.Snowbnd Methods
ASCII format.
Note: Some PDF or PCL files may be in a format that will not allow text searching.
Please note that the sample below is a sample of output.
Example 19.19: IMGLOW_extract_textSample
int length[],error[]; length = new int [2]; error = new int[2];
int stat;
Simage = new Snowbnd(); buff = Simage.IMGLOW_extract_text(FileName,length,error,page);
The extracted text returned in buff will look like the text in the following example,which contains meta-data that is described in Variables Included in Extracted Text:
%%SOF /Page=0 /Width=1700 /Height=2200 /FontName=TimesRoman /FontHeight=44 /FontBold=1 /FontItalic=0 /Xpos=1300 /Ypos=240 %%SOT Devadas %%EOT /Xpos=1253 /Ypos=240 %%SOT S. %%EOT %%EOF
Table 19.52: Variables Included in Extracted Text
Variable Description %%SOF Signals the start of the buffer. %%EOF Marks the end of extracted text. Specified once at the beginning of the file to indicate the Page page number.
333 Chapter 19 - Class Snow.Snowbnd Methods
Variable Description Specified once at the beginning of the file to indicate page Width width in pixels. Specified once at the beginning of the file to indicate page Height height in pixels. FontName Name of font FontHeight Font height in pixels. Font to be drawn plain or in bold:
FontBold 1 = bold 0 = plain Font to be drawn in normal or Italic:
FontItalic 1 = ItIalic 0 = normal Xpos X pos in pixels. Ypos Y pos in pixels. %%SOT Start of text block. %%EOT End of text block.
IMGLOW_get_bitmap_name()
This method gets the Date tag before or after decompressing a TIFF image.
Note: Please see the TIFF 6.0 specification (http://www.adobe.com) for a definition of tags Author 315.
Syntax int IMGLOW_get_bitmap_name();
Returns
Returns the Date tag. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.20: IMGLOW_get_bitmap_dateSample
Public String IMGLOW_get_bitmap_date() { return tiff.get_image_date(); }
334 Chapter 19 - Class Snow.Snowbnd Methods
IMGLOW_get_brightness()
This method returns the current brightness set by IMGLOW_set_brightness(int). The default is 0. See IMGLOW_set_bitmap_name(String, String) for more information.
Syntax
int IMGLOW_get_brightness();
Returns
Integer. Any value between -127 and 127.
IMGLOW_get_contrast()
This method returns the current contrast set by IMGLOW_set_contrast(int). The default is 0. See IMGLOW_set_contrast(int) for more information.
Syntax
int IMGLOW_get_contrast();
Returns
Integer. Any value between -127 and 127.
IMGLOW_get_docx_license_filename()
This method gets the filename of the DOCX license file.
Syntax
void IMGLOW_get_docx_license_filename();
Returns
The filename. Null is the default value and indicates using a default license name.
IMGLOW_get_docx_license_path()
This method gets the absolute path of the DOCX license file path.
Syntax
void IMGLOW_get_docx_license_path();
Returns
335 Chapter 19 - Class Snow.Snowbnd Methods
The absolute path. Null is the default value and indicates searching the Java class path and the Java library path.
IMGLOW_get_fileinfo(java.io.DataInputStream, int)
This method fills in the height, width, and bits-per-pixel without decompressing the entire file. After calling this method, you can call getHeight(void), getWidth(void), getXdpi(void), getYdpi (void), and Class Snow.Snowbnd Methods.
Syntax int IMGLOW_get_fileinfo(java.io.DataInputStream di, int page);
Remark
Table 19.53: IMGLOW_get_fileinfo(java.io.DataInputStream, int)Method Variables
Variable Description filename Filename and path to an image. page Page number of multipage file.
Returns
Returns the status of the DataInputStream. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_filetype(String)
This method returns the file type of an image. See Appendix A, Supported File Formatsor our website (www.snowbound.com) for a current list of supported formats.
Syntax int IMGLOW_get_filetype(String filename);
Remark
Table 19.54: IMGLOW_get_filetype(String) Method Variables
Variable Description filename Filename and path to an image.
Returns
336 Chapter 19 - Class Snow.Snowbnd Methods
Returns the status of the DataInputStream. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_filetype(java.io.DataInputStream)
This method returns the filetype of an image. See Appendix A, Supported File Formatsor our website (www.snowbound.com) for a current list of supported formats.
Note: You cannot read from an InputStream because it does not allow random access to the data. You must use either a string or a DataInputStream that was created from a ByteArray.
Syntax
int IMGLOW_get_filetype(DataInputStream dis);
Remark
Table 19.55: IMGLOW_get_filetype(java.io.DataInputStream) Method Variables
Variable Description dis Image in memory.
Returns
Returns the filetype of an image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_gamma()
This method returns the current gamma set byIMGLOW_set_gamma(int). The default is 100. See IMGLOW_set_gamma(int) for more information.
Syntax
int IMGLOW_get_gamma();
Returns
Returns the current gamma set by IMGLOW_set_gamma(int). Any value between 0 and 400. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_image_orientation(void)
337 Chapter 19 - Class Snow.Snowbnd Methods
This method returns the orientation of the last image decompressed if the information is available. Orientation is used to determine the display angle.
Note: Currently, TIFF and CALS can return orientation information.
Syntax int IMGLOW_get_image_orientation();
Returns
Returns the orientation of the last image decompressed. Any value between 0 and 400. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_pages(java.io.DataInputStream)
This method returns the number of pages in a multi-page document. It works for any multi-page format. See Appendix A, Supported File Formats or our website (www.snowbound.com) for a current list of supported formats.
Note: The first page is 0.
Syntax int IMGLOW_get_pages(DataInputStream dis);
Remark
Table 19.56: IMGLOW_get_pages(java.io.DataInputStream) Method Variables Method Variables
Variable Description An object containing compressed image data. This dis usually contains a file loaded into memory, and is commonly, but not necessarily, multipaged.
Returns
Returns the number of pages in a multi-page document. A value of 0 or 1 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
338 Chapter 19 - Class Snow.Snowbnd Methods
IMGLOW_get_pages(String)
This method returns the number of pages in a multi-page document. It works for any multi-page format. See Appendix A, Supported File Formats or our website (www.snowbound.com) for a current list of supported formats.
l Simple Conversion: The SimpleConvert Sample
l Saving to Searchable PDF: The saveSearchablePDF Sample
Note: The first page is 0.
Syntax
int IMGLOW_get_pages(String filename);
Remark
Table 19.57: IMGLOW_get_pages(String) Method Variables
Variable Description filename Filename and path to an image.
Returns
Returns the number of pages in a multi-page document. A value of 0 or 1 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_raster(int, byte[])
This method returns the raster line specified by the position on the Y-axis into the array buffer. Data placed in the array is in the DIB format. This is one line of raw, uncompressed data.
Syntax
int IMGLOW_get_raster(int ypos, byte buff[]);
Remark
Table 19.58: IMGLOW_get_raster(int, byte[]) Method Variables
Variable Description ypos Line to retrieve. buff Buffer to hold data.
339 Chapter 19 - Class Snow.Snowbnd Methods
Returns
Returns the raster line specified by the position on the Y-axis into the array buffer. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_get_tiff_tag(int, int, int[], java.io.DataInputStream, byte[], int)IMGLOW_get_tiff_ tag(int, int, int[], String, byte[], int)
These methods read a TIFF tag from the file specified. The tag may be either a string returned in buff or an int, short, or byte returned in value.
Note: This method is not thread-safe. The tags are kept in static memory. The tags for TIFF files read in are not saved unless they are in the set needed to create a PDF file. Alternatively, the user can explicitly call IMGLOW_set_tiff_tag for each tag in the original TIFF. The thread-safe workaround is encapsulating the processing of one file in a synchronized block with a class object or a static member as a static lock.
Syntax int IMGLOW_get_tiff_tag(int tag, int max_bytes, int[] value, String file, byte[] buff, int page); int IMGLOW_get_tiff_tag(int tag, int max_bytes, int[] value, DataInputStream file, byte[] buff, int page);
Remark
Table 19.59: int IMGLOW_get_tiff_tag(int, int, int [],java.io.DataInputStream, byte[], int) and IMGLOW_get_tiff_tag(int, int, int[], String, byte[], int) Method Variables
Variable Description tag TIFF tag number to return. max_bytes Maximum bytes to read for string tags. Tag value returned: value 1 = String 0 = Non String File to read tags from. If a string is passed in, the file must file be locally accessible. buff String buffer for returning string tags. page Page number for multipage file.
340 Chapter 19 - Class Snow.Snowbnd Methods
Returns
Dependent on how value variable is set.
Example 19.21: IMGLOW_get_tiff_tagSample
You can use the TIFF tag to get the colorspace type by specifying tag #262.
Value is what is returned. For this tag you will not need the byte array.
int tag_no = 262; int max_bytes = 0; int[] value = new int[1]; byte[] data = null;
myFrame.Simage.IMGLOW_get_tiff_tag(tag_no, max_bytes, value, st, data, page);
/* PHOTOMETRIC INTERPRETATION */
#define TIFF_PHOTO_WHITE_IS0 0 #define TIFF_PHOTO_WHITE_IS1 1 #define TIFF_PHOTO_RGB 2 #define TIFF_PHOTO_PALETTE 3 #define TIFF_PHOTO_TRANSP 4 #define TIFF_PHOTO_CMYK 5 #define TIFF_PHOTO_YCC 6 #define TIFF_PHOTO_CIELAB 8
IMGLOW_get_warnings()
This method returns a SnbdWarningCode object. It is used to get a list of warnings that occurred while decompressing a document. Currently, warnings are only reported for MS Word documents. For more information, please see Snowbound Classes .
Syntax
public SnbdWarningCode IMGLOW_get_warnings();
Returns
SnbdWarningCode object
Example 19.22: IMGLOW_get_warningsSample
341 Chapter 19 - Class Snow.Snowbnd Methods
Public Snowbnd sImage = new Snowbnd(); int stat = sImage.IMG_decompress_bitmap(“myFile”, 0); SnbdWarningCode sWarning = sImage.IMGLOW_get_warnings(); if ( sWarning.hasWarnings() ) { for ( int i = 0; i < sWarning.getWarningCodes().size(); i++ ) { System.out.println( sWarning.getWarningMessage(i) ); } }
IMGLOW_put_raster(int, byte[])
This method replaces the raster line specified on the Y-axis with the new image data in the array buffer. The data to replace it is in the DIB format. This is one line of raw uncompressed data.
See for more information regarding formats for decompressed images.
Syntax int IMGLOW_put_raster(int ypos, byte buff[]);
Remark
Table 19.60: IMGLOW_put_raster(int, byte[]) Method Variables
Variable Description ypos Line to replace. buff Data with which to replace.
Returns
Returns the new image data in the array buffer. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_redact_page(String, String, rarray, int , int)
This method supports PDF redaction by removing any strings that intercept a rectangle or rectangles passed in as arguments to this method.
Syntax
342 Chapter 19 - Class Snow.Snowbnd Methods
int IMGLOW_redact_page(String inputFile, String outputFile, Rectangle2D.Double[] rarray, int page, int color)
Remarks
Table 19.61: IMGLOW_redact_page Method Variables
Variable Description inputFile The input file. outputFile The output file. Rectangle2D.Double[] A rectangle or rectangles passed in as arguments. page Page number to read. color Color to fill.
Returns
Returns the area to redact. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.23: IMGLOW_redact_page Sample
{ try { RedactionInterface redactionFilter = (RedactionInterface) FilterManager .getFormatFilter(".pdf"); return redactionFilter.redactPage(inputFile, outputFile, rarray, page, color); } catch (ClassNotFoundException cnfe) { return ErrorCodes.DLL_NOT_LOADED; } }
IMGLOW_redact_page(DataInputStream, rarray, int, int)
This method supports PDF redaction by removing any strings that intercept a rectangle or rectangles passed in as arguments to this method.
Syntax
int IMGLOW_redact_page(String inputFile, Rectangle2D.Double[] rarray, int page, int color)
343 Chapter 19 - Class Snow.Snowbnd Methods
Remarks
Table 19.62: IMGLOW_redact_page Method Variables
Variable Description inputStream DataInputStream containing file data. Rectangle2D.Double[] A rectangle or rectangles passed in as arguments. page Page number to read. color Color to fill.
Returns
Returns the area to redact. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_search_text(byte[], String, int, int, int[])
The method returns an array of structures of classes of the type, SNBD_SEARCH_RESULT. For each class or structure there is an array of rectangles. This is to allow a search term to wrap to a new line requiring more than two rectangles to highlight.
The nCount parameter will be set to the number of rectangles required for each instance of a search term. The rectangles will be sorted from the top of the page to the bottom from the left side to the right.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The Loadandsave Sample
l The Printing Sample
l Saving to Searchable PDF: The saveSearchablePDF Sample
Note: The following file formats are supported: AFP, PCL, PDF, Word and Excel.
Syntax
SNBD_SEARCH_RESULT[] IMGLOW_search_text(byte[] buffer, String search_String, int page, int error[]);
Remark
344 Chapter 19 - Class Snow.Snowbnd Methods
Table 19.63: IMGLOW_search_text(byte[], String, int, int, int[]) Method Variables
Variable Description Character buffer to search. Returned from a call to buffer IMGLOW_extract_text(String, int, int, int). search_String String for which to search. Is search case sensitive. case_sensitive 0 = Not case sensitive 1 = case sensitive error Error code.
IMGLOW_set_alias(int)
This function displays scaled-down (zoomed out) 1-bit (black and white) and color images.
Preserve Black checks neighboring pixels for any adjacent black values and literally interpolates (inserts) black pixels so that small black lines or objects are not lost when scaling a large black and white image. It is recommended to use preserve black for large schematics and engineering drawings.
Scale to Gray converts a black and white image to gray scale upon display when zooming out on a large drawing or document. It is recommended for use with documents or other images that contain text.
Scale to Color is used when scaling down color images and prevents loss of visual data, creating a smoother rendering of text and lines.
Alias All turns scale to gray and scale to color on and is the default setting.
Syntax
int IMGLOW_set_alias(int alias_type);
Remark
Table 19.64: IMGLOW_set_alias Function Variable
Variable Description Sets the aliasing factor. Choose from: 0 = No aliasing 1 = Use the preserve black algorithm alias_type 2 = Use the scale to gray algorithm 3 = Use the scale to color algorithm 4 = Alias all. Use scale to gray and scale to color
Returns
345 Chapter 19 - Class Snow.Snowbnd Methods
Returns the status of the aliasing factor. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, String, int, double)
This method sets attributes for importing an Ascii file into the RasterMaster Java library.
Note: Please note that this method is not thread safe.
Syntax int IMGLOW_set_ascii_attributes(int xdpi, int ydpi, int lmargin, int rmargin, int tmargin, int bmargin, int tabs, int pwidth, int pheight, int psize, int charpline, int lineppage, boolean weigh, boolean ital, String fontName, int lnspacing, double charspacing);
Remark
Table 19.65: IMGLOW_set_ascii_attributes(int, int, int, int, int, int, int, int, int, int, int, int, boolean, boolean, String, int, double) Method Settings
Setting Default Value Description Horizontal dots per inch for rendering file. 200 or xdpi 200 300 usually. Vertical dots per inch for rendering file. 200 or 300 ydpi 200 usually. lmargin 1000 Left margin size in 1/1000 of an inch. rmargin 1000 Right margin size in 1/1000 of an inch. tmargin 750 Top margin size in 1/1000 of an inch. bmargin 750 Bottom margin size in 1/1000 of an inch. tabs 8 Number of characters between tab stops. pwidth 8500 Page width in 1/1000 of an inch. pheight 11000 Page height in 1/1000 of an inch. psize -1 Font height in pixels. charpline 80 Characters per line. lineppage 60 Lines per page. weight false Set to True for bold and False for normal. italic false Set to True for Italic or False for normal.
346 Chapter 19 - Class Snow.Snowbnd Methods
Setting Default Value Description typeFace TimesRoman Font type name. asciiFont null Ascii font. lineSpacing 0 Line spacing. charSpacing 0 Character spacing. pageOffset 1 Sets the page offset.
IMGLOW_set_bitmap_name(String, String)
This method sets the Name or Author and Date tag before saving images to the TIFF format.
Note: Please see the TIFF 6.0 specification (http://www.adobe.com) for a definition of tags Author 315, and Date 306.
Syntax
int IMGLOW_set_bitmap_name(String img_author, String img_date);
Remark
Table 19.66: IMGLOW_set_bitmap_name(String, String) Method Settings
Setting Description img_author Sets the author tag at 315. img_date Sets the date tag is 306.
Returns
Returns the Name or Author and Date tag. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.24: IMGLOW_set_bitmap_nameSample
Public int IMGLOW_set_bitmap_name(
String img_author, String img_date ) { return tif_save.set_image_name(img_author,img_date); }
347 Chapter 19 - Class Snow.Snowbnd Methods
IMGLOW_set_brightness(int)
This method sets the brightness of the current image.
Notes: Setting and saving the brightness permanently affects color and grayscale image data. This method has no effect on 1-bit images, except at display time (if anti-alias is on, and alias = 2).
Syntax int IMGLOW_set_brightness(int value);
Remark
Table 19.67: IMGLOW_set_brightness(int) Method Settings
Setting Description Sets the image's brightness to the lowest (darkest) -127 setting. 0 (Default) Retains the image's native brightness. Sets the image's brightness to the highest (lightest) +127 setting.
Returns
Returns the brightness of the current image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_comp_quality(int)
This method sets the compression quality factor when saving JPEG images.
IMGLOW_set_comp_quality is rarely used. If the size of the TIFF_JPEG output file needs to be reduced and it is acceptable to reduce the quality of the output, you can call this method before calling IMG_save_bitmap.
Syntax int IMGLOW_set_comp_quality(int quality);
Remark
Table 19.68: IMGLOW_set_comp_quality(int) Method Variables
348 Chapter 19 - Class Snow.Snowbnd Methods
Variable Description 1 = Smallest file size and lowest quality image. quality 100 = Largest file size and highest quality image.
Returns
Returns the compression quality factor when saving JPEG images. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_contrast(int)
This method sets the relative difference between the image’s black and white values.
Notes: Setting and saving the contrast permanently affects color and grayscale image data. This method has no effect on 1-bit images, except at display time if anti-alias is on and alias = 2.
Syntax
int IMGLOW_set_contrast(int value);
Remark
Table 19.69: IMGLOW_set_contrast(int) Method Settings
Setting Description (minimum) Displays the image with minimum contrast -127 between the image’s black and white colors. 0 (Default) Retains the image's native contrast. (maximum) Displays maximum contrast, causing the +127 whites to be whiter and the blacks to be blacker.
Returns
Returns the relative difference between the image’s black and white values. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_decompsize(int, int)
This method allows setting the destination size for an image being decompressed. At decompress time, the image is scaled to the destination x and y size. This destination size also
349 Chapter 19 - Class Snow.Snowbnd Methods represents the image size in pixels, as it is necessary to decompress using IMG_decompress_ bitmap.
When the IMGLOW_set_alias parameter is set to 4, the above method uses the Bicubic interpolation algorithm for scaling the image smoothly. If the alias parameter is set to 0, the scaling is done by skipping pixels. There is no other processing of neighboring pixels.
Note: The destination size must be set before calling any decompress method.
Syntax int IMGLOW_set_decompsize(int xsize, int ysize);
Remark
Table 19.70: IMGLOW_set_decompsize(int, int) Method Settings
Method Description xsize Destination width of image after resizing. ysize Destination height of image after resizing.
IMGLOW_set_decomp_rect(int, int, int, int)
This method allows specifying a rectangle in the image to decompress. Only this portion of the image is stored in RasterMaster Java’s internal memory. To turn this method off, call the method with all parameters set to 0.
Note: This must be set prior to decompressing an image
Syntax int IMGLOW_set_decomp_rect(int xs, int ys, int xsize, int ysize);
Remarks
Table 19.71: IMGLOW_set_decomp_rect(int, int, int, int) Method Settings
Method Description xs Starting X position. xy Starting Y position. xsize Horizontal size of cropping rectangle. ysize Vertical size of cropping rectangle.
350 Chapter 19 - Class Snow.Snowbnd Methods
IMGLOW_set_docx_license_filename(String)
This method sets the filename of the DOCX license file.
Syntax
void IMGLOW_set_docx_license_filename(String licenseFilename);
Remarks
Table 19.72: IMGLOW_set_docx_license_filename(String) Method Settings
Method Description Null is the default value and indicates using a default license licenseFilename name.
Returns
Void
IMGLOW_set_docx_license_path(String)
This method sets the absolute path of the DOCX license file path.
Syntax
void IMGLOW_set_docx_license_path(String licensePath);
Remarks
Table 19.73: IMGLOW_set_docx_license_path(String) Method Settings
Method Description Null is the default value and indicates searching the Java licensePath class path and the Java library path.
Returns
Void
IMGLOW_set_document_input(int, int, int)
This method sets the level of color and resolution quality when reading in documents for the specified document format.
This method should be called before the input document is read in using IMG_decompress_ bitmap(String, int) .
351 Chapter 19 - Class Snow.Snowbnd Methods
You can override RasterMaster Java’s default bits-per-pixel and DPI settings for the specified format using this method.
You can use this method to do the following:
l Set the input bits-per-pixel to 1 for black and white input to remove the extra overhead and performance costs of processing color images.
l Read in color or grayscale documents by setting a higher bits-per-pixel. Please see Appendix A, Supported File Formatsfor a current list of supported formats
l Increase your output image quality by increasing the input document DPI.
l Increase your processing throughput by decreasing the document DPI or bits per pixel.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The SilentPrint Sample
l Simple Conversion: The SimpleConvert Sample
l Batch Conversion: The BatchConvert Sample
l Single Conversion: The SingleConversion Sample
Note: The default is 200 dpi and 24 bits per pixel for PDF. The default is 300 dpi and 1 bit per pixel for PCL, AFP, Word, and Excel.
Syntax int IMGLOW_set_document_input(int dpi, int bits_pix, int format);
Remarks
Table 19.74: IMGLOW_set_document_input(int, int, int) Method Settings
Method Description Sets the input resolution in dots per inch. A higher dpi yields dpi a higher quality document that takes longer to process and takes up more memory and storage space. Sets the bits per pixel. 1 = black and white documents 8 = grayscale or color images bits_pix 24 = color images
See Appendix A, Supported File Formats for information on these and other pixel depths supported by each format. format Sets the format parameter. A file format number as
352 Chapter 19 - Class Snow.Snowbnd Methods
Method Description specified in Appendix A, Supported File Formatsi.e. Word (DOC) is 86.
Returns
Returns the status of document formats to be rendered in color or black and white. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_document_input(int, int, int, int, int)
This method sets the rendering parameters for the decompression of Office files. Office files are rendered as a bitmap at decompression time. These values allow you to set the dots per inch (DPI) and the bit pixel depth of the resulting bitmap.
Note: Currently this method only supports .xls and .xlsx files.
This method should be called before the input document is read in using IMG_decompress_ bitmap(String, int).
You can override RasterMaster Java’s default bits-per-pixel and DPI settings for the specified format using this method.
You can use this method to do the following:
l Set the input bits-per-pixel to 1 for black and white input to remove the extra overhead and performance costs of processing color images.
l Read in color or grayscale documents by setting a higher bits-per-pixel. Please see Appendix A, Supported File Formats for a current list of supported formats
l Increase your output image quality by increasing the input document DPI.
l Increase your processing throughput by decreasing the document DPI or bits per pixel.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the following samples:
l The SilentPrint Sample
l Simple Conversion: The SimpleConvert Sample
l Batch Conversion: The BatchConvert Sample
l Single Conversion: The SingleConversion Sample
353 Chapter 19 - Class Snow.Snowbnd Methods
Note: The default is 200 dpi and 24 bits per pixel for PDF. The default is 300 dpi and 1 bit per pixel for PCL, AFP, and Word.
Syntax int IMGLOW_set_document_input(int dpi, int bits_pix, int format, int width, int height);
Remarks
Table 19.75: IMGLOW_set_document_input(int, int, int, int, int) Method Settings
Method Description Sets the dots per inch in which to render the pcl file. A higher dpi yields a higher quality document that takes dpi longer to process and takes up more memory and storage space. Sets the bits per pixel. 1 = black and white documents bits_pix 24 = color images See Appendix A, Supported File Formats for information on these and other pixel depths supported by each format. Sets the format parameter. A file format number as format specified in Appendix A, Supported File Formats i.e. Word (DOC) is 86. width Sets the page width in inches (i.e. 8.5) height Sets the page height in inches (i.e. 11.0)
Returns
Returns the status of Office documents to be rendered in color or black and white. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_fast_convert(int, int)
This method greatly improves performance for decompression and conversion. Only call this function once per image. Call this method before any of the decompression methods in order to enable fast convert either from File I/O based or memory. To turn this method on, set the off_on value to 1. To reset this method, set the off_on value to 0.
354 Chapter 19 - Class Snow.Snowbnd Methods
This method makes the decompression methods non-reentrant or no longer thread safe when turned on.
Note: This method currently only works with MO:DCA or AFP images.
Syntax
int IMGLOW_set_fast_convert(int off_on, int format);
Remark
Table 19.76: IMGLOW_set_fast_convert(int, int) Method Variable
Variable Description 0 = Off off_on 1 = On format Applies fast convert to this input format.
Returns
Returns the status of the conversion. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_gamma(int)
This method sets a gamma correction factor which corrects for the gamma or response curve of the monitor. This can drastically improve the quality of some gray scale or 24-bit images.
Notes: Setting and saving the gamma factor permanently affects color and grayscale image data. This method has no effect on 1-bit images, except at display time if anti-alias is on, and alias = 2.
Syntax
int IMGLOW_set_gamma(int value);
Remark
Table 19.77: IMGLOW_set_gamma(int) Method Settings
Setting Description 0 No gamma correction.
355 Chapter 19 - Class Snow.Snowbnd Methods
Setting Description 100 Default gamma correction (1.00). 400 Maximum gamma correction (4.00).
Returns
Returns the status of the gamma correction factor which corrects for the gamma or response curve of the monitor. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_image_orientation(int)
This method sets the orientation flag before saving images to the TIFF format. Orientation changes the default display angle for the image.
See the TIFF 6.0 specification (http://www.adobe.com) for the meaning of the orientation flag.
Syntax int IMGLOW_set_image_orientation(int orient);
Remark
Table 19.78: IMGLOW_set_image_orientation(int) Method Variables
Variable Description Sets the image orientation
TIFF 1 = Rotated 0 degrees 2 = Flipped in the x direction 3 = Rotated 180 degrees 4 = Rotated 180 degrees and flipped in the x direction 5= Rotated 90 degrees and flipped in the x direction orient 6= Rotated 90 degrees 7 = Rotated 270 degrees and flipped in the x direction 8 = Rotated 270 degrees
CALS 0 = Rotated 0 degrees 90 = Rotated 90 degrees 180 = Rotated 180 degrees 270 = Rotated 270 degrees
Returns
356 Chapter 19 - Class Snow.Snowbnd Methods
Returns the status of the image orientation. A value of 0 or 1 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_jpg_interleave(int, int)
This method sets the JPEG interleave factor for writing JPEG images. This is the factor for decimating the blue and red chroma planes when writing out JPEG images.
Notes: To obtain the highest quality image, set both variables to a value of 1. (It does not skip any lines). The default, JPEG uses a 2:1 interleaving factor. It skips every other pixel in the X direction.
Syntax
int IMGLOW_set_jpg_interleave(int h_int, int v_int);
Remark
Table 19.79: IMGLOW_set_jpg_interleave(int, int) Method Variables
Variable Description Integer 1, 2, or 4. Specifies the number of horizontal pixels to h_int skip. You can specify up to the height of the file, but this is not recommended. Integer 1, 2, or 4. Specifies the number of vertical pixels to skip. v_int You can specify up to the width of the file, but this is not recommended.
Returns
Returns the status of the JPEG interleave factor for writing JPEG images. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_msg_render_preference(int)
This method sets the rendering preferences for Microsoft’s .MSG files. This preference is loose and may not actually take effect due to technical complications such as there is no data of that type within the .MSG file.
Syntax
357 Chapter 19 - Class Snow.Snowbnd Methods
int IMGLOW_set_msg_render_preferences(int preference);
Remark
Table 19.80: IMGLOW_set_msg_render_preferences(int) Method Variables
Variable Description Rendering data source preference for email body data. ASCII, Unicode, RTF, and HTML are recognized but may not preferences be all supported. Please seeSupported File Formats for the specific integer values.
Returns
Returns the status of the rendering preferences for Microsoft’s .MSG files. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
IMGLOW_set_overlay_path(String)
This method sets the path for finding overlay files. Some formats, such as MOD:CA, can contain references to overlay files. If set to null, overlay files will be ignored and only the bitmap will be decompressed.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the Single Conversion: The SingleConversion Sample sample.
Syntax int IMGLOW_set_overlay_path(String st);
Remark
Table 19.81: IMGLOW_set_overlay_path(String) Method Variables
Variable Description st Specify path of overlay file.
IMGLOW_set_pcl_input(int, int)
This method sets the rendering for PCL decompression. PCL files are rendered as a bitmap at decompression time. These values allow you to set the dots per inch and the pixel depth of the resulting bitmap.
Syntax int IMGLOW_set_pcl_input(int dpi, int bits_pix);
358 Chapter 19 - Class Snow.Snowbnd Methods
Remark
Table 19.82: IMGLOW_set_pcl_input(int dpi, int bit_pix) Method Variables
Variable Description dpi Dots per inch in which to render the pcl file. bits_pix Bitmap pixel depth. Set to 1 or 24.
IMGLOW_set_pdf_input(int, int)
This method allows the conversion of PDF files into bitmaps when decompressed by RasterMaster® SDK products. It allows the programmer to set the bitmap size and pixel depth of the resulting bitmap.
Note: When used for black and white PDF documents calling IMGLOW_set_pdf_input() set to a dpi of 200 and bits per pixel of 1, it provides optimal decompress and display performance. Also, it is ideal for TIFF Group 4 conversions.
Syntax
int IMGLOW_set_pdf_input(int dpi, int bits_pix);
Remark
Table 19.83: IMGLOW_set_pdf_input(int, int) Method Variables
Variable Description Dots per inch in which to render the PDF. Typical DPI is 300. dpi 1-bit images such as documents DPI is 200. Color images dpi is 100 or 200. Bitmap pixel depth for resulting rendered pdf image. Set to bits_pix 1, 8, or 24.
IMGLOW_set_pdf_output(int, int)
This method sets the destination size for saving PDF files. The xsize and ysize are the output sizes in points. A point is 1/72 of an inch. Only PDF, PCL, and AFP file formats can be saved. The PCL and APF file formats are saved as bitmap. The PDF file format can be saved as bitmap or searchable text.
Syntax
int IMGLOW_set_pdf_output(int xsize, int ysize);
359 Chapter 19 - Class Snow.Snowbnd Methods
Remark
Table 19.84: IMGLOW_set_pdf_output(int, int) Method Variables
Variable Description xsize Destination width of image after resizing. ysize Destination height of image after resizing.
IMGLOW_set_tiff_tag(int, int, int, byte[])
This method allows RasterMaster Java to write new and current tags. This method can be called multiple times for adding multiple tags to write.
Note: If you read in a TIFF file, RasterMaster Java does not save any of the tags. None of the tag data is saved except for the needed data such as bits per pix, height, and DPI. This is saved in the LPBITMAPINFOHEADER struct in RasterMaster Java's internal format. Any other tags are not preserved. You could read in the tags and data you need from a source TIFF, then set new tags and data before saving.
Setting thetag ID to -1 clears out all extra tags from being written to the file. It stores the previous values between calls. Then, set new tag values as shown in the following example:
Simage.IMGLOW_set_tiff_tag(-1,0,0,null);
Note: This method is not thread-safe. The tags are kept in static memory. The tags for TIFF files read in are not saved unless they are in the set needed to create a PDF file. Alternatively, the user can explicitly call IMGLOW_set_tiff_tag for each tag in the original TIFF. The thread-safe workaround is encapsulating the processing of one file in a synchronized block with a class object or a static member as a static lock.
Syntax int IMGLOW_set_tiff_tag(int tag, int max_bytes, int value, byte buff[]);
Remarks
Table 19.85: IMGLOW_set_tiff_tag(int, int, int, byte[]) Method Variables
Variable Description tag ID of tag to write.
360 Chapter 19 - Class Snow.Snowbnd Methods
Variable Description max_bytes Total size of tag value or data in bytes. value Integer value for a tag size of 4 bytes. Data binary or ASCII to write if tag size is greater than 4 buff bytes.
IMGLOW_set_UTF_8(int)
This method forces all files being decompressed to process as a UTF file. UTF-8 (8-bit USC/Unicode Tranformation Format) is a variable-length character encoding for Unicode. UTF allows double byte characters.
Syntax
int IMGLOW_set_UTF_8(int mode);
Remarks
Table 19.86: IMGLOW_set_UTF_8(int) Method Variables
Variable Description 0 = Turns off UTF processing. mode 1 = Turns on UTF processing.
IMGLOW_write_tiff_stream(Dib_Head lpbi, byte, int, int, String)
This method is used to create a TIFF file with existing compressed data. The header information is passed as the Dib_Head class containing the width, height, and bits per pixel of the image to create.
Syntax
int IMGLOW_write_tiff_stream(Dib_Head lpbi, byte data_stream[], int data_size, int file_type, String bm_name);
Remarks
Table 19.87: IMGLOW_write_tiff_stream(Dib_Head lpbi, byte data_stream [],int data_size, int file_type, String bm_name) Method Variables
Variable Description lpbi The header information structure. data_stream[] Byte array of compressed data.
361 Chapter 19 - Class Snow.Snowbnd Methods
Variable Description data_size Size of the data_stream compressed stream of bytes. Type of compressed data in stream. Possible types:
TIFF_COMP_NONE = 1, no compression TIFF_COMP_GIII = 2, modified huffman group 3 TIFF_COMP_GIIIP = 3, modified huffman group 3 padding TIFF_COMP_G4 = 4, modified huffman group 4 file_type TIFF_COMP_LZW = 5, lzw compression TIFF_COMP_PACK = 32773, pack bits compression TIFF_COMP_JPEG = 6, JPEG compression TIFF_COMP_JPEG_GRAY = 7, JPEG compression 8 bit gray scale TIFF_COMP_G4_FO = 4000, modified huffman group 4 TIFF_COMP_JBIG = 34661, JBIG format bm_name Name of output tiff file to create. map_image_to_wnd(java.awt.Container, java.awt.Point)
This method converts image coordinates to screen coordinates for the currently displayed image. This is useful for converting mouse coordinates on the image to screen coordinates, as in creating a selection rectangle (rubber-band zoom).
Syntax void map_image_to_wnd(java.awt.Container sf, java.awt.Point pt);
Remark
Table 19.88: map_image_to_wnd(java.awt.Container, java.awt.Point) Method Variables
Variable Description sf Container for displayed image. pt Point to be mapped. map_wnd_to_image(java.awt.Container, java.awt.Point)
This method converts screen coordinates to image coordinates. This is valid only for the currently displayed image. This is useful for converting mouse coordinates on the screen to image coordinates, as in creating a selection rectangle (rubber-band zoom).
Syntax void map_wnd_to_image(java.awt.Container sf, java.awt.Point pt);
362 Chapter 19 - Class Snow.Snowbnd Methods
Remark
map_wnd_to_image(java.awt.Container, java.awt.Point) Method Variables
Variable Description sf Container for displayed image. pt Point to be mapped.
set_croprect(int, int, int, int)
This method sets the cropping rectangle for the display engine. Only the area of the image inside the current crop rectangle displays. Compare this to IMG_display_bitmap_aspect in which the zoom parameter simply sets the current crop rectangle.
See IMG_display_bitmap_aspect(java.awt.Graphics, java.awt.Container, int, int, int, int, int) for more information.
See IMG_erase_rect(int, int, int, int, int, int, int) for more information.
Syntax
int set_croprect(int xs, int ys, int xe, int ye);
Remark
Table 19.89: set_croprect(int, int, int, int) Method Variables
Variable Description xs Starting X position for cropping the image. ys Starting Y position for cropping the image. xe Horizontal size of cropped rectangle in pixels. ye Vertical size, of cropped rectangle in pixels.
Returns
Returns the status of the cropping rectangle for the display engine. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
set_croprect_scroll(java.awt.Container, int, int, int, int, int)
This method sets the rectangular area of an image to display and also sets up scrollbars. Scrollbars are turned on if the size of the cropping rectangle is smaller than the height and/or width of the image.
363 Chapter 19 - Class Snow.Snowbnd Methods
Syntax int set_croprect_scroll(java.awt.Container sf, int xs, int ys, int xe, int ye, int aspect);
Remark
Table 19.90: set_croprect_scroll(java.awt.Container, int, int, int, int, int) Method Variables
Variable Description sf Container for the displayed image. xs Starting X position for cropping the image. ys Starting Y position for cropping the image. xe Horizontal size in pixels of the cropping rectangle. ye Vertical size in pixels of the cropping rectangle. 1 = preserve the aspect ratio of cropped rectangle. aspect Any other value stretches the image.
Returns
Returns the status of the new zoom value. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Example 19.25: set_croprect_scrollSample
public void mouseReleased(MouseEvent e) { Point pt,pt2; if (select) { snbd_draw_pen(); pt = new Point(); pt2 = new Point(); pt.x = selrect.x; pt.y = selrect.y; Simage.map_wnd_to_image(this,pt); pt2.x = selrect.x + selrect.width; pt2.y = selrect.y + selrect.height; Simage.map_wnd_to_image(this,pt2); if(pt.x > pt2.x) { selrect.x = pt.x; pt.x = pt2.x; pt2.x = selrect.x; } if(pt.y > pt2.y) {
364 Chapter 19 - Class Snow.Snowbnd Methods
selrect.y = pt.y; pt.y = pt2.y; p t2.y = selrect.y; } zoom = Simage.set_croprect_scroll(this, pt.x, pt.y, pt2.x pt.x, pt2.y pt.y,1); if (zoom <0) zoom = 0; cropped = 1; select = false; selrect = null; repaint(); } }
setFrame(java.awt.Container)
This method sets the destination container for image display.
Note: This method must be called prior to decompressing PTOCA or ASCII files.
Syntax
void setFrame(java.awt.Container c);
Remark
Table 19.91: setFrame(java.awt.Container) method variable descriptions.
Variable Description c Container of displayed image (usually "this").
setXdpi(int)
This method sets the resolution, in DPI (dots per inch, 1/72nd of an inch), along the X-axis of an image. The value is saved in the image.
Note: If an image’s resolution is not explicitly set, the resolution is now specified as 0 dots per inch (DPI). In older versions, it was set as 100 DPI. To avoid errors or unexpected behavior, set the resolution of the image explicitly when saving in the setXdpi(int) and setYdpi(int) methods.
365 Chapter 19 - Class Snow.Snowbnd Methods
Syntax int setXdpi(int dpi);
Returns
Returns the status of he resolution, in DPI (dots per inch, 1/72nd of an inch), along the X-axis of an image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes. setYdpi(int)
This method sets the resolution, in DPI (dots per inch, 1/72nd of an inch), along the Y-axis of an image. The value is saved in the image.
Note: If an image’s resolution is not explicitly set, the resolution is now specified as 0 dots per inch (DPI). In older versions, it was set as 100 DPI. To avoid errors or unexpected behavior, set the resolution of the image explicitly when saving in the setXdpi(int) and setYdpi(int) methods.
Syntax int setYdpi(int dpi);
Returns
Returns the status of he resolution, in DPI (dots per inch, 1/72nd of an inch), along the X-axis of an image. A value of 0 indicates success. Any value less than zero is a Snowbound error code. See Appendix D, Snowbound Error Codes for a list of error codes.
Snowbnd(int, int, int)
This is an alternate constructor for the Snowbnd object. This allows the creation of a blank image with allocated memory.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the Simple Conversion with Timeouts: The HangDetector Sample sample.
Syntax
Snowbnd(int xsize, int ysize, int bits_pix);
Remark
366 Chapter 19 - Class Snow.Snowbnd Methods
Table 19.92: Snowbnd(int, int, int) Method Variables
Variable Description xsize Width of blank bitmap to create. ysize Height of bitmap to create. bits_pix Pixel depth of bitmap to create. Can be set to 1, 8, or 24.
Snowbnd(Snowbnd)
This is an alternate constructor that creates a new Snowbnd object by copying the contents of an existing Snowbnd object.
You can find the samples for using this method in the following directory: [RM Java install dir]\Samples\com\snowbound\samples. This method is used in the Single Conversion: The SingleConversion Sample sample.
Syntax
Snowbnd(Snowbnd toCopy);
Remark
Table 19.93: Snowbnd(Snowbnd) Method Variables
Variable Description toCopy Existing Snowbnd object.
367 Appendix A - Supported File Formats
Appendix A - Supported File Formats
This appendix describes the file type number and read/write capabilities of all supported file formats.
RasterMaster is a powerful conversion tool that can transform your documents and images into many different formats. Some format types are limited in the amount of color (bit-depth) they support in an image. Some file formats read and write only black and white (1-bit deep) and other file formats support only color images (8+ bits deep). For many of these cases, RasterMaster Java automatically converts the pixel depth to the appropriate value, based on the output format specified. The chart below will help you determine whether your black and white or color document will be able to convert straight to the desired output format with no additional processing.
You can open a document in almost any supported input format by using IMG_decompress_ bitmap(String, int). You do not have to pass in the format type, it is automatically recognized. You can save a document to almost any supported output format by using IMG_save_bitmap (byte, int). You pass the format type number from the chart below to indicate the format you want. Please see Chapter 3, Convert and Save Methods for more details.
Table A.1: File Format Key
File Format Description 1-bit Black and white or monochrome images Grayscale images, that may appear to be black and white, 4-bit, 8-bit, 16-bit but contain much more information, and are much larger than 1-bit. 8-bit, 16-bit, 24-bit, 32-bit Full color images
When saving to a format, if the error returned is PIXEL_DEPTH_UNSUPPORTED (-21), the output format does not support the current bits per pixel of the image you are trying to save. The chart below will help you identify formats with compatible bit depths.
If you need to convert to a format with a higher or lower pixel depth, please see Color Manipulation Methods for ways to convert the image to a higher or lower pixel depth.
Please note that the higher the bit depth (bits per pixel), then the larger the size of the image on the disk or in memory. The higher bit depth may offer more quality, but the performance may suffer because there is a lot more image data to process. Many users may have images that appear to be black and white, however, they are stored in 24-bit color. Converting these documents to a 1-bit file format will decrease the size of the file and improve performance with no perceivable loss in quality.
If you have any questions about what format to select you may contact Snowbound Technical support on the web at http://support.snowbound.com. We do our best to support product and document specifications and and to work in common platform environments, however there are always exceptions. If you find an exception please contact Snowbound Support to let us know about it.
368 Appendix A - Supported File Formats
Descriptions of Supported File Formats
You can find out the format of any file by calling IMGLOW_get_filetype(String). It will return a file type number which you can look up in Supported File Format Descriptions .
You can find the bit depth/bits per pixel of your image by calling getBitsPerPixel(void) and looking at the value in biBitCount.
Table A.2: Supported File Format Descriptions
File Input Bit Output Bit File Format Type Description Depth Depth Number AFP (MO:DCA) *74 1, 24 1 See MO:DCA. Snowbound reads in ASCII text files ASCII 38 1 No and converts them to a bitmap. BMP_ Originated by Microsoft, BMP 12 4, 8 4, 8 COMPRESSED supports 1, 4, 8, and 24-bit images. BMP_ 1, 4, 8, 16, Originated by Microsoft, BMP UNCOMPRESS-1 1, 4, 8, 16, 24 24 supports 1, 4, 8, and 24-bit images. ED BROOK_ 29 1 1 Brooktrout FAX format. TROUT CALS 18 1 1 Government specified format. Group 3 compression for bitonal (1- CCITT_G3 33 1 No bit) image data. Group 3 compression for bitonal (1- CCITT_G3_FO 53 1 No bit) image data. Group 4 compression for bitonal (1- CCITT_G4 34 1 No bit) image data. Group 4 compression for bitonal (1- CCITT_G4_FO 52 1 No bit) image data. Compact Font Format is a lossless compaction of the Type 1 format using Type 2 charstrings. It is designed to use less storage space than Type 1 fonts by using operators CFF 83 1 , 8, 24 1 , 8, 24 with multiple arguments, various pre- defined default values, more efficient allotment of encoding values and shared subroutines within a FontSet (family of fonts). Check Image Management System. CIMS (ABIC) 80 1 1 Developed by Carreker. Same as ABIC. CLIP 27 1, 4, 8, 24 1, 4, 8, 24, 32 Microsoft Windows clipboard format. COD 83 1 1 , 8, 24 Liberty IMS black and white format.
369 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number COD 72 1 No Liberty IMS black and white format. Cut images are only 8 bits per pixel and the palette is stored in a CUT 31 8 No separate file. Originated by Media Cybernetics. The DCS format is a standard Quark DCS 62 32 32 Express Format. Each plane is stored as an EPS record. Intel created this format as a multi- page .PCX format. Each page is a DCX 11 1, 4, 8, 24 1, 4, 8, 24 .PCX file in whole which can be 1, 4, 8, and 24-bit. Standard Windows Device Independent Bitmap. Supports 1, 4, DIB 48 1, 4, 8, 24 No 8 and 24-bits. This is a multi-page file format. Medical image format supporting 1, DICOM 55 8, 16, 24 No 12, 16, and 24 pixel images. Microsoft Word format. Supports Microsoft Word 97, version 8 or later. Supports 1-bit images. Cannot decompress (view) document while open in MS Word. The following features have not yet been implemented: right-to-left text flow, underlined URLs, section and DOC * 86 1, 8, 24, 32 No paragraph borders and shading, text boxes, multi-column paragraph, Windows Meta Files (WMF) clip art, autoshapes, and embedded OLE objects. Inconsistencies exist between MS Word and the Word plugin with regards to character and line spacing. Reading support only. This is a multi-page file format. The .docx format is part of a family of open office XML-based formats developed by Microsoft. It is the default document format for saving DOCX * 93 1, 8, 24, 32 No applications in Microsoft Word starting with Office 2007. It is based on XML rather than Microsoft’s .doc format. Reading support only. This is a multi-page file format.
370 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number Autodesk® AutoCAD® format. Used for computer aided design DWG 90 No 24 (CAD) data and metadata. The DWG format can be read in the VirtualViewer .NET Content Server. Autodesk® AutoCAD® format. Used for computer aided design (CAD) data and metadata. See the following, for the full specification: DXF 91 No 24 http://usa.autodesk.com/adsk/servl- et/ item?siteID=123112&id=8446698 The DWG format can be read in the VirtualViewer .NET Content Server. Encapsulated Postscript originated by Adobe. Postscript is an interpreted language. Snowbound EPS (preview) 14 1, 4, 8, 24 1, 8, 24, 32 does not support full Postscript but will extract an embedded .TIF file in the image. Sometimes called a bitmap representation file. EPS Compressed bitmap format. It is an Adobe encapsulated Postscript EPS_BITMAP 86 1, 8, 24, 32 No file with either G4 or JPEG data embedded. EPS Compressed bitmap format. It is an Adobe encapsulated Postscript EPS_BITMAP 63 8, 24, 32 1, 8, 24, 32 file with either G4 or JPEG data embedded. EPS Compressed bitmap format. It EPS_BITMAP_ is an Adobe encapsulated Postscript 64 8, 24, 32 1, 8, 24, 32 G4 file with either G4 or JPEG data embedded. EPS Compressed bitmap format. It EPS_BITMAP_ is an Adobe encapsulated Postscript 69 8, 24, 32 1, 8, 24, 32 LZW file with either G4 or JPEG data embedded. Microsoft Excel Spreadsheet format for structuring and analyzing data. This is the binary file format used by EXCEL * 84 1, 8, 24, 32 No Microsoft Excel 97, Microsoft Excel 2000, Microsoft Excel 2002, and Microsoft Office Excel 2003. Reading support only.
371 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number Image format developed by FileNET FileNet 78 1 1 Corporation for viewing documents. 24-bit tiled JPEG format that FLASHPIX 54 8, 24 No includes multiple resolution images. Created by CompuServe for 2, 3, 4, 5, 6, compressing 2, 3, 4, 5, 6, 7, and 8-bit GIF 4 4, 8 7, 8 palette images. Uses the LZW algorithm. GIF_ 1, 2, 3, 4, 5, Same as GIF except stores the 44 4, 8 INTERLACED 6, 7, 8 raster data in an interlaced order. Originated by Brightbill Roberts for ShowPartner DOS applications. GX2 22 4, 8 No Supports 4 and 8-bit images. Simple run length encoding technique. Hyperlink Text Markup Language (HTML) is a tag-based language used to create documents for the HTML * 82 No 24 Web. HTML forms are often used to capture information from web sites. Full HTML, Javascript and CSS support. Microsoft icon format. Contains a standard device independent bitmap. ICONTYPE 25 1, 4 No Supports 1 and 4 bits uncompressed. Used on the Commodore Amiga computers for native bitmap format. IFF_ILBM 26 1, 4, 8, 24 1, 4, 8, 24 Uses a run length format for 1, 4, and 8-bit palette images. Originated by Digital Research for IMG 28 1 No storing 1-bit images. IMNET 42 1 No IMNET G4 compressed format. Image Object Content Architecture. IOCA (MO:DCA) IBM format which uses CCITT G3, 24 1, 24 1 * G4, and IBM MMR formats. 1-bit only. This is a multi-page file format. Joint bi-level Image Experts Group. This is a highly compressed format JBIG 71 1 1 which is stored in a TIFF header. It supports 1 or 8-bit gray scale images. JBIG2 is a highly-compressed black JBIG2 77 1 No and white image format that uses
372 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number symbol recognition and substitution for very dramatic compression results. Snowbound's viewers and conversion programs can be used to directly view JBIG2 documents or convert those documents to a variety of output formats. US Military CCITT G4 tiled image format for storing Government JEDMICS 56 1 No documents and drawings. Supports 1-bit per pixel. Joint Photographics Experts Group. This was a group spearheaded by Kodak for 24, 32, and 8-bit gray JPEG 13 8, 24, 32 8, 24, 32 scale lossy compression. This is by far the best compression available for these types of images supported in the current Snowbound library. JPEG 2000 specification. This is similar to JPEG but produces much 8, 24 (with better compression with better JPEG2000 70 No plugin) quality. It is supported as a separate plugin. An option exists to set the compression level for saving. KOFAX 23 1 No Kofax Format. Compression for documents LASER_DATA 19 1 No originated by LaserData Corp. 1-bit images only. Presents data for each variable on a LINE_DATA 75 1 1 single line. Original Apple bitmap file format. All MACPAINT 21 1 No MacPaint images are 720 x 576 pixels 1 bit. MAG 61 1 No Mag Format. Modified Modified Read. By IBM MO:DCA * 49 1, 24 1 Image Plus. File format for black and white documents. E-mail message created with MS MSG * 89 1 1 Outlook. Microsoft Paint program bitmap file format. Supports 1-bit images. Uses MSP 30 1 No a type of RLE compression found also in compressed .BMP files. NCR 65 1 No A simple header with CCITT group 4
373 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number data. Open Document Format is an XML- based file format for representing ODF 98 No No electronic documents such as spreadsheets, charts, presentations and word processing documents. Open Document Format for ODP 101 No No presentations. Open Document Format for ODS 97 No No spreadsheets. Open Document Format for word ODT 96 No No processing (text) documents. Office Open Extended Markup Language or Office Open XML (also informally known as OOXML or OpenXML) is a zipped, XML-based file format developed by Microsoft OOXML 94 No No for representing spreadsheets, charts, presentations and word processing documents that is intended for use with the 2007 and later versions of the Microsoft Office suite. Hewlett Packard printer file format. Support for color and grayscale PCL_1 (without 57 No 1 output. Supported as a separate plugin) plugin. This is a multi-page file format. Hewlett Packard printer file format. Support for color and grayscale PCL_5* 76 No 1 output. This is a multi-page file format. Zsoft bitmap file format. Similar to PCX(optional) 2 1, 4, 8, 24 1, 4, 8, 24 pack bits compression. Supports 1, 4, 8, and 24-bit images. Portable Document Format. File format developed by Adobe to capture formatting information from a PDF(with plugin) 1, 2, 4, 8, 59 1, 24 variety of desktop publishing * 16, 24, 32 applications. It allows the user to send formatted documents and have them appear on the recipient's
374 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number PDF v1.4. Does not currently support JPEG2000 in PDF for Java. Supports some types of Adobe specified PDF annotations, however does not support XFA annotations. Does not support corrupt PDF documents. Snowbound Software requires that the fonts needed be available on the system. This is a multi-page file format. Portable Document Format. File format developed by Adobe to capture formatting information from a variety of desktop publishing applications. It allows the user to send formatted documents and have them appear on the recipient's monitor or printer as they were intended. Compatible with the PDF (without PDF/A specification and conforms 59 No 1, 24 plugin) to PDF v1.4. Does not currently support JPEG2000 in PDF for Java. Supports some types of Adobe specified PDF annotations, however does not support XFA annotations. Does not support corrupt PDF documents. Snowbound Software requires that the fonts needed be available on the system. This is a multi-page file format. Portable Document Format. File format developed by Adobe to capture formatting information from a variety of desktop publishing applications. It allows the user to send formatted documents and have them appear on the recipient's PDF_15 79 No 1, 24 monitor or printer as they were intended. Compatible with the PDF/A specification and conforms to PDF v1.4. Does not currently support JPEG2000 in PDF for Java. Supports some types of Adobe specified PDF annotations, however
375 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number does not support XFA annotations. Does not support corrupt PDF documents. Snowbound Software requires that the fonts needed be available on the system. This is a multi-page file format.
Note: Only supported with RasterMaster .NET or RasterMaster DLL. This format is not yet supported in Rastermaster Java. Portable Document Format. File format developed by Adobe to capture formatting information from a variety of desktop publishing applications. It allows the user to send formatted documents and have them appear on the recipient's monitor or printer as they were intended. Compatible with the PDF/A specification and conforms to PDF v1.4. Does not currently support JPEG2000 in PDF for PDF_16 92 No 1, 24 Java.Supports some types of Adobe specified PDF annotations, however does not support XFA annotations. Does not support corrupt PDF documents. Snowbound Software requires that the fonts needed be available on the system. This is a multi-page file format.
Note: Only supported with RasterMaster .NET or RasterMaster DLL. This format is not yet supported in Rastermaster Java. Portable Document Format. File format developed by Adobe to capture formatting information from a variety of desktop publishing PDF_LZW 88 No 1, 24 applications. It allows the user to send formatted documents and have them appear on the recipient's monitor or printer as they were intended. Compatible with the
376 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number PDF/A specification and conforms to PDF v1.4. Does not currently support JPEG2000 in PDF for Java.Supports some types of Adobe specified PDF annotations, however does not support XFA annotations. Does not support corrupt PDF documents. Snowbound Software requires that the fonts needed be available on the system. This is a multi-page file format. Kodak photo CD format. Supports only 24-bit images. This format contains at least 5 images. Get these images as you would a multi- page file format.
Page 0 - 768 x 512
Page 1 - 384 x 256
Page 2 - 192 x 128
Page 3 - 1536 x 1024 PHOTOCD 39 24 No Page 4 - 3072 x 2048
Images are uncompressed until the 1536 x 1024 images or greater. All images are stored as YCC data which is luminance then blue and red chrominance channels. The large image must be built from the smaller images by interpolation then adding the residual data stored by Huffman encoding. Adobe Photoshop format for storing 1, 4, 8, 16, 24, and 32-bit images. 1, 4, 8, 24, PHOTOSHOP 41 1, 8, 24, 32 Can be compressed or 32 uncompressed. Images may also be stored as CMYK data or RGB. Apple Macintosh bitmap file format. These images may contain vector 1, 2, 4, 8, information such as lines and PICT 15 1, 4, 8, 24 16, 24, 32 circles. Only the bitmap portion of data is decompressed. Uses pack bits compression. Supports 1, 2, 3,
377 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number 4, 8, 16, 24, and 32-bit images. Microsoft PowerPoint Binary File Format which is the binary file format used by Microsoft PowerPoint 97, POWER_POINT Microsoft PowerPoint 2000, 85 1, 8, 24, 32 No * Microsoft PowerPoint 2002, and Microsoft Office PowerPoint 2003. Reading support only. This is a multi-page file format. Originated by CompuServe to replace the .GIF file format. Uses 1, 4, 8, 16, the Huffman encoding variant. PNG (optional) 43 1, 4, 8, 16, 24 24, 32 Supports 1, 4, 8, 15, 16, 24, and 32- bit images. Also supports interlaced and transparency. The .pptx format is part of a family of open office XML-based formats developed by Microsoft. It is the default document format for saving applications in Microsoft PowerPoint PPTX * 100 1, 8, 24, 32 No starting with Office 2007. It is based on XML rather than Microsoft's .ppt format. Reading support only. This is a multi-page file format. Supported on Java 7. Sun raster format. Supports 1, 8, 24, RAST 59 No 1, 24 and 32-bits. Run length encoded format. Sun raster format. Supports 1, 8, 24, RAST 37 1, 8, 24 1, 8, 24 and 32-bits. Run length encoded format. The Rich Text Format is a method of encoding formatted text and RTF * 87 1, 8, 24, 32 No graphics for easy transfer between applications. The SCITEX format is a proprietary format originated from SCITEX SCITEX 60 24, 32 24, 32 Corporation. Gray scale color and CMYK color images. Usually compressed. The SCITEX format is a proprietary TARGA 3 8, 16, 24, 32 8, 16, 24, 32 format originated from SCITEX Corporation. TARGA16 32 16 24, 32 The SCITEX format is a proprietary
378 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number format originated from SCITEX Corporation. Tagged image file format. Created by an independent group and was supported by Aldus. .TIF files can be any number of bits per pixel, planes and several compression algorithms. The byte order may be Intel or Motorola format. The bytes may also TIFF_2D 17 1 No be filled from right to left or left to right. Compression may be uncompressed, pack bits, LZW, modified Huffman, CCITT G4, CCITT G3, CCITT G3-2D or JPEG. The CCITT G4 file format only saves to black and white. This is a multi- page file format. TIFF file with Arithmetic Binary encoding. Requires a special ABIC version of our tools. Very popular for TIFF_ABIC 46 4, 8 No check imaging. BW is used for 1-bit bi-level and TIFF_ABIC is for 4-bit gray scale images. This is a multi- page file format. TIFF file with Arithmetic Binary encoding. Requires a special ABIC version of our tools. Very popular for TIFF_ABIC_BW 47 1 No check imaging. BW is used for 1-bit bi-level and TIFF_ABIC is for 4-bit gray scale images. This is a multi- page file format. ANSI baseline Group 3 or Group 4 TIFF_G3_FAX 8 1 1 compression embedded in a TIFF. This is a multi-page file format. ANSI baseline Group 3 or Group 4 TIFF_G4_FAX 10 1 1 compression embedded in a TIFF. This is a multi-page file format. ANSI baseline Group 3 or Group 4 TIFF_G4_FAX_ 51 1 1 compression embedded in a TIFF. FO This is a multi-page file format. ANSI baseline Group 3 or Group 4 TIFF_G4_FAX_ 67 No 1 compression embedded in a TIFF. STRIP This is a multi-page file format. TIFF_ 7 1 No TIFF file compressed using the
379 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number Huffman compression algorithm. This is a multi-page file format. TIFF_JPEG If you have Standard ansi baseline JBIG issues viewing, 40 8, 24 8, 24, 32 compression embedded in a TIFF. please see Appendix E, This is a multi-page file format. Troubleshooting. Black and white gray scale format. TIFF_JPEG7 73 1, 8 1, 8 This is a multi-page file format. TIFF file compressed using the LZW compression algorithm. The LZW 1, 4, 8, 24, TIFF_LZW 9 1, 4, 8, 24 algorithm includes the look-up table 32 of codes as part of the compressed file. This is a multi-page file format. Simple run length encoding 1, 4, 8, 16, TIFF_PACK 16 1 algorithm. This is a multi-page file 24, 32 format. TIFF 1, 2, 4, 8, Uncompressed raw binary data. This UNCOMPRESS-0 1, 4, 8, 24 16, 24, 32 is a multi-page file format. ED Windows file format for wireless WBMP 68 1 1 devices. A simple header with CCITT group 3 WINFAX 58 1 No compression. Microsoft Windows Metafile format. These may contain vector information such as lines and circles. Only the bitmap data is WMF 6 1, 4, 8, 24 1, 4, 8, 16, 24, 32 extracted. This is in the form of a standard windows DIB. May be 1, 4, 8, and 24-bit. The 4 and 8-bit images may be compressed using Microsoft RLE compression as in .BMP files. WordPerfect’s metafile format. This is similar to the WMF file format in that it may contain vector WPG 5 1, 4, 8, 24 1, 4, 8 information. Supports 1, 4, 8, and 24- bit images. Only the bitmap data is extracted. Xwindows file format which encodes XBM 20 1 1 each pixel as an ASCII byte. Only supports 8-bits per pixel. Xerox_EPS 45 1 No Encapsulated Postscript for Xerox.
380 Appendix A - Supported File Formats
File Input Bit Output Bit File Format Type Description Depth Depth Number The .xlsx format is part of a family of open office XML-based formats developed by Microsoft. It is the default document format for saving XLSX * 95 1, 8, 24, 32 No applications in Microsoft Excel starting with Office 2007. It is based on XML rather than Microsoft's .xls format. Reading support only. This is a multi-page file format. Xwindows bitmap file format stored XPM 35 1, 4, 8 8 as ASCII data. Each pixel is stored as an ASCII byte. UNIX XWD Raster format. Each XWD 36 1, 4, 8 1, 8, 24, 32 pixel is stored as an ASCII byte.
* = Optional Only
File Type Constants Listed by File Type Number
Table A.3: File Type Constants listed by File Type Number
File Type Number File Type Name 0 TIFF_UNCOMPRESSED 1 BMP_UNCOMPRESSED 2 PCX 3 TARGA 4 GIF 5 WPG 6 WMF 7 TIFF_HUFFMAN 8 TIFF_G3_FAX 9 TIFF_LZW 10 TIFF_G4_FAX 11 DCX 12 BMP_COMPRESSED 13 JPEG 14 EPS 15 PICT 16 TIFF_PACK 17 TIFF_2D 18 CALS 19 LASER_DATA 20 XBM
381 Appendix A - Supported File Formats
File Type Number File Type Name 21 MACPAINT 22 GX2 23 KOFAX 24 IOCA 25 ICONTYPE 26 IFF_ILBM 27 CLIP 28 IMG 29 BROOK_TROUT 30 MSP 31 CUT 32 TARGA16 33 CCITT_G3 34 CCITT_G4 35 XPM 36 XWD 82 HTML 37 RAST 38 ASCII 39 PHOTOCD 40 TIFF_JPEG 41 PHOTOSHOP 42 IMNET 43 PNG 44 GIF_INTERLACED 45 Xerox_EPS 46 TIFF_ABIC 47 TIFF_ABIC_BW 48 DIB 49 MO:DCA_IOCA 51 TIFF_G4_FAX_FO 52 CCITT_G4_FO 53 CCITT_G3_FO 54 FLASHPIX 55 DICOM 56 JEDMICS 57 PCL_1 58 WINFAX 59 PDF 60 SCITEX 61 MAG 62 DCS 63 EPS_BITMAP 64 EPS_BITMAP_G4
382 Appendix A - Supported File Formats
File Type Number File Type Name 65 NCR 66 TIFF_JBIG 67 TIFF_G4_FAX_STRIP 68 WBMP 69 EPS_BITMAP_LZW 70 JPEG2000 71 JBIG 72 COD 73 TIFF_JPEG7 74 AFP 75 LINE_DATA 76 PCL_5 77 JBIG2 78 FILENET 79 PDF_15 80 CIMS 81 CIFF 82 HTML 83 CFF 84 EXCEL 85 POWER_POINT 86 DOC 87 RTF 88 PDF_LZW 89 MSG 90 DWG 91 DXF 92 PDF_16 93 DOCX 94 OOXML 95 XLSX 96 ODT 97 ODS 98 ODF 100 PPTX 101 ODP
383 Appendix B - Software Installation
Appendix B - Software Installation
This appendix describes how to install the evaluation or full copy of the RasterMaster JavaK software.
Overview of the Installation Process
RasterMaster Java is easy to install as an evaluation, developer, or run-time version. The evaluation copy is delivered as a .zip archive that can be manually extracted to an installation directory chosen by the user.
You can get an evaluation by contacting a member of our sales team at [email protected] or 1-617-607-2010. The evaluation copy expires at the end of each month.
Both the developer and runtime version of theRasterMaster Java ship as fully serialized builds which are very easy to install. This product is fully enabled as either a developer or runtime product.
RasterMaster Java is delivered as a .zip archive that can be manually extracted to an installation directory chosen by the user. For example: C:\Program Files\Snowbound\RMJava13 directory
Note: For RasterMaster Java, Snowbound requests that you place all Snowbound components in a non-common directory within Windows. They should NOT be placed in the \windows or \windows\system32\ directory or other such common area.
When a developer's license is purchased, a Developer’s Version banner appears. You must interactively select the notification box for the program to continue. Contact sales if you need to eliminate this notification for your development purposes.
When a distribution license is purchased, all banners disappear.
Notes: You are running an evaluation version of the software if an evaluation banner appears on the screen. Contact support at ([email protected]) for help with these issues. If you download an update or receive one from Snowbound technical support, please ensure that you obtain a serialized version of the product before you go into distribution.
What to Expect When Installing an Evaluation Version
Your evaluation is a full version of the product with the following limitations:
384 Appendix B - Software Installation
l You will see a pop up banner when you view or convert your first document. Subsequent documents in the same session will not elicit the banner.
l You will see large thin Xs across each page after the first 50 pages or thumbnails.
l After your expiration date, you will see a banner stating the evaluation has expired. You will not see any output.
Other than that you will have full use of the product including support for all document formats.
What to Expect in a Production Version
When you purchase the RasterMaster Java, you will receive a set of fully licensed binary files. The files will include Snow.jar for each purchased option. Please see Installed Files for a list of the files installed with RasterMaster Java.
Installing the Production Version of RasterMaster Java
Install and configure the evaluation version of the product on your target production system. Ensure it is working as you intended. Extract the binary files from the production version package and use those to replace the same files in the evaluation version that you have installed. Once the production files are in place, you will no longer see banners or Xs. You will only see expiration messages if you try to view a document of a type that you did not purchase, for example MS Office or AFP/MO:DCA.
Installing the Software
The instructions below describe how to install RasterMaster Java.
To install the RasterMaster Java:
Use WinZip or another utility to extract the files to a location such as the following: C:\Program Files\Snowbound\RMJava13 directory.
Directory Structure
After extracting the flies, the directory structure should be the following: RMJava13 Documentation Images Marketing Office 2007-2010 Samples SupportCode
385 Appendix B - Software Installation
Snow.jar: For more information, please see Snow.jar File.
JWebEngine.jar: For more information, please seeJWebEngine.jar File.
CMap_all.jar: For more information, please see Cmap-all.jar File.
Installed Files
This section describes the files that are installed during the Java Imaging SDK installation. The main installation directory is RMJava13. For example, if you install the version 13 All Java, the directory should be RMJava13. There are also Documentation, Images, Marketing, Samples, Support Code and Office 2007-2010 subdirectories.
Documentation Directory Files
The files installed into the Documentation directory are defined in Table B-1.
Table B.1: RasterMaster Java Documentation Directory Files
File Description install_instructions-component.pdf Snowbound Software component installation instructions. Open Source Software Licenses Open source software license agreement bundled with Used With Certain Snowbound Snowbound Software products. Products.pdf RMJavaPlatformProgrammersGuid- Complete Java programmers guide. e.pdf RMJavaPlatformReleaseNotes.pdf Java Release Notes.
Images Directory Files
The Images directory files contains sample images.
Marketing Directory Files
The files installed into the Marketing directory are defined in Table B-2.
Table B.2: RasterMaster Java Marketing Directory Files
File Description Provides an overview of Snowbound Software including CompanyOverview.pdf company facts, products, and formats. Provides an overview of Snowbound Software’s RasterMasterOverview.pdf RasterMaster Javaproducts.
Samples Directory Files
The Samples directory is described in Table B-3. For more information, about each sample, please see RasterMaster Java Samples.
386 Appendix B - Software Installation
Table B.3: RasterMaster Java Imaging SDK Samples Directory
Sample Description Demonstrates a variety of image manipulations, such as altering the viewable size, changing the orientation, viewing and annotations changing the size and resolution, making corrections, and flipping through pages of a multi-page file. See Viewing and Annotating Documents for more information. Contains common code shared by the RasterMaster Java common samples. A batch conversion program that converts images from an convert input to an output directory. See Single Conversion: The SingleConversion Sample for more information. An extension of the Load sample which demonstrates loadandsave saving an image. See The Loadandsave Sample for more information. manipulation Demonstrates a variety of image manipulations. Demonstrates printing using the Snowbound product. It printing contains both an application and applet. See The Printing Sample for more information. Demonstrates scanning using the Snowbound product. See scanning The Scanning Sample for more information. snippets Contains code snippets. Demonstrates using Java Swing classes, such as altering the viewable size, changing the orientation, modifying the swing size and resolution, making corrections, and converting to other formats. See The Swing Sample for more information. textsearch Demonstrates how to search text. Demonstrates creating thumbnails. When an image is opened, the thumbnail is created. You can open multiple thumbnails images and view all thumbnails at once. See The Thumbnails Sample for more information vectorpdf Demonstrates how to manipulate vector PDF files. watermark Demonstrates how to draw a watermark.
Office 2007-2010 Directory Files
The following Aspose files are located in the Office 2007-2010 directory with your RasterMaster Java installation:
Please note that Aspose licenses must be named as follows:
l Aspose.Total.Product.Family.lic for 30-day evaluations.
l Aspose.Words.lic, Aspose.Cells.lic and Aspose.Slides.lic for product licenses. These licenses will not expire as long as they are used with the version of the product with which they were delivered.
387 Appendix B - Software Installation
Note: If you have an evaluation copy of RasterMaster Java installed, please remove the Aspose.Total.Product.Family.lic file when you install your purchased version with the Office 2007-2010 option.
Aspose.Words.jdk15.jar aspose.slides-7.3.0.jar aspose-cells-7.4.3.jar Aspose.Total.Product.Family.lic dom4j-1.6.1.jar (Note: This file is for Aspose.Cells use.) log4j-1.2.16.jar (Note: This file is for Aspose.Slides use.) stax2-api-3.0.2.jar (Note: This file is needed to load XLSX files.) woodstox-core-asl-4.1.1.jar(Note: This file is needed to load XLSX files.) AdvancedImagingAPI.jar (Note: This file is for Aspose.Slides use.)
If you do not have the Aspose.Words files mentioned above, you can download Aspose.Words, Aspose.Slides or Aspose.Cells from the following location: http://www.aspose.com/Downloads
To set up RasterMaster Java for Office 2007-2010 support:
1. Add the Office2007-2010 folder to your classpath:
2. You will need to add dom4j-1.6.1.jar and Aspose.Cells.jar to your IDE’s CLASSPATH to decompress Excel 2007 (XLSX) files.
3. You will need to add log4j-1.2.16.jar and Aspose.slides-7.3.0.jar to your IDE’s CLASSPATH to decompress PowerPoint 2007 (PPTX) files.
4. RasterMaster Java defaults to the evaluation mode for Aspose. To remove evaluation limitations and display Office 2007 files without the Aspose watermark, please call IMGLOW_set_ooxml_license(). Use the method IMGLOW_fet_ooxml_license_path() to return the name of the jar file containing the Aspose license file or null if the Aspose license file is not found.
Notes: If an Aspose license file is not specified, or if it has expired, an Aspose watermark will appear on output files. If you are not able to convert a document successfully, please report it to Snowbound Software Technical Support by submitting a ticket at http://support.snowbound.com .
Snow.jar File
This is the RasterMaster® SDK library file. You should add it to your project’s classpath or as an external jar file.
388 Appendix B - Software Installation
JWebEngine.jar File
This file is the JWebEngine.jar HTML file. You should add it to your project’s classpath or as an external jar file to add improved HTML reading support. Please note you will need JRE 1.6 or better as well as this .jar file to see improved HTML reading support.
Cmap-all.jar File
This file contains character mappings for many non-western text formats within PDF files. You should add it to your project’s classpath or as an external jar file if you are decompressing PDF files that contain these types of characters.
snowcommon.jar File
This is the RasterMaster® SDK common file. You should add it to your project’s classpath or as an external jar file.
itext.jar File
This file contains the files for enhanced PDF support.
license.jar File
This file contains the HTML license file for enhanced PDF support.
389 Appendix C - TIFF Tags
Appendix C - TIFF Tags
This appendix describes the tags in the header and in Image File Directories (IFDs) used by TIFF (tagged image file format) files to declare and describe their content. Each TIFF file begins with a image file header which points to one or more image file directories which contain the image data and image information.
To call the TIFF tags in RasterMaster Java, use the IMGLOW_get_tiff_tag() method. This function reads a TIFF tag from the file specified by bm_name. To set the TIFF tags in RasterMaster Java, use the IMGLOW_set_tiff_tag() method. This method reads a TIFF tag from the file specified by bm_name.This function writes new tags as well as all current tags.
The TIFF file format was created by an independent group and was supported by Aldus. .TIF files can be any number of bits per pixel, planes and several compression algorithms. The byte order may be Intel or Motorola format. The bytes may also be filled from right to left or left to right. Compression may be uncompressed, pack bits, LZW, modified Huffman, CCITT G4, CCITT G3, CCITT G3-2D or JPEG. The CCITT G4 file format only saves to black and white.
If you have any questions about the TIFF file format and the tags described below, you may contact Snowbound Technical support on the web at http://support.snowbound.com
Sources for Tag Specifications
The following are descriptions of the types of the sources of the tags:
TIFF Baseline: The baseline set of tags were documented in TIFF 5.0 and carried over on pages 11-47 of the 1992 TIFF 6.0 specification.
TIFF Extended: The extended set includes some additional tags and added values for existing tags, as documented on pages 48-115 of the TIFF 6.0 specification.
TIFF Private: Originally, the term private meant just that. The TIFF 6.0 specification (page 8) states, “An organization might wish to store information meaningful to only that organization . . . . Tags numbered 32768 or higher, sometimes called private tags, are reserved for that purpose. Upon request, the TIFF administrator . . . will allocate and register one or more private tags for an organization . . . . You do not need to tell the TIFF administrator what you plan to use them for, but giving us this information may help other developers to avoid some duplication of effort.” Over time, however, many private tags have become well established and well documented, e.g., tag 34675 for the ICC profile, dubbed InterColorProfile in the TIFF/EP standard. Thus, many members of the private tag class can be viewed as open extensions rather than as containers for secret information.
TIFF/EP, TIFF/IT, and DNG: A number of tags, some of which may once have been private, have been defined in TIFF/EP (ISO 12234-2, 2001), TIFF/IT (ISO 12639, 2004), and DNG_1_1, an Adobe-sponsored extension of the TIFF 6.0 specification.
TIFF Private IFD: The TIFF 6.0 specification (page 9) states, “If you need more than 10 tags, we suggest that you reserve a single private tag, define it as a LONG TIFF data type, and use its value as a pointer (offset) to a private IFD [image file directory] or other data structure of your
390 Appendix C - TIFF Tags
choosing. Within that IFD, you can use whatever tags you want, since no one else will know that it is an IFD unless you tell them.” As with private tags, we can understand private IFDs as an extension to TIFF, often very public and well documented.
The private IFD tags of greatest interest to the Library of Congress are those associated with the EXIF_2_2 specification, pertaining to image generation by digital still cameras. Exif is an abbreviation for EXchangeable Image File format, although Exif does not relate to TIFF as, say, JFIF relates to JPEG_DCT. The Exif IFD is pointed to by the Private Exif IFD tag 34665. This and other Exif tags are listed in the numerical table below.
For the Exif specification and other related information, see Exif.org. There are actually three private IFDs specified by the Exif standard. The other two are the GPS IFD, for positioning information, and the Interoperability IFD, used to encode compability information. With numerical sequences of their own, the GPS and interoperability tags are not included in the table below.
HD Photo tags: Although not a true TIFF implementation, WMP_1_0 (originally called Windows Media Photo) is a 2006 specification with a container format that borrows heavily from TIFF and adds a few new tags of interest. Included in the table.
Descriptions of Tags in Numerical Order
Table C.1: TIFF Tags in Numerical Order1
Code Source of Name Description Dec Hex Tag A general indication of the kind of data that is contained in this subfile. This field is made up of a set of 32 flag bits. Unused bits are expected to be 0. Bit 0 is the low-order bit.
Currently defined values for the bitmap are: 00F- 254 NewSubfileType 0 - Image is reduced of another TIFF image in this Baseline E file
1 - Image is a single page of a multi-page
2 - Image is a transparency mask for another image in this file.
The default is 0. A general indication of the kind of data that is contained in this subfile.
00F- Currently defined values are: 255 SubfileType Baseline F A general indication of the kind of data that is contained in this subfile.
Currently defined values are:
391 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag 1 = full resolution image data - ImageWidth, ImageLength, and StripOffsets are required fields.
2 = reduced resolution image data - ImageWidth, ImageLength, and StripOffsets are required fields. It is further assumed that a reduced resolution image is a reduced version of the entire extent of the corresponding full resolution data.
3 = single page of a multi-page image (see the PageNumber tag description).
Continued use of this field is not recommended. Writers should instead use the new and more general NewSubfileType field. 010- The image's width, in pixels (X:horizontal). The 256 ImageWidth Baseline 0 number of columns in the image. The image's length (height) in pixels (Y:vertical). 010- 257 ImageLength The number of rows (sometimes described as Baseline 1 "scan lines") in the image. Number of bits per sample. Note that this tag allows a different number of bits per sample for each sample corresponding to a pixel. For 010- 258 BitsPerSample example, RGB color data could use a different Baseline 2 number of bits per sample for each of the three color planes.
The default is 1. 1 = No compression, but pack data into bytes as tightly as possible, with no unused bits except at the end of a row. The bytes are stored as an array of bytes, for BitsPerSample <= 8, word if BitsPerSample > 8 and <= 16, and dword if BitsPerSample > 16 and <= 32. The byte ordering of data >8 bits must be consistent with that specified in the TIFF file header (bytes 0 and 1). Rows are required to begin on byte boundaries. 010- 259 Compression Baseline 3 2 = CCITT Group 3 1-Dimensional Modified Huffman run length encoding. See ALGRTHMS.txt BitsPerSample must be 1, since this type of compression is defined only for bilevel images (like FAX images...)
3 = Facsimile-compatible CCITT Group 3, exactly as specified in "Standardization of Group 3 facsimile apparatus for document transmission,"
392 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag Recommendation T.4, Volume VII, Fascicle VII.3, Terminal Equipment and Protocols for Telematic Services, The International Telegraph and Telephone Consultative Committee (CCITT), Geneva, 1985, pages 16 through 31. Each strip must begin on a byte boundary. (But recall that an image can be a single strip.) Rows that are not the first row of a strip are not required to begin on a byte boundary. The data is stored as bytes, not words - byte-reversal is not allowed. See the Group3Options field for Group 3 options such as 1D vs 2D coding.
4 = Facsimile-compatible CCITT Group 4, exactly as specified in "Facsimile Coding Schemes and Coding Control Functions for Group 4 Facsimile Apparatus," Recommendation T.6, Volume VII, Fascicle VII.3, Terminal Equipment and Protocols for Telematic Services, The International Telegraph and Telephone Consultative Committee (CCITT), Geneva, 1985, pages 40 through 48. Each strip must begin on a byte boundary. Rows that are not the first row of a strip are not required to begin on a byte boundary. The data is stored as bytes, not words. See the Group4Options field for Group 4 options.
5 = LZW Compression, for grayscale, mapped color, and full color images. See ALGRTHMS.txt
32773 = PackBits compression, a simple byte oriented run length scheme for 1-bit images.
Data compression only applies to raster image data, as pointed to by StripOffsets.
The default value is 1. 0 = For bilevel and grayscale images: 0 is imaged as white. 2**BitsPerSample-1 is imaged as black. If GrayResponseCurve exists, it overrides the 010-PhotometricInterpret-PhotometricInterpretation value. 262 Baseline 6 ation 1 = For bilevel and grayscale images: 0 is imaged as black. 2**BitsPerSample-1 is imaged as white. If GrayResponseCurveexists, it overrides the PhotometricInterpretation value.
393 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag 2 = RGB. In the RGB model, a color is described as a combination of the three primary colors of light (red, green, and blue) inparticular concentrations. For each of the three samples, 0 represents minimum intensity, and 2**BitsPerSample - 1 represents maximum intensity. For PlanarConfiguration = 1, the samples are stored in the indicated order: first Red, hen Green, then Blue. For PlanarConfiguration = 2, the StripOffsets for the sample planes are stored in the indicated order: first the Red sample plane StripOffsets, then the Green plane StripOffsets, then the Blue plane StripOffsets.
3 = "Palette color." In this mode, a color is described with a single sample. The sample is used as an index into ColorMap. The sample is used to index into each of the red, green and blue curve tables to retrieve an RGB triplet defining an actual color. When this PhotometricInterpretation value is used, the color response curves must also be supplied. SamplesPerPixel must be 1.
4 = Transparency Mask. This means that the image is used to define an irregularly shaped region of another image in the same TIFF file. SamplesPerPixel and BitsPerSample must be 1. PackBits compression is recommended. The 1- bits define the interior of the region; the 0-bits define interior of the region; the 0-bits define the exterior of the region. The Transparency Mask must have the same ImageLength and ImageWidth as the main image. 1 = a bilevel "line art" scan. BitsPerSample must be 1.
010- 2 = a "dithered" scan, usually of continuous tone 263 Threshholding Baseline 7 data such as photographs. BitsPerSample must be 1.
3 = Error Diffused. 010- The width of the dithering or halftoning matrix used 264 CellWidth Baseline 8 to create a dithered or halftoned bilevel file. 010- The length of the dithering or halftoning matrix used 265 CellLength Baseline 9 to create a dithered or halftoned bilevel file. 010- 266 FillOrder The logical order of bits within a byte. Baseline A
394 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag 010- The name of the document from which this image 269 DocumentName Extended D was scanned. A string that describes the subject of the image. 010- For example, a user may wish to attach a 270 ImageDescription Baseline E comment such as "1988 company picnic" to an image. 010- Manufacturer of the scanner, video digitizer. 271 Make Baseline F Mandatory for TIFF/EP. The model name/number of the scanner, video 011- digitizer. This tag is intended for user information 272 Model Baseline 0 only so format is arbitrary. Mandatory for TIFF/EP. For each strip, the byte offset of that strip. The offset is specified with respect to the beginning of the TIFF file. Note that this implies that each strip 011- 273 StripOffsets has a location independent of the locations of other Baseline 1 strips. This feature may be useful for editing applications. This field is the only way for a reader to find the image data, and hence must exist. The orientation of the image with respect to the rows and columns.
1 = The 0th row represents the visual top of the image, and the 0th column represents the visual left hand side.
2 = The 0th row represents the visual top of the image, and the 0th column represents the visual right hand side.
3 = The 0th row represents the visual bottom of the 011- image, and the 0th column represents the visual 274 Orientation Baseline 2 right hand side.
4 = The 0th row represents the visual bottom of the image, and the 0th column represents the visual left hand side.
5 = The 0th row represents the visual left hand side of the image, and the 0th column represents the visual top.
6 = The 0th row represents the visual right hand side of the image, and the 0th column represents the visual top.
395 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag 7 = The 0th row represents the visual right hand side of the image, and the 0th column represents the visual bottom.
8 = The 0th row represents the visual left hand side of the image, and the 0th column represents the visual bottom.
It is extremely costly for most readers to perform image rotation "on the fly", i.e., when importing and printing; and users of most desktop publishing applications do not expect a file imported by the application to be altered permanently in any way.
The default value is 1. The number of samples per pixel. 011- SamplesPerPixel is 1 for bilevel, grayscale, and 277 SamplesPerPixel Baseline 5 palette color images. SamplesPerPixel is 3 for RGB images. The number of rows per strip. The image data is organized into strips for fast access to individual rows when the data is compressed - though this 011- 278 RowsPerStrip field is valid even if the data is not compressed. Baseline 6 The default is 2**32 - 1, which is effectively infinity. That is, the entire image is one strip. Recomended is a strip size of 8K. For each strip, the number of bytes in that strip. 011- The existenceof this field greatly simplifies the 279 StripByteCounts Baseline 7 chore of buffering compressed data, if the strip size is reasonable. 011- 280 MinSampleValue The minimum component value used. Baseline 8 011- 281 MaxSampleValue The maximum component value used. Baseline 9 011- The number of pixels per ResolutionUnit in the X 282 XResolution Baseline A direction, i.e., in the ImageWidth direction. 011- The number of pixels per ResolutionUnit in the Y 283 YResolution Baseline B direction, i.e., in the ImageLength direction. 1 = The sample values for each pixel are stored contiguously, so that there is a single image plane. 011- See PhotometricInterpretation to determine the 284 PlanarConfiguration Baseline C order of the samples within the pixel data. So, for RGB data, the data is stored RGBRGBRGB...and so on.
396 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag 2 = The samples are stored in separate "sample planes." The values in StripOffsets and StripByteCounts are then arranged as a 2- dimensional array, with SamplesPerPixel rows and StripsPerImage columns. (All of the columns for row 0 are stored first, followed by the columns of row 1, and so on.) PhotometricInterpretation describes the type of data that is stored in each sample plane. For example, RGB data is stored with the Red samples in one sample plane, the Green in another,and the Blue in another.
If SamplesPerPixel is 1, PlanarConfiguration is irrelevant, and should not be included.
The default is 1. 011- The name of the page from which this image was 285 PageName Extended D scanned. The X offset of the left side of the image, with 011- 286 XPosition respect to the left side of the page, in Extended E ResolutionUnits. The Y offset of the top of the image, with respect to 011- the top of the page, in ResolutionUnits. In the TIFF 287 YPosition Extended F oordinate scheme, the positive Y direction is down, so that YPosition is always positive. 012- For each string of contiguous unused bytes in a 288 FreeOffsets Baseline 0 TIFF file, the byte offset of the string. 012- For each string of contiguous unused bytes in a 289 FreeByteCounts Baseline 1 TIFF file, the number of bytes in the string. The precision of the information contained in the GrayResponseCurve.
1 = Number represents tenths of a unit.
2 = Number represents hundredths of a unit.
012- 3 = Number represents thousandths of a unit. 290 GrayResponseUnit Baseline 2 4 = Number represents ten-thousandths of a unit.
5 = Number represents hundred-thousandths of a unit.
For historical reasons, the default is 2. However, for greater accuracy, 3 is recommended. 012-GrayResponseCurv- For grayscale data, the optical density of each 291 Baseline 3 e possible pixel value.
397 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag The purpose of the gray response curve and the gray units is to provide more exact photometric interpretation information for gray scale image data, in terms of optical density. Those options are for fax-images stored in TIFF format. This field is made up of a set of 32 flag bits. Unused bits are expected to be 0. It is probably not safe to try to read the file if any bit of this field is set that you don't know the meaning of. 012- 292 Group3Options Bit map: Extended 4 0 - 2-dimensional coding used.
1 - Image is uncompressed
2 - Fill bits have been added before EOL codes, so that EOL always ends on a byte boundary. This field is made up of a set of 32 flag bits and is used for the images with fax group 4 compression. Unused bits are expected to be 0. It is probably not safe to try to read the file if any bit of this field is set that you don't know the meaning of. Gray scale and color coding schemes are under study, and will be added when finalized.
For 2-D coding, each strip is encoded as if it were a separate image. In particular, each strip begins on 012-Group4Options 293 a byte boundary; and the coding for the first row of Extended 5 a strip is encoded independently of the previous row, using horizontal codes, as if the previous row is entirely white. Each strip ends with the 24-bit end-of-facsimile block (EOFB).
Bit map:
0 - reserved (unused)
1 - uncompressed mode is used
2-31 - reserved To be used with XResolution and YResolution.
1 = No absolute unit of measurement. Used for 012- images that may have a non-square aspect ratio, 296 ResolutionUnit Baseline 8 but no meaningful absolute dimensions. The drawback of ResolutionUnit=1 is that different applications will import the image at different sizes. Even if the decision is quite arbitrary, it
398 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag might be better to use dots per inch or dots per centimeter, and pick XResolution and YResolution such that the aspect ratio is correct and the maximum dimension of the image is about four inches (the "four" is quite arbitrary.)
2 = Inch.
3 = Centimeter.
The default is 2. This tag is used to specify page numbers of a multiple page (e.g. facsimile) document. Two word values are specified. The first value is the page 012- 297 PageNumber number; the second value is the total number of Extended 9 pages in the document. Note that pages need not appear in numerical order. The first page is 0 (zero). 012- Describes a transfer function for the image in 301 TransferFunction Extended D tabular style. 013- Name and release number of the software package 305 Software Baseline 1 that created the image. User information only. Date and time of image creation. Uses the format "YYYY:MM:DD HH:MM:SS", with hours on a 24- 013- 306 DateTime hour clock, and one space character between the Baseline 2 date and the time. The length of the string, including the null, is 20 bytes. 013- 315 Artist Person who created the image. Copyright notice. Baseline B The computer and/or operating system in use at 013- 316 HostComputer the time of image creation. Baseline C ENIAC. A mathematical operator that is applied to the image data before an encoding scheme is applied. 013- 317 Predictor To be used when Compression=5 (LZW). Extended D 1 = No prediction scheme used before coding.
2 = Horizontal differencing. Gives TIFF color image readers a better idea of what kind of color image it is. There will be 013- borderline cases. 318 ColorImageType Extended E 1 = Continuous tone, natural image.
2 = Synthetic image, using a greatly restricted
399 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag range of colors.
Such images are produced by most color paint programs. See ColorList for a list of colors used in this image.
The default value is 1. A list of colors that are used in this image. Use of this field is only practical for images containing a greatly restricted (usually less than or equal to 256) range of colors. ColorImageType should be 2. See ColorImageType. 013- 319 ColorList Extended F The list is organized as an array of RGB triplets, with no pad. The RGB triplets are not guaranteed to be in any particular order. Note that the red, green, and blue components can either be a BYTE or a word in length. BYTE should be sufficient for most applications. This tag defines a Red-Green-Blue color map for palette color images. The palette color pixel value is used to index into all 3 subcurves. The subcurves are stored sequentially. The Red entries come first, followed by the Green entries, followed 014- 320 ColorMap by the Blue entries. The width of each entry is 16 Baseline 0 bits, as implied by the type of word. 0 represents the minimum intensity, and 65535 represents the maximum intensity.
ColorMap must be included in all palette color images. Conveys to the halftone function the range of gray 014- 321 HalftoneHints levels within a colorimetrically-specified image thatExtended 1 should retain tonal detail. 014- The tile width in pixels. This is the number of 322 TileWidth Extended 2 columns in each tile. 014- The tile length (height) in pixels. This is the number 323 TileLength Extended 3 of rows in each tile. 014- For each tile, the byte offset of that tile, as 324 TileOffsets Extended 4 compressed and stored on disk. 014- For each tile, the number of (compressed) bytes in 325 TileByteCounts Extended 5 that tile. Used in the TIFF-F standard, denotes the number 014- 326 BadFaxLines of 'bad' scan lines encountered by the facsimile Extended 6 device. 327 014-CleanFaxData Used in the TIFF-F standard, indicates if 'bad' linesExtended
400 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag encountered during reception are stored in the 7 data, or if 'bad' lines have been replaced by the receiver. Used in the TIFF-F standard, denotes the 014- 328 ConsecutiveBadFax-maximum number of consecutive 'bad' scanlines Extended 8 Lines received. 014- 330 SubIFDs Offset to child IFDs. Extended A 014- The set of inks used in a separated 332 InkSet Extended C (PhotometricInterpretation=5) image. 014- 333 InkNames The name of each ink used in a separated image. Extended D 014- 334 NumberOfInks The number of inks. Extended E 015- The component values that correspond to a 0% dot 336 DotRange Extended 0 and 100% dot. 015- A description of the printing environment for which 337 TargetPrinter Extended 1 this separation is intended. 015- 338 ExtraSamples Description of extra components. Baseline 2 015- Specifies how to interpret each data sample in a 339 SampleFormat Extended 3 pixel. 015- 340 SMinSampleValue Specifies the minimum sample value. Extended 4 015- 341 SMaxSampleValue Specifies the maximum sample value. Extended 5 015- 342 TransferRange Expands the range of the TransferFunction. Extended 6 015- Mirrors the essentials of PostScript's path creation 343 ClipPath Extended 7 functionality. 015- The number of units that span the width of the 344 XClipPathUnits Extended 8 image, in terms of integer ClipPath coordinates. 015- The number of units that span the height of the 345 YClipPathUnits Extended 9 image, in terms of integer ClipPath coordinates. 015- Aims to broaden the support for indexed images to 346 Indexed Extended A include support for any color space. 015- 347 JPEGTables JPEG quantization and/or Huffman tables. Extended B 015- 351 OPIProxy OPI-related. Extended F Used in the TIFF-FX standard to point to an IFD 019- 400 GlobalParametersIF-containing tags that are globally applicable to the Extended 0 D complete TIFF file. 401 019-ProfileType Used in the TIFF-FX standard, denotes the type of Extended
401 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag 1 data stored in this file or IFD. 019- Used in the TIFF-FX standard, denotes the 'profile' 402 FaxProfile Extended 2 that applies to this file. 019- Used in the TIFF-FX standard, indicates which 403 CodingMethods Extended 3 coding methods are used in the file. 019- Used in the TIFF-FX standard, denotes the year of 404 VersionYear Extended 4 the standard specified by the FaxProfile field. 019- Used in the TIFF-FX standard, denotes the mode 405 ModeNumber Extended 5 of the standard specified by the FaxProfile field. Used in the TIFF-F and TIFF-FX standards, holds 01B- 433 Decode information about the ITULAB Extended 1 (PhotometricInterpretation = 10) encoding. Defined in the Mixed Raster Content part of RFC 01B- 434 DefaultImageColor 2301, is the default color needed in areas where no Extended 2 image is available. 020- Old-style JPEG compression field. TechNote2 512 JPEGProc Extended 0 invalidates this part of the specification. 020- Old-style JPEG compression field. TechNote2 513 JPEGInterchangeFo- Extended 1 invalidates this part of the specification. rmat 020-JPEGInterchangeFo-Old-style JPEG compression field. TechNote2 514 Extended 2 rmatLength invalidates this part of the specification. 020-JPEGRestartInterva-Old-style JPEG compression field. TechNote2 515 Extended 3 l invalidates this part of the specification. 020- Old-style JPEG compression field. TechNote2 517 JPEGLosslessPredi- Extended 5 invalidates this part of the specification. ctors 020-JPEGPointTransfor- Old-style JPEG compression field. TechNote2 518 Extended 6 ms invalidates this part of the specification. 020- Old-style JPEG compression field. TechNote2 519 JPEGQTables Extended 7 invalidates this part of the specification. 020- Old-style JPEG compression field. TechNote2 520 JPEGDCTables Extended 8 invalidates this part of the specification. 020- Old-style JPEG compression field. TechNote2 521 JPEGACTables Extended 9 invalidates this part of the specification. The transformation from RGB to YCbCr image 021- 529 YCbCrCoefficients data. Extended 1 Mandatory for TIFF/EP YCbCr images. 021- Specifies the subsampling factors used for the 530 YCbCrSubSampling Extended 2 chrominance components of a YCbCr image. Specifies the positioning of subsampled 021- 531 YCbCrPositioning chrominance components relative to luminance Extended 3 samples. 532 021-ReferenceBlackWhi-Specifies a pair of headroom and footroom image Extended
402 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag 4 te data values (codes) for each pixel component. Defined in the Mixed Raster Content part of RFC 022- 559 StripRowCounts 2301, used to replace RowsPerStrip for IFDs with Extended F variable-sized strips. 02B- 700 XMP XML packet containing XMP metadata Extended C 3278-800- ImageID OPI-related. Extended 1 D 3293-80A- Wang Annotation Annotation data, as used in 'Imaging for Windows. Private 2 4 3342-828-CFARepeatPattern- For camera raw files from sensors with CFA TIFF/EP 1 D Dim overlay. spec, p. 23 3342-828- For camera raw files from sensors with CFA TIFF/EP CFAPattern 2 E overlay. spec, p. 23 3342-828- Encodes camera battery level at time of image TIFF/EP BatteryLevel 3 F capture. spec, p. 45 3343-829- Copyright Copyright notice. Baseline 2 8 Exif Private 3343-829- ExposureTime Exposure time given in seconds. IFD 4 A TIFF/EP spec, p. 38 Exif Private 3343-829- FNumber The F number. IFD 7 D TIFF/EP spec, p. 39 3344-82A- Specifies the pixel data format encoding in the MD FileTag Private 5 5 Molecular Dynamics GEL file format. 3344-82A- Specifies a scale factor in the Molecular Dynamics MD ScalePixel Private 6 6 GEL file format. 3344-82A- Used to specify the conversion from 16bit to 8bit in MD ColorTable Private 7 7 the Molecular Dynamics GEL file format. 3344-82A- Name of the lab that scanned this file, as used in MD LabName Private 8 8 the Molecular Dynamics GEL file format. 3344-82A- Information about the sample, as used in the MD SampleInfo Private 9 9 Molecular Dynamics GEL file format. 3345-82A- Date the sample was prepared, as used in the MD PrepDate Private 0 A Molecular Dynamics GEL file format. 3345-82A- Time the sample was prepared, as used in the MD PrepTime Private 1 B Molecular Dynamics GEL file format. 3345-82A-MD FileUnits Units for data in this file, as used in the Molecular Private
403 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag 2 C Dynamics GEL file format. 3355-830- ModelPixelScaleTag Used in interchangeable GeoTIFF_1_0 files. Private 0 E IPTC-NAA (International Press 3372-83B- TIFF/EP IPTC/NAA Telecommunications Council-Newspaper 3 B spec, p. 33 Association of America) metadata. 3391-847-INGR Packet Data Intergraph Application specific storage. Private 8 E Tag 3391-847-INGR Flag Intergraph Application specific flags. Private 9 F Registers IrasB 3392-848- Originally part of Intergraph's GeoTIFF tags, but Transformation Private 0 0 likely understood by IrasB only. Matrix Originally part of Intergraph's GeoTIFF tags, but 3392-848- now used in interchangeable GeoTIFF_1_0 files. In ModelTiepointTag Private 2 2 GeoTIFF_1_0, either this tag or 34264 must be defined, but not both 3401- TIFF/IT Site Site where image created. 6 spec, 7.2.3 TIFF/IT 3401- ColorSequence Sequence of colors if other than CMYK. spec, 7 7.2.8.3.2 3401- TIFF/IT IT8Header Certain inherited headers. 8 spec, 7.2.3 3401- TIFF/IT RasterPadding Type of raster padding used, if any. 9 spec, 7.2.6 3402- TIFF/IT BitsPerRunLength Number of bits for short run length encoding. 0 spec, 7.2.6 3402- BitsPerExtendedRu- TIFF/IT Number of bits for long run length encoding. 1 nLength spec, 7.2.6 TIFF/IT 3402- ColorTable Color value in a color pallette. spec, 2 7.2.8.4 3402- Indicates if image (foreground) color or TIFF/IT ImageColorIndicator 3 transparency is specified. spec, 7.2.9 3402- BackgroundColorInd- TIFF/IT Background color specification. 4 icator spec, 7.2.9 TIFF/IT 3402- ImageColorValue Specifies image (foreground) color. spec, 5 7.2.8.4 TIFF/IT 3402- BackgroundColorVal- Specifies background color. spec, 6 ue 7.2.8.4 3402- PixelIntensityRange Specifies data values for 0 percent and 100 TIFF/IT
404 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag spec, 7 percent pixel intensity. 7.2.8.4 TIFF/IT 3402- TransparencyIndicat- Specifies if transparency is used in HC file. spec, 8 or 7.2.8.4 TIFF/IT 3402- ColorCharacterizatio-Specifies ASCII table or other reference per ISO spec, 9 n 12641 and ISO 12642. 7.2.8.4 3403- TIFF/IT HCUsage Indicates the type of information in an HC file. 0 spec, 7.2.6 3403- Indicates whether or not trapping has been applied TIFF/IT TrapIndicator 1 to the file. spec, 7.2.6 TIFF/IT 3403- Specifies CMYK equivalent for specific CMYKEquivalent spec, 2 separations. 7.2.8.3.4 3403- TIFF/IT Reserved For future TIFF/IT use 3 spec 3403- TIFF/IT Reserved For future TIFF/IT use 4 spec 3403- TIFF/IT Reserved For future TIFF/IT use 5 spec Used in interchangeable GeoTIFF_1_0 files. In 3426-85D- ModelTransformatio- GeoTIFF_1_0, either this tag or 33922 must be Private 4 8 nTag defined, but not both 3437-864- Photoshop Collection of Photoshop 'Image Resource Blocks. Private 7 9 3466-876- Exif IFD A pointer to the Exif IFD. Private 5 9 3467-877- TIFF/EP InterColorProfile ICC profile data. 5 3 spec, p. 47 Defined in the Mixed Raster Content part of RFC 3473-87A- ImageLayer 2301, used to denote the particular function of this Extended 2 C Image in the mixed raster scheme. 3473-87A-GeoKeyDirectoryTa- Used in interchangeable GeoTIFF_1_0 files. Private 5 F g Mandatory in GeoTIFF_1_0. 3473-87B- GeoDoubleParamsT-Used in interchangeable GeoTIFF_1_0 files. Private 6 0 ag 3473-87B- GeoAsciiParamsTag Used in interchangeable GeoTIFF_1_0 files. Private 7 1 Exif 3485-882- The class of the program used by the camera to Private ExposureProgram 0 2 set exposure when the picture is taken. IFD TIFF/EP
405 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag spec, p. 41 Exif Private 3485-882- Indicates the spectral sensitivity of each channel SpectralSensitivity IFD 2 4 of the camera used. TIFF/EP spec, p. 48 3485-882- TIFF/EP GPSInfo A pointer to the Exif-related GPS Info IFD. 3 5 spec, p. 34 Exif Private 3485-882- Indicates the ISO Speed and ISO Latitude of the ISOSpeedRatings IFD 5 7 camera or input device as specified in ISO 12232. TIFF/EP spec, p. 47 Exif Private 3485-882- Indicates the Opto-Electric Conversion Function OECF IFD 6 8 (OECF) specified in ISO 14524. TIFF/EP spec, p. 48 3485-882- TIFF/EP Interlace Indicates the field number of multifield images. 7 9 spec, p. 22 3485-882- Encodes time zone of camera clock relative to TIFF/EP TimeZoneOffset 8 A GMT. spec, p. 38 3485-882- Number of seconds image capture was delayed TIFF/EP SelfTimeMode 9 B from button press. spec, p. 45 3490-885-HylaFAX Used by HylaFAX. Private 8 C FaxRecvParams 3490-885-HylaFAX Used by HylaFAX. Private 9 D FaxSubAddress 3491-885-HylaFAX Used by HylaFAX. Private 0 E FaxRecvTime Exif 3686-900- The version of the supported Exif standard. ExifVersion Private 4 0 Mandatory in the Exif IFD. IFD Exif Private 3686-900- The date and time when the original image data DateTimeOriginal IFD 7 3 was generated. Mandatory for TIFF/EP. TIFF/EP spec, p. 37 Exif 3686-900- The date and time when the image was stored as DateTimeDigitized Private 8 4 digital data. IFD 3712-910-ComponentsConfigu-Specific to compressed data; specifies the Exif
406 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag channels and complements Private 1 1 ration PhotometricInterpretation IFD Exif Private 3712-910-CompressedBitsPer-Specific to compressed data; states the IFD 2 2 Pixel compressed bits per pixel. TIFF/EP spec, p. 27 Exif Private 3737-920- ShutterSpeedValue Shutter speed. IFD 7 1 TIFF/EP spec, p. 39 Exif Private 3737-920- ApertureValue The lens aperture. IFD 8 2 TIFF/EP spec, p. 39 Exif Private 3737-920- BrightnessValue The value of brightness. IFD 9 3 TIFF/EP spec, p. 40 Exif Private 3738-920- ExposureBiasValue The exposure bias. IFD 0 4 TIFF/EP spec, p. 40 Exif Private 3738-920- MaxApertureValue The smallest F number of the lens. IFD 1 5 TIFF/EP spec, p. 40 Exif Private 3738-920- SubjectDistance The distance to the subject, given in meters. IFD 2 6 TIFF/EP spec, p. 44 Exif 3738-920- MeteringMode The metering mode. Private 3 7 IFD
407 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag TIFF/EP spec, p. 41 Exif Private 3738-920- LightSource The kind of light source. IFD 4 8 TIFF/EP spec, p. 46 Exif Private 3738-920- Indicates the status of flash when the image was Flash IFD 5 9 shot. TIFF/EP spec, p. 42 Exif Private 3738-920- FocalLength The actual focal length of the lens, in mm. IFD 6 A TIFF/EP spec, p. 44 3738-920- TIFF/EP FlashEnergy Amount of flash energy (BCPS). 7 B spec, p. 43 3738-920-SpatialFrequencyRe- TIFF/EP SFR of the camera. 8 C sponse spec, p. 49 3738-920- TIFF/EP Noise Noise measurement values. 9 D spec, p. 49 3739-920-FocalPlaneXResolut-Number of pixels per FocalPlaneResolutionUnit TIFF/EP 0 E ion (37392) in ImageWidth direction for main image. spec, p. 18 3739-920-FocalPlaneYResolut-Number of pixels per FocalPlaneResolutionUnit TIFF/EP 1 F ion (37392) in ImageLength direction for main image. spec, p. 19 3739-921-FocalPlaneResoluti- Unit of measurement for FocalPlaneXResolution TIFF/EP 2 0 onUnit (37390) and FocalPlaneYResolution(37391). spec, p. 19 3739-921- Number assigned to an image, e.g., in a chained TIFF/EP ImageNumber 3 1 image burst. spec, p. 32 3739-921-SecurityClassificati- TIFF/EP Security classification assigned to the image. 4 2 on spec, p. 33 3739-921- TIFF/EP ImageHistory Record of what has been done to the image. 5 3 spec, p. 33 Exif Private 3739-921- Indicates the location and area of the main subject SubjectLocation IFD 6 4 in the overall scene. TIFF/EP spec, p. 45 3739-921- Encodes the camera exposure index setting when TIFF/EP ExposureIndex 7 5 image was captured. spec, p. 47
408 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag 3739-921- For current spec, tag value equals 1 0 0 0. TIFF/EP TIFF/EPStandardID 8 6 Mandatory in TIFF/EP. spec, p. 16 3739-921- Type of image sensor. TIFF/EP SensingMethod 9 7 Mandatory in TIFF/EP. spec, p. 22 Exif 3750-927- MakerNote Manufacturer specific information. Private 0 C IFD Exif 3751-928- Keywords or comments on the image; UserComment Private 0 6 complements ImageDescription. IFD Exif 3752-929- A tag used to record fractions of seconds for the SubsecTime Private 0 0 DateTime tag. IFD Exif 3752-929- A tag used to record fractions of seconds for the SubsecTimeOriginal Private 1 1 DateTimeOriginal tag. IFD Exif 3752-929-SubsecTimeDigitize-A tag used to record fractions of seconds for the Private 2 2 d DateTimeDigitized tag. IFD 3772-935- ImageSourceData Used by Adobe Photoshop. Private 4 C The Flashpix format version supported by a FPXR Exif 4096-A00- FlashpixVersion file., Private 0 0 Mandatory in the Exif IFD IFD The color space information tag is always recorded Exif 4096-A00- ColorSpace as the color space specifier. Private 1 1 Mandatory in the Exif IFD. IFD Exif 4096-A00- Specific to compressed data; the valid width of the PixelXDimension Private 2 2 meaningful image. IFD Exif 4096-A00- Specific to compressed data; the valid height of PixelYDimension Private 3 3 the meaningful image. IFD Exif 4096-A00- Used to record the name of an audio file related to RelatedSoundFile Private 4 4 the image data. IFD 4096-A00- Interoperability IFD A pointer to the Exif-related Interoperability IFD. Private 5 5 Indicates the strobe energy at the time the image isExif 4148-A20- FlashEnergy captured, as measured in Beam Candle Power Private 3 B Seconds IFD 4148-A20-SpatialFrequencyRe-Records the camera or input device spatial Exif
409 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag frequency table and SFR values in the direction of Private 4 C sponse image width, image height, and diagonal direction, IFD as specified in ISO 12233. Indicates the number of pixels in the image width Exif 4148-A20- FocalPlaneXResolut-(X) direction per FocalPlaneResolutionUnit on the Private 6 E ion camera focal plane. IFD Indicates the number of pixels in the image height Exif 4148-A20-FocalPlaneYResolut- (Y) direction per FocalPlaneResolutionUnit on the Private 7 F ion camera focal plane. IFD Indicates the unit for measuring Exif 4148-A21-FocalPlaneResoluti- FocalPlaneXResolution and Private 8 0 onUnit FocalPlaneYResolution. IFD Exif 4149-A21- Indicates the location of the main subject in the SubjectLocation Private 2 4 scene. IFD Indicates the exposure index selected on the Exif 4149-A21- ExposureIndex camera or input device at the time the image is Private 3 5 captured. IFD Exif 4149-A21- Indicates the image sensor type on the camera or SensingMethod Private 5 7 input device. IFD Exif 4172-A30- FileSource Indicates the image source. Private 8 0 IFD Exif 4172-A30- SceneType Indicates the image source. Private 9 1 IFD Indicates the color filter array (CFA) geometric Exif 4173-A30- CFAPattern pattern of the image sensor when a one-chip color Private 0 2 area sensor is used. IFD Exif 4198-A40- Indicates the use of special processing on image CustomRendered Private 5 1 data, such as rendering geared to output. IFD Exif 4198-A40- Indicates the exposure mode set when the image ExposureMode Private 6 2 was shot. IFD Exif 4198-A40- Indicates the white balance mode set when the WhiteBalance Private 7 3 image was shot. IFD Exif 4198-A40- Indicates the digital zoom ratio when the image DigitalZoomRatio Private 8 4 was shot. IFD 4198-A40- Indicates the equivalent focal length assuming a Exif 9 5 FocalLengthIn35mm-35mm film camera, in mm. Private
410 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag Film IFD Exif 4199-A40- SceneCaptureType Indicates the type of scene that was shot. Private 0 6 IFD Exif 4199-A40- Indicates the degree of overall image gain GainControl Private 1 7 adjustment. IFD Exif 4199-A40- Indicates the direction of contrast processing Contrast Private 2 8 applied by the camera when the image was shot. IFD Exif 4199-A40- Indicates the direction of saturation processing Saturation Private 3 9 applied by the camera when the image was shot. IFD Exif 4199-A40- Indicates the direction of sharpness processing Sharpness Private 4 A applied by the camera when the image was shot. IFD Exif 4199-A40- This tag indicates information on the picture-taking DeviceSettingDescr- Private 5 B conditions of a particular camera model. iption IFD Exif 4199-A40-SubjectDistanceRa- Indicates the distance to the subject. Private 6 C nge IFD Exif 4201-A42- Indicates an identifier assigned uniquely to each ImageUniqueID Private 6 0 image. IFD Used by the GDAL library, holds an XML list of 4211-A48- GDAL_METADATA name=value 'metadata' values about the image as Private 2 0 a whole, and about specific samples. 4211-A48- Used by the GDAL library, contains an ASCII GDAL_NODATA Private 3 1 encoded nodata or background pixel value. HD Photo 4812-BC- A 128-bit Globally Unique Identifier (GUID) that PixelFormat Feature 9 01 identifies the image pixel format. Spec, p. 17 Specifies the transformation to be applied when HD Photo 4813-BC- Transformation decoding the image to present the desired Feature 0 02 representation. Spec, p. 23 HD Photo 4813-BC- Uncompressed Specifies that image data is uncompressed. Feature 1 03 Spec, p. 23 HD Photo 4813-BC- Specifies the image type of each individual frame ImageType Feature 2 04 in a multi-frame file. Spec, p. 27 4825-BC- The image's width, in pixels (X:horizontal). The HD Photo ImageWidth 6 80 number of columns in the image. Feature
411 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag Spec, p. 21 HD Photo 4825-BC- Specifies the number of pixels or scan lines in the ImageHeight Feature 7 81 transformed photo. Spec, p. 21 HD Photo 4825-BC- Specifies the horizontal resolution of a transformed WidthResolution Feature 8 82 image expressed in pixels per inch. Spec, p. 21 HD Photo 4825-BC- Specifies the vertical resolution of a transformed HeightResolution Feature 9 83 image expressed in pixels per inch. Spec, p. 21 HD Photo 4832-BC- Specifies the byte offset pointer to the beginning of ImageOffset Feature 0 C0 the photo data, relative to the beginning of the file. Spec, p. 22 HD Photo 4832-BC- ImageByteCount Specifies the size of the photo in bytes. Feature 1 C1 Spec, p. 22 Specifies the byte offset pointer the beginning of HD Photo 4832-BC- AlphaOffset the planar alpha channel data, relative to the Feature 2 C2 beginning of the file. Spec, p. 22 HD Photo 4832-BC- Specifies the size of the alpha channel data in AlphaByteCount Feature 3 C3 bytes. Spec, p. 23 Signifies the level of data that has been discarded HD Photo 4832-BC- ImageDataDiscard from the image as a result of a compressed domainFeature 4 C4 transcode to reduce the file size. Spec, p. 25 Signifies the level of data that has been discarded HD Photo 4832-BC- from the planar alpha channel as a result of a AlphaDataDiscard Feature 5 C5 compressed domain transcode to reduce the file Spec, p. 26 size. HD Photo 4813-BC- Specifies the image type of each individual frame ImageType Feature 2 04 in a multi-frame file. Spec, p. 27 5021-C42-Oce Scanjob Used in the Oce scanning process. Private 5 7 Description 5021-C42-Oce Application Used in the Oce scanning process. Private 6 8 Selector 5021-C42-Oce Identification Used in the Oce scanning process. Private 7 9 Number 5021-C42-Oce ImageLogic Used in the Oce scanning process. Private 8 A Characteristics Encodes DNG four-tier version number; for version 5070-C61- DNG spec, DNGVersion 1.1.0.0, the tag contains the bytes 1, 1, 0, 0. Used 6 2 p. 17 in IFD 0 of DNG files. 5070-C61- Defines oldest version of spec with which file is DNG spec,
412 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag DNGBackwardVersi- 7 3 compatible. Used in IFD 0 of DNG files. p. 17 on 5070-C61- Unique, non-localized nbame for camera model. DNG spec, UniqueCameraMode- 8 4 Used in IFD 0 of DNG files. p. 18 l 5070-C61-LocalizedCameraMo-Similar to 50708, with localized camera name. DNG spec, 9 5 del Used in IFD 0 of DNG files. p. 19 Mapping between values in the CFAPattern tag 5071-C61- and the plane numbers in LinearRaw space. Used DNG spec, CFAPlaneColor 0 6 in Raw IFD of DNG files. p. 19 Required for non-RGB CFA images. 5071-C61- Spatial layout of the CFA. Used in Raw IFD of DNG spec, CFALayout 1 7 DNG files. p. 20 5071-C61- Lookup table that maps stored values to linear DNG spec, LinearizationTable 2 8 values. Used in Raw IFD of DNG files. p. 20 5071-C61- Repeat pattern size for BlackLevel tag. Used in DNG spec, BlackLevelRepeatDi- 3 9 Raw IFD of DNG files. p. 21 m 5071-C61- Specifies the zero light encoding level.Used in DNG spec, BlackLevel 4 A Raw IFD of DNG files. p. 21 Specifies the difference between zero light 5071-C61- encoding level for each column and the baseline DNG spec, BlackLevelDeltaH 5 B zero light encoding level. Used in Raw IFD of DNGp. 22 files. Specifies the difference between zero light 5071-C61- encoding level for each row and the baseline zero DNG spec, BlackLevelDeltaV 6 C light encoding level. Used in Raw IFD of DNG p. 23 files. Specifies the fully saturated encoding level for the 5071-C61- DNG spec, WhiteLevel raw sample values. Used in Raw IFD of DNG 7 D p. 23 files. For cameras with non-square pixels, specifies the 5071-C61- default scale factors for each direction to convert DNG spec, DefaultScale 8 E the image to square pixels. Used in Raw IFD of p. 24 DNG files. Specifies the origin of the final image area, ignoring 5071-C61- the extra pixels at edges used to prevent DNG spec, DefaultCropOrigin 9 F interpolation artifacts. Used in Raw IFD of DNG p. 25 files. 5072-C62- Specifies size of final image area in raw image DNG spec, DefaultCropSize 0 0 coordinates. Used in Raw IFD of DNG files. p. 25 Defines a transformation matrix that converts XYZ 5072-C62- DNG spec, ColorMatrix1 values to reference camera native color space 1 1 p. 27 values, under the first calibration illuminant. Used
413 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag in IFD 0 of DNG files. Defines a transformation matrix that converts XYZ 5072-C62- values to reference camera native color space DNG spec, ColorMatrix2 2 2 values, under the second calibration illuminant. p. 28 Used in IFD 0 of DNG files. Defines a calibration matrix that transforms 5072-C62- reference camera native space values to individual DNG spec, CameraCalibration1 3 3 camera native space values under the first p. 28 calibration illuminant. Used in IFD 0 of DNG files. Defines a calibration matrix that transforms 5072-C62- reference camera native space values to individual DNG spec, CameraCalibration2 4 4 camera native space values under the second p. 29 calibration illuminant. Used in IFD 0 of DNG files. Defines a dimensionality reduction matrix for use 5072-C62- as the first stage in converting color camera native DNG spec, ReductionMatrix1 5 5 space values to XYZ values, under the first p. 30 calibration illuminant. Used in IFD 0 of DNG files. Defines a dimensionality reduction matrix for use 5072-C62- as the first stage in converting color camera native DNG spec, ReductionMatrix2 6 6 space values to XYZ values, under the second p. 30 calibration illuminant. Used in IFD 0 of DNG files. Pertaining to white balance, defines the gain, either 5072-C62- DNG spec, AnalogBalance analog or digital, that has been applied to the 7 7 p. 31 stored raw values. Used in IFD 0 of DNG files. Specifies the selected white balance at the time of 5072-C62- capture, encoded as the coordinates of a perfectly DNG spec, AsShotNeutral 8 8 neutral color in linear reference space values. p. 31 Used in IFD 0 of DNG files. Specifies the selected white balance at the time of 5072-C62- DNG spec, AsShotWhiteXY capture, encoded as x-y chromaticity coordinates. 9 9 p. 32 Used in IFD 0 of DNG files. Specifies in EV units how much to move the zero 5073-C62- DNG spec, BaselineExposure point for exposure compensation. Used in IFD 0 of 0 A p. 32 DNG files. Specifies the relative noise of the camera model at 5073-C62- a baseline ISO value of 100, compared to DNG spec, BaselineNoise 1 B reference camera model. Used in IFD 0 of DNG p. 33 files. Specifies the relative amount of sharpening 5073-C62- required for this camera model, compared to DNG spec, BaselineSharpness 2 C reference camera model. Used in IFD 0 of DNG p. 33 files. 5073-C62- For CFA images, specifies, in arbitrary units, how DNG spec, BayerGreenSplit 3 D closely the values of the green pixels in the p. 34
414 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag blue/green rows track the values of the green pixels in the red/green rows. Used in Raw IFD of DNG files. Specifies the fraction of the encoding range above 5073-C62- DNG spec, LinearResponseLimi-which the response may become significantly non- 4 E p. 34 t linear. Used in IFD 0 of DNG files. 5073-C62-CameraSerialNumb- Serial number of camera. Used in IFD 0 of DNG DNG spec, 5 F er files. p. 35 5073-C63- Information about the lens. Used in IFD 0 of DNG DNG spec, LensInfo 6 0 files. p. 35 Normally for non-CFA images, provides a hint 5073-C63- DNG spec, ChromaBlurRadius about how much chroma blur ought to be applied. 7 1 p. 36 Used in Raw IFD of DNG files. 5073-C63- Provides a hint about the strength of the camera's DNG spec, AntiAliasStrength 8 2 anti-aliasing filter. Used in Raw IFD of DNG files. p. 36 5073- Used by Adobe Camera Raw to control sensitivity DNG spec, ShadowScale 9 of its shadows slider. Used in IFD 0 of DNG files. p. 38 Provides a way for camera manufacturers to store 5074-C63- DNG spec, DNGPrivateData private data in DNG files for use by their own raw 0 4 p. 37 convertors. Used in IFD 0 of DNG files. Lets the DNG reader know whether the Exif 5074-C63- DNG spec, MakerNoteSafety MakerNote tag is safe to preserve. Used in IFD 0 1 5 p. 38 of DNG files. 5077-C65- Illuminant used for first set of calibration tags. DNG spec, CalibrationIlluminant- 8 A Used in IFD 0 of DNG files. p. 26 1 5077-C65-CalibrationIlluminant-Illuminant used for second set of calibration tags. DNG spec, 9 B 2 Used in IFD 0 of DNG files. p. 26 Specifies the amount by which the values of the 5078-C65- DefaultScale tag need to be multiplied to achieve DNG spec, BestQualityScale 0 C best quality image size. Used in Raw IFD of DNG p. 24 files. Contains a 16-byte unique identifier for the raw 5078- DNG spec, RawDataUniqueID image file in the DNG file. Used in IFD 0 of DNG 1 p. 39 files. 5078-C66-Alias Layer Alias Sketchbook Pro layer usage description. Private 4 0 Metadata Name of original file if the DNG file results from 5082- OriginalRawFileNa- DNG spec, conversion from a non-DNG raw file. Used in IFD 0 7 me p. 39 of DNG files. If the DNG file was converted from a non-DNG raw 5082- DNG spec, OriginalRawFileData file, then this tag contains the original raw data. 8 p. 40 Used in IFD 0 of DNG files. 5082- ActiveArea Defines the active (non-masked) pixels of the DNG spec,
415 Appendix C - TIFF Tags
Code Source of Name Description Dec Hex Tag 9 sensor. Used in Raw IFD of DNG files. p. 41 List of non-overlapping rectangle coordinates of 5083- fully masked pixels, which can optimally be used DNG spec, MaskedAreas 0 by DNG readers to measure the black encoding p. 42 level. Used in Raw IFD of DNG files. Contains ICC profile that, in conjunction with the AsShotPreProfileMatrix tag, specifies a default 5083- color rendering from camera color space DNG spec, AsShotICCProfile 1 coordinates (linear reference values) into the ICC p. 42 profile connection space. Used in IFD 0 of DNG files. Specifies a matrix that should be applied to the 5083- AsShotPreProfileMa-camera color space coordinates before processing DNG spec, 2 trix the values through the ICC profile specified in the p. 43 AsShotICCProfile tag. Used in IFD 0 of DNG files. The CurrentICCProfile and CurrentPreProfileMatrix tags have the same 5083- purpose and usage as the AsShotICCProfile and DNG spec, CurrentICCProfile 3 AsShotPreProfileMatrix tag pair, except they are p. 44 for use by raw file editors rather than camera manufacturers. Used in IFD 0 of DNG files. The CurrentICCProfile and CurrentPreProfileMatrix tags have the same 5083- CurrentPreProfileMa-purpose and usage as the AsShotICCProfile and DNG spec, 4 trix AsShotPreProfileMatrix tag pair, except they are p. 44 for use by raw file editors rather than camera manufacturers. Used in IFD 0 of DNG files.
1Content for base and extended tags used by permission of the author, Max Maischein.
416 Appendix D - Snowbound Error Codes
Appendix D - Snowbound Error Codes
This appendix describes the error codes that are returned by function execution problems.
Error Codes
Table D.1: Detailed Status/Error Codes
Error Error Code Description Failed on memory allocation. Problem with a standard memory allocation. Please see Chapter 1, OUT_OF_MEMORY -1 Determining Memory Requirements for more information on the the amount of memory required. FILE_NOT_FOUND -2 Open call failed when trying to decompress an image. CORRUPTED_FILE -3 File format bad, or unreadable. BAD_STRING -4 String passed in is null or invalid. Internal DLL problem. Submit a support issue at http://support.snowbound.com and attach the BAD_RETURN -5 document you were processing when you received this error. CANT_CREATE_FILE -6 Fail on saving when attempting to create a new file. FORMAT_NOT_ Image was not recognized as a format the library can -7 ALLOWED decompress. Getobject() call failed to return bitmap header for using DDB functions or may be returned in formats NO_BITMAP_FOUND -8 that can contain vector information such as .WPG, .WMF and .PCT if no bitmap information is found. Error writing data to the disk. Standard file i/o write DISK_FULL -9 failed. Tried to display with negative coordinates or out of BAD_DISPLAY_AREA -10 range. Used for multi-page file format support when attempting to access a page which does not exist. PAGE_NOT_FOUND -11 This error code provides information of an empty Word-page which is not converted to an empty page in PDF or TIFF. File format was truncated and tried to read past end of DISK_READ_ERROR -12 file. Standard read i/o function failed. Application passed bad image handle. Not a valid BAD_HANDLE -13 Snowbound library image handle. NO_CLIPBOARD_IMAGE -14 Image not found on clipboard. TWAIN scanner driver not installed or not found NO_SCANNER_FOUND -15 (TWAIN.DLL). ERROR_OPENING_ -16 Bad scanner driver or driver not configured properly. SCANNER
417 Appendix D - Snowbound Error Codes
Error Error Code Description TWAIN scanner driver not installed or not found CANT_FIND_TWAIN_DLL -17 (TWAIN.DLL). Cancel out of low level save or low level decompress. USER_CANCEL -18 Usually not an error but termination of a function intentionally. Date on an evaluation copy of the Snowbound EVAL_TIMEOUT -19 product has expired. USING_RUNTIME -20 Version not allowed for design mode. Tried to save an image to a format that does not support the image’s bits per pixel. Or tried to perform PIXEL_DEPTH_ -21 an image processing function on an image whose bits UNSUPPORTED per pixel is not allowed. Please see a for the pixel depths of each supported format. PALETTE_IMAGES_NOT_ Some image processing operations does not work on -22 ALLOWED palette images. NO_LZW_VERSION -23 No LZW or GIF code in this version. The .jar file containing a class needed to complete the operation was not found. Please carefully examine your CLASSPATH to verify the syntax is correct, and the directory containing the RasterMaster Java.jar(s) is in the path. For Office 2007-2010 documents you may need to explicitly specify some .jars. Please see JAR_NOT_FOUND_24 -24 Office 2007-2010 Directory Files for more information. If you continue to receive this error contact Snowbound Support at http://support.snowbound.com and attach the document you were processing when you received this error. FORMAT_WILL_NOT_ -25 Format will not support on the fly decompression. OTFLY NO_TCOLOR_FOUND -26 No transparency color information found. COMPRESSION_NOT_ -27 Currently not supporting this compression format. SUPPORTED Returned when scanning has completed all pages in NO_MORE_PAGES -28 the document feeder. FEEDER_NOT_READY -29 No more pages ready in document feeder. NO_DELAY_TIME_ -30 No delay time was found for the animated GIF. FOUND TIFF_TAG_NOT_FOUND -31 Could not find the .TIF tag. NOT_A_TILED_IMAGE -32 Not recognized as a TIFF tiled image. You are using a version that does not support this function. You do not have support for this file format. NOT_SUPPORTED_IN_ Please open a support issue at -33 THIS_VERSION http://support.snowbound.com or contact your account representative to get information on the RasterMaster Javaoption that will allow you to
418 Appendix D - Snowbound Error Codes
Error Error Code Description process the file format. AUTOFEED_FAILED -34 Autofeed fail in the TWAIN Scanner. NO_FAST_TWAIN_ -35 TWAIN driver cannot do fast transfer. SUPPORTED The PDF processing option was not found. If you have the PDF processing option, please make sure NO_PDF_VERSION -36 the name of the directory containing Snowbound's pdfplug.dll is in the System environment variable Path. NO_ABIC_VERSION -37 No ABIC plug-in code in this version. Internal error. An exception occurred during processing. Please enter support issue at http://support.snowbound.com providing the document that was being processed. If the function being called was not a decompress bitmap, then EXCEPTION_ERROR -38 please include a small sample program that can be used to reproduce the issue. Please see Getting a ClassNotFoundException Error in Appendix D - Troubleshooting for more information on troubleshooting an exception error. NO_VECTOR_ -39 No vector plug-in found in this version. CAPABILITY The PCL processing option was not found. If you have the PCL processing option, please make sure NO_PCL_VERSION -40 the name of the directory containing Snowbound's pclplug.dll is in the System environment variable Path. NO_JPEG2000_VERSION -41 NO JPEG2000 plug-in found in this version. SEARCH_STRING_NOT_ -42 Did not find attempted search string. FOUND NO_WORD_VERSION -43 NO MS Word plug-in found in this version. PASSWORD_ -44 This PDF file was password protected. PROTECTED_PDF The Snowbound method was not found. Please METHOD_NOT_FOUND -45 check the spelling of the method name and Snowbound library version. Access denied. Please check the security ACCESS_DENIED -46 permissions. BAD_LICENSE_ -47 Primary level license loaded is bad. SECONDARY PASSWORD_ This file was password protected for Word or other -48 PROTECTED_FILE formats. PDF_PACKAGE_NOT_ This PDF file is part of a package that is not -49 SUPPORTED supported. JWEBENGINE_JAR_ -50 The jwebengine.jar is not in the classpath.
419 Appendix D - Snowbound Error Codes
Error Error Code Description NOT_IN_CLASSPATH JAVA_1_6_RUNTIME_ You must be running java 1.6 or better to use HTML -51 REQUIRED support. OOXML_LICENSE_NOT_ -52 The OOXML Aspose license file was not found. FOUND
OOXML_LICENSE_ The OOXML Aspose license file expired or is -53 EXPIRED otherwise invalid.
General Error Define Values Retrieved from Status Property
Table D.2: General Error Define Values Retrieved from Status Property
Error Value Description Code GENERAL_STATUS. If an internal exception is thrown, this is the resulting -100 SYSTEM_CRASH value. GENERAL_STATUS. -101 Image data of the object failed. DELETE_ERROR GENERAL_STATUS. -102 What the internal values are initially set to. DEFAULT GENERAL STATUS. 1 Operation completed successfully. SNOWBND_OK GENERAL STATUS. Operation failed. See StatusDetails property. SNOWBND_ERROR GENERAL_STATUS. Internal image data unavailable when trying to -103 IMAGE_NOT_AVAILABLE complete an operation. GENERAL STATUS. SNOWBND_API_NOT_ -104 API is not implemented. AVAILABLE GENERAL STATUS. -105 Parameter is not valid. NOT_VALID GENERAL STATUS. -106 General error display. DISPLAY_ERROR
General Status/Error Codes
Table D.3: General Status/Error Codes
420 Appendix D - Snowbound Error Codes
Error Description DELETE_ERROR The image in memory cannot be removed. Any problems with displaying an image will return this error DISPLAY_ERROR code. IMAGE_NOT_AVAILABLE No image data is available to do manipulations on. This is returned if a parameter passed into an API is not NOT_VALID valid. SNOWBND_API_NOT_ This is returned if an API method is not implemented in the AVAILABLE current build. SNOWBND_ERROR General API error code of an unsuccessful action. SNOWBND_OK General API status of a successful action. SYSTEM_CRASH This is returned when a Critical Exception is thrown.
421 Appendix E - Troubleshooting
Appendix E - Troubleshooting
This appendix describes solutions to issues that you may run across when installing and using RasterMaster Java.
Receiving an Error Code When Loading, Saving, or Converting a Document
If you receive an error code when trying to load, save or convert a document with RasterMaster Java, please check the list of error codes and their descriptions in Appendix D, Snowbound Error Codes to determine the source of the issue. If you still cannot resolve the issue after looking at the list of error codes, please submit a support ticket at http://support.snowbound.com and include the error code and the document that you were trying to load, save or convert when you got the error message.
Output Document Differs from Original Document
When you convert a document and the output document is different from the original document, please create a support ticket at http://support.snowbound.com and attach the document along with a screenshot of the output document in RasterMaster Java. Some examples of the differences that may occur include missing data, missing text, distorted graphics or displaying an incorrect or different font. We can test the document with the latest release of RasterMaster Java which contains fixes which may resolve your issue.
Output Document Displays Incorrect or Missing Characters
When you convert a document, the output document may display incorrect or missing characters if the document contains special characters which are commonly found in Non-English languages such as Chinese, Japanese and Thai. Make sure that your system is properly configured to support these characters. For more information, please see Snowbound Software’s Font Configuration Guide.
Output Document Has Much Larger File Size than the Original Document
The file size of your output document may be much larger than the original document if you are converting or merging a PDF, Word document or other document into a raster image. Appendix A, Supported File Formats shows a list of file formats and their supported bit depths. Please see the following suggestions to reduce the file size:
422 Appendix E - Troubleshooting
Use one of the following methods prior to decompression to reduce the output dots per inch (DPI) or bit depth. Please see Chapter 13, Image Quality Manipulation Methods for more detailed information.
l IMGLOW_set_document_input(int dpi, int bits_pix, int format) converts PDF, Word, Excel, PCL and AFP formats. Please see IMGLOW_set_document_input(int, int, int) for more information.
l IMGLOW_set_pcl_input(int dpi, int bits_pix) converts PCL formats only. Please see IMGLOW_set_pcl_input(int, int) for more information.
l IMGLOW_set_pdf_input(int dpi, int bits_pix) converts PDF formats only. Please see IMGLOW_set_pdf_input(int, int) for more information.
Use one of the following color reduction methods to reduce 8-bit and 24-bit images to smaller gray scale images. Please see Chapter 10, Color Manipulation Methods for more detailed information.
l IMG_color_gray() converts 24-bit color images to 8-bit gray scale images. Please see IMG_color_gray(void) for more information.
l IMG_resize_to_gray(int xsize, int ysize) resizes a 1-bit black and white image to a (smaller) 8-bit grayscale image. Please seeIMG_resize_to_gray(int, int) for more information.
l IMG_diffusion_mono() converts 4, 8 or 24 bit images to 1-bit per pixel bi-level images using the Stucky error diffusion technique. Please see IMG_diffusion_mono(void) for more information.
Output Document Has Much Lower Quality than the Original Document
The first step in obtaining better quality conversions is to check the original images or documents in the application where they originated such as Adobe Acrobat or Microsoft Word. If the original application is not available, try another viewer. If the quality is bad for the original image, then you may not be able to obtain any better quality in the conversion.
If this is a simple bitmap format such as TIFF, you can try adjusting the sharpening, contrast and brightness. To improve the quality of a 1-bit file format document, first convert it to gray scale using IMG_promote_8().
If the source image or document is vector or it is composed of text and drawing commands such as PDF, Word, or AFP, you can set the conversion to be 1-bit or increase the dots per inch using IMGLOW_set_document_input(Dpi, bits_pix, format). Please see IMGLOW_set_ document_input(int, int, int) for more information.
Please note that a higher resolution will almost always yield a better quality conversion but will probably result in a larger output file size.
423 Appendix E - Troubleshooting
Also it is common to convert to TIFF_G4. This is a 1-bit per pixel format. Make sure that if you are converting from a color image, that it is mostly text. There will be a noticeable loss in quality for pictures or color graphics such as logos when converting a color image to a 1-bit per pixel format. Text will usually work well.
If your document requires color, then try saving to a color output format such as TIFF_Packbits, TIFF_ JPEG or TIFF_LZW.
The output quality of your output document may be much lower than the original document if you convert a high quality image to a low quality output such as TIFF_G4_FAX. Please see the following suggestions to improve the quality of the output document:
Choose a different output format such as TIFF_LZW to produce an output document with sufficient pixel depth.Supported File Formats Supported File Formats shows a list of file formats and their supported bit depths.
Use one of the following methods prior to decompression to increase the output dots per inch (DPI) or bit depth. Please see Chapter 13, Image Quality Manipulation Methods for more detailed information.
l IMGLOW_set_document_input(int dpi, int bits_pix, int format) converts PDF, Word, Excel, PCL and AFP formats. Please see IMGLOW_set_document_input(int, int, int) for more information.
l IMGLOW_set_pcl_input(int dpi, int bits_pix) converts PCL formats only. Please see IMGLOW_set_pcl_input(int, int) for more information.
l IMGLOW_set_pdf_input(int dpi, int bits_pix) converts PDF formats only. Please see IMGLOW_set_pdf_input(int, int) for more information.
Use the color promotion method, IMG_promote_24(void), to promote 1-bit, 4-bit and 8-bit images to 24-bit images. Please see Chapter 10, Color Manipulation Methods for more detailed information.
Identifying an Unknown File Format
To identify an unknown file format, you can use the IMGLOW_get_filetype(String) method in RasterMaster Java. This method returns a number that corresponds to a file type as defined in the RasterMaster® SDK library. Please see Appendix A, Supported File Formats for a list of the Snowbound file type constants.
Characters not Displaying Correctly with Smart Quotes in RTF and MS Word Documents
An issue may occur with documents created by Microsoft Word when using the “Smart Quotes” auto-correction feature. Microsoft will insert Unicode versions of quote, apostrophe, dash, and bullet characters. This displays well on Microsoft systems with the appropriate fonts, but the document tends to display with boxes for those characters on Unix because those Unicode
424 Appendix E - Troubleshooting
characters are not in the fonts on that system. Also, some RTF and MS Word documents may word wrap incorrectly after an apostrophe. For example, the word member’s may display as member at the end of a line and the s would display at the beginning of the next line.
The current version of the MS Office option for RasterMaster Java does not include the special handling needed to treat smart quotes correctly. A future version of RasterMaster Java should resolve this issue.
Until the issue is resolved in RasterMaster Java, you can resolve this issue by disabling “Smart Quotes” in Microsoft when creating documents. Specific instructions differ depending on your MS Word version. If you Google for disable Microsoft Word smart quotes, you will find how to do this for your version of MS Word.
To create a document that displays better on Unix systems, please follow the steps below:
1. Open the document in MS Word.
2. Make sure that Smart Quotes are disabled if they are not already.
3. Select the character that is not displaying properly or do a search replace/all for that character.
4. Insert the equivalent ASCII character using Insert >Symbol.
5. Save the document.
Receiving a -3 Corrupted File Error code
If you receive a -3 corrupted file error code, the input document may have become corrupt. To resolve this issue, open the document in an editor and write it back out again.
Some PDF document generators do not properly specify all of the information needed in a document. To resolve this issue in PDF documents that are generated by custom applications, open the document in Adobe Acrobat and then save it. You should then be able to process the newly saved document in RasterMaster Java.
Overlapping Scrollbar Arrow
When invoking the IMG_display_bitmap_aspect method with both vertical and horizontal scrollbars enabled, the scroll arrow for the scrollbars may overlap in some cases. You can use one of the following ways to work around this issue:
l Adjust the height and width of the window.
l Adjust the zoom factor.
425 Appendix E - Troubleshooting
l Adjust the paint method used to display the bitmap and the scroll bars. Please see the sample Paint method below: public void paint(Graphics x_g) { Dimension p_dimension; Insets p_insets; if (g_clearFlag) { p_dimension = getSize(); p_insets = getInsets(); p_dimension.width -= (p_insets.right + p_insets.left); p_dimension.height -= (p_insets.top + p_insets.bottom); x_g.setColor(getBackground()); x_g.fillRect(0, 0, p_dimension.width, p_dimension.height); x_g.setColor(getForeground()); g_clearFlag = false; } if (g_snowbnd != null) { int p_stat = 0; p_dimension = getSize(); p_insets = getInsets(); x_g.translate(p_insets.left, p_insets.top); g_snowbnd.fit_to_width(0); g_snowbnd.fit_to_height(0); p_dimension.width -= (p_insets.right + p_insets.left); p_dimension.height -= (p_insets.top + p_insets.bottom); boolean hsbBeforePaint = g_snowbnd.hsb != null; boolean vsbBeforePaint = g_snowbnd.vsb != null; p_stat = g_snowbnd .IMG_display_bitmap_aspect(x_g, this, 0, 0, p_dimension.width, p_dimension.height, 75); boolean hsbAfterPaint = g_snowbnd.hsb != null; boolean vsbAfterPaint = g_snowbnd.vsb != null; boolean scrollBarAddedInDisplay = (hsbAfterPaint && !hsbBeforePaint) || (vsbAfterPaint && !vsbBeforePaint); if (scrollBarAddedInDisplay) {
/* paint again with new scollbar set up */ p_stat = g_snowbnd
426 Appendix E - Troubleshooting
.IMG_display_bitmap_aspect(x_g, this, 0, 0, p_dimension.width, p_dimension.height, 75); /* validate the container with the scroll bars */ validate(); } if (p_stat < 0) { System.out.println("Error display bitmap aspect: stat = " + p_stat); } } super.paintChildren(x_g); }
Overlay Resources Not Pulled into APF or MODCA Document
If overlay resources such as signatures are not being pulled into an AFP or MODCA document, then make sure that the resource filename does not have a filename extension. If the resource filename has a filename extension, remove it.
Searching for Text in a Snowbound Software Generated PDF
If you are having trouble finding text in a Snowbound Software generated searchable PDF, please use Adobe Reader version 9.4 to do the search.
Yellow, Red or Other Light Colored Content Disappear When Converting to Black and White Output
If yellow, red or other light colored content disappear when converting to black and white output, adjust the threshold. For more information, please see PrintStack. Increasing the threshold value will cause lighter content to be preserved during the conversion. To remove light-colored artifacts, the threshold value should be decreased.
427 Appendix E - Troubleshooting
Some TIFF_JPEG Files Produced By RasterMaster Java Do Not Open In Third Party Image Viewers
When converting a file to TIFF_JPEG with RasterMaster Java, you may see that the resulting TIFF is blank when opened in a third party image viewer such as MS Office Document Imaging or Windows Photo Viewer. In some cases, the viewer may also display an error message indicating that the TIFF is corrupted or too large.
This issue typically occurs when the file in question is converted at 1-bit black and white or 8-bit grayscale, rather than 24-bit color. By default, RasterMaster Java will often choose 1 bit/pixel to ensure better performance during conversion. Formats which are converted to 1-bit by default include AFP, DOC, XLS, and PCL. For these formats, we recommend that you call the IMGLOW_set_document_input() method prior to decompression if you wish to convert to TIFF_JPEG. Please see the following example:
Example E.1: IMGLOW_set_document_input Sample
status = s.IMGLOW_set_document_input(200, 24, Defines.DOC) status = s.IMG_decompress_bitmap("C:\\input\\file.doc", page); status = s.IMG_save_bitmap("C:\\output\\file.tif", Defines.TIFF_JPEG)
In the above example, the input DPI and bit-depth are set to 200 and 24 respectively for the input DOC file before being converted to TIFF_JPEG.
Please also note that while color input images (e.g. JPEG, TIFF, PNG) will be converted to 24 bits/pixel by default, you still might see this issue for black and white or grayscale input images. In the case where your input file is a black and white or grayscale image, you can promote the bit-depth to 24 by calling IMG_promote_24() after decompression. Please see the following example:
Example E.2: IMG_promote_24 Sample
status = s.IMG_decompress_bitmap("C:\\input\\file.png", page); status = s.IMG_promote_24(); status = s.IMG_save_bitmap("C:\\output\\file.tif", Defines.TIFF_JPEG)
This should produce an output TIFF that can be viewed by most third party image viewers.
Converting Text to JPEG on Lower Resolution Screen
JPEG is not the best compression to use for converting text. JPEG works for pictures and not images with hard black to white transitions. For display on a lower resolution screen and to see
428 Appendix E - Troubleshooting
better results when zoomed, try resizing the image with IMG_create_thumbnail(int, int), then convert to JPEG.
Getting a ClassNotFoundException Error
A return status of -38 EXCEPTION_ERROR indicates an exception was thrown. This usually includes a stack trace with information about what caused the exception. If the stack trace includes java.lang.NoClassDefFoundError: this indicates the issue is a missing .jar file. The name of the class following java.lang.NoClassDefFoundError: can be used to determine which .jar file cannot be found. Check your java CLASSPATH carefully to ensure the directory containing the .jar is in the path. Please feel free to contact Snowbound Support at http://support.snowbound.com for help determining which .jar is missing.
Getting Different Results When Using the Same Version of RasterMaster Java and the Same Document on Different Systems
The following are the two common reasons for different results when using the same version of RasterMaster Javaand the same document on different systems:
1. You may have different fonts configured and available for Java. Make sure that your system is properly configured to support the fonts that you are using. For more information, please see Snowbound Software’s Font Configuration Guide.
2. You may have different versions of Java installed. Please contact Snowbound support at http://support.snowbound.com for solutions if your system configurations are identical and you still see a significant difference.
429 Index: -1 error code – -42 error code
-22 error code 418 Index -23 error code 418
-24 error code 418 -
-1 error code 417 -25 error code 418
-10 error code 417 -26 error code 418
-100 error code 420 -27 error code 418
-101 error code 420 -28 error code 418
-102 error code 420 -29 error code 418
-103 error code 420 -3 error code 417
-104 error code 420 -30 error code 418
-105 error code 420 -31 error code 418
-106 error code 420 -32 error code 418
-11 error code 417 -33 error code 418
-12 error code 417 -34 error code 419
-13 error code 417 -35 error code 419
-14 error code 417 -36 error code 419
-15 error code 417 -37 error code 419
-16 error code 417 -38 error code 419
-17 error codee 418 -38 EXCEPTION_ERROR 429
-18 error code 418 -39 error code 419
-19 error code 418 -4 error code 417
-2 error code 417 -40 error code 419
-20 error code 418 -41 error code 419
-21 error code 418 -42 error code 419
430 Index: -43 error code – activate
-43 error code 419 2 -44 error code 419 24-bit -45 error code 419 convert to 32-bit CMYK 160 -46 error code 419 24-bit color image to 8-bit gray scale -47 error code 419 convert 153 -48 error code 419 24-bit image -49 error code 419 convert to 1-bit per pixel using -5 error code 417 threshold 58, 161
-6 error code 417 4 -7 error code 417 4-bit image -8 error code 417 convert to 1-bit per pixel using -9 error code 417 threshold 58, 161
1 8
1-bit image 8-bit gray scale
pointer to each compressed improve image 158, 166, 309 raster 120 8-bit image remove noise 60, 62, 155, 163, 299 convert to 1-bit per pixel using resize to 8-bit grayscale 184 threshold 58, 161
return skew angle 136, 307 A 1-bit skewed image Abstract Windowing Toolkit (AWT) fast rotate 60, 62, 154, 298 102
1 error code 420 ACCESS_DENIED error code 419
activate
text for editing in text area 61, 238
431 Index: add – ann_crop_ye
add or black and white 200, 202, 351, 353 new object 271 alternate contructor 54, 56, 366-367 new object to current annotation 239 angle
Adobe Reader 9.4 427 current display rotation angle 119
AFP ann_bblue
color document 200, 202, 351, 353 Snow.SnowANN field description 233 configuring on Unix 102 ann_bfred defined 369 Snow.SnowANN field file type 383 description 234 AFP resource ann_bgreen not displayed 427 Snow.SnowANN field AFP troubleshooting description 234
overlay 427 ann_bold alias Snow.SnowANN field
field settings 117, 121, 127 description 234
set 189, 345 ann_crop_xe alias_quality Snow.SnowANN field description 234 field settings 118 ann_crop_xs Snow.Snowbnd field defined 117- 118, 121-122 Snow.SnowANN field description 234 turn on and off 117-118, 121-122 ann_crop_ye allow Snow.SnowANN field document formats rendered in color description 234
432 Index: ann_crop_ys – annotation
ann_crop_ys construct new object 125
Snow.SnowANN field ANN_GRAPHIC_STRUCT class description 234 return 245 ann_cur_object_id ann_height Snow.SnowANN field Snow.SnowANN field description 234 description 234 ann_dblick ann_italic Snow.SnowAnn annotation method Snow.SnowANN field defined 236 description 234 ann_fblue ann_line_style Snow.SnowANN field Snow.SnowANN field description 234 description 234 ann_fgreen ann_line_width Snow.SnowANN field Snow.SnowANN field description 234 description 234 ann_font_height ann_width Snow.SnowANN field Snow.SnowANN field description 234 description 234 ann_font_name annotation Snow.SnowANN field add new object 239 description 234 append file to disk 261 ann_fred append to memory buffer 262 Snow.SnowANN field description 234 classes 232
ANN_GRAPHIC_STRUCT convert PDF 250
class variables 125 delete object 273
433 Index: annotation list – annotation list
deleted selected object 264 read from URL 252 deselect object 264 read page from disk 252 disallow editing on all SANN_EDIT resize object 249, 272 and SANN_POSTIT text resize object indicated by graphic based object 61, 240 number 253 disallow editing on SANN_EDIT return cropping rectangle 244 and SANN_POSTIT text based object 240 rotate all on image 254 display current to graphics SANN_POINT class 126
context 242 SANN_RECT class 126 graphic id parameter 271 select with mouse for editing 236 height of image 234 set background color 254 merge 249 set font for text 256 move object 249 set height and width 258 moving object instructions 272 set line style 256 notify library mouse button set width of line in library 257 release 267 specifications 232 notify library of current mouse toolkit defined 232 coordinates 267 using built in editing 271 notify library that object is resized 265 width of image 234 notify library that object moved 265 write to disk 259 print current to graphic context 250 write to memory buffer 258 read and save 232 annotation list read from DataInputStream 251 delete graphic from current list 241 read from disk 251
434 Index: annotation methods – annotation methods
annotation methods SANN_map_wnd_to_image 248
ann_dblick 236 SANN_merge_annotations 248
GetClientRect 237 SANN_move_object 249
read_xml_file 237 SANN_output_pdf 250
resize_object 238 SANN_print_annotations 250
SANN_activate_all_objects 238 SANN_read_ann (DataInputStream, int) 251 SANN_activate_object 239 SANN_read_ann(String) 251 SANN_add_object 239 SANN_read_ann(String, int) 252 SANN_deactivate_all_objects 240 SANN_read_ann_stream 252 SANN_deactivate_objects 240 SANN_recalc_size 253 SANN_delete_all_objects 241 SANN_resize_object 253 SANN_delete_object 241 SANN_rotate 254 SANN_display_annotations 242 SANN_set_bcolor 254 SANN_draw_object 243 SANN_set_croprect 60, 255 SANN_flipx 244 SANN_set_fcolor 255 SANN_flipy 244 SANN_set_font 256 SANN_get_croprect 244 SANN_set_line_style 256 SANN_get_graphic_struct 245 SANN_set_line_width 257 SANN_get_object_bounds 245 SANN_set_scrollbars 257 SANN_get_object_data 245 SANN_set_size 258 SANN_get_object_info 246 SANN_write_ann 258-259 SANN_get_object_num 246 SANN_write_ann(String, int, byte) SANN_highlight_object 247 261 SANN_map_image_to_wnd 248
435 Index: annotations – ASCII
SANN_write_ann_idml(String, xml_inches_pixels 270 String, int, int) 260 xml_read 270 SANN_write_ann_idml(String, annotations 271 String, String, int) 260 antique SANN_write_ann_pages(byte, int, byte) 262 convert images to look older 153, 162, 289 SANN_write_ann_xml(byte, Snow.SnowXMLWriter) APF
259, 262 text extraction 56, 66, 140, 332
SANN_write_ann_xml_document append (Snow.SnowXMLWriter) annotation to disk file 261 263 new file to annotation to memory SANN_write_ann_xml_page buffer 262 (Snow.SnowXMLWriter) 263 appending pages 213, 326 ui_delete 264 applet ui_exit 264 print image 227, 311 ui_rotate_object 265 print multipage high resolution document 228, 311 ui_startmove 265 ASCII ui_startresize 265 auto detection 225 ui_wm_lbuttondown 266 configuring on Unix 102 ui_wm_lbuttonup 267 described 369 ui_wm_mousemove 267 file format detection 225 xml_boolean 268 file size 225 xml_color 268 file type 382 xml_convert 269 xml_find_file 269
436 Index: ASCII file – black and white
ASCII file set 254
set attributes 190, 346 BAD_DISPLAY_AREA error code 417 asciiFont 191, 347 BAD_HANDLE error code 417 Aspose.Cells.Java.lic 101, 387 BAD_LICENSE_SECONDARY error Aspose.Slides.Java.lic 101, 387 code 419 Aspose.Total.Product.Family.lic 101, BAD_RETURN error code 417 387 BAD_STRING error code 417 Aspose.Words 387 banner Aspose.Words.Java.lic 101, 387 evaluation 384 attributes 190, 346 batch convert bold text 234 sample 53 italics for text 234 bicubic interpolation 168, 183, 315 set for ASCII file 190, 346 bit depth 65, 76-79, 87, 104-105, 107- Author tag 221, 347 108, 131-132, 211, 219, 286, auto detection 310, 317-320
file format during conversion 65 return image 131, 286
AUTOFEED_FAILED error code 419 bitmap
AWT convert PDF 206, 359
configuring Unix server for 102 fill area with pattern 180, 305
render PCL file 205, 358 B
background color scroll 186, 322
current blue drawing color 233 black and white
current green drawing color 234 conversion 200, 202, 351, 353
current red drawing color 234 IMG_diffusion_mono(void) 157
437 Index: blank page detection – CCITT_G4_FO
IMG_promote_24(void) 159 burn in redactions 249
IMG_resize_to_gray(int,int) 184 byte array
set relative difference 192, 349 save image 59, 76-77, 104-105, 317-318 blank page detection 138, 160, 169, 215, 324, 328 C blur calculate first zoom increment 133, image 160, 169, 324 287 bmargin 191, 346 call
BMP_COMPRESSED for scanning 276
file type 381 CALS
BMP_UNCOMPRESSED described 369
file type 381 file type 381 bold canSaveBitDepth(int) 87
text 234 CANT_CREATE_FILE error code 417 boolean CANT_FIND_TWAIN_DLL error code 418 convert 268 CCITT_G3 bounding box file type 382 highlight specified by graphic number 247 CCITT_G3_FO
return for object in image pixel file type 382 coordinates 245 CCITT_G4 BRK file type 382 defined 369 CCITT_G4_FO BROOK_TROUT file type 382 file type 382
438 Index: CFF – color
CFF snowbound image object 47
file type 383 ClassNotFoundException 429
change clip
DPI information 111, 116 white border 162, 174, 289
internal size of image 167, 182, CLIP 314 file type 369, 382 range of displayed pixels 188, 325 close charpline 191, 346 scanner 278 charSpacing 191, 347 cmap-all.jar 389 CIFF COD file type 383 defined 369 CIMS file type 370, 383 file type 383 color 65, 76-79, 87, 104-105, 107-108, CIMS (ABIC) 131-132, 211, 219, 286, 310, 317-320 described 369 conversion class IMG_color_gray(void) 153 main annotation class 125 IMG_diffusion_mono(void) 157 placing in classpath directory 46 IMG_rgb_to_cmyk(void) 160 SANN_POINT 126 current blue background drawing SANN_RECT 126 color 233 scanInterface 276 current blue foreground drawing SnbdWarningCode 127 color 234
Snow.SnowAnn, Snow.SnowAnn current green background drawing defined 122, 235 color 234
snow.snowbnd 117
439 Index: color detection – convert
current green foreground drawing new object with ANN_GRAPHIC_ color 234 STRUCT 125
current red background drawing snowbound object 47 color 234 constructor current red foreground drawing Snowbnd object 54, 56, 366-367 color 234 container fill inside or outside of rectangle 60, 164, 179, 303 height 119
retaining 200, 202, 351, 353 width 119
set background color 254 conversion color detection black and white
sample 58 IMG_diffusion_mono(void) 157 color integer IMG_promote_24(void) 159
convert 268 IMG_resize_to_gray(int,int) 184 compressed data color
create tiff 81, 361 IMG_color_gray(void) 153 compression IMG_diffusion_mono(void) 157
format 104 IMG_diffusion_mono(void)IMG_ diffusion_mono(void) set quality for saving JPEG 200, 157 348 IMG_rgb_to_cmyk(void) 160 COMPRESSION_NOT_ SUPPORTED error code 418 convert construct 1, 4, 16 or 24-bit image to 8-bit 158
annotation object 122, 235 1, 4, or 8-bit image to 24-bit 159
default constructor 117 24-bit color image to 8-bit gray scale 153
440 Index: coordinates – DCX
4, 8, or 24-bit to 1-bit per pixel using create threshold 58, 161 thumbnail 68, 290 auto detect file format 65 cropping rectangle current window coordinates to return for current annotation 244 internal graphics coordinates 248 set 60, 255
image coordinate to screen set for display engine 196, 363
coordinates 196, 362 x position 234
image from 24-bit RGB to 32-bit x size 234 CMYK 160 y position 234 image to antique 153, 162, 289 y size 234 internal graphics coordinate of current display rotation angle 119 image to current window 248 CUT
PDF to bitmap 206, 359 file type 370, 382
pixel depth 65 D sample 51, 53-54 DataInputStream 212, 220 screen coordinates to image read annotation file 251 coordinates 196, 362 Date tag 142, 221, 334, 347 timeout 55 DCS coordinates file type 370, 382 draw object 243 DCX last display coordinate 120 defined 370 corrupted file file type 381 error code 425
CORRUPTED_FILE error code 417
441 Index: decompress – DIB
decompress delete
fax or proprietary image all graphics and memory of formats 74, 296 object 241
image 68, 209, 291 currently selected annotation object 264 image from DataInputStream 70, 292 graphic from current annotation list 241 multipage image from URL 75, 297 object 273 orientation of last image 145, 338 page 327-328 partially downloaded image 73, 295 DELETE_ERROR error code 421 set destination size 193, 349 demo specify rectangle 193, 350 running 45, 50 decompressing deselect TIFF image 142, 334 currently selected annotation decompressing document object 264 warnings 150, 341 destination default constructor 117 set container for image definition display 198, 365
Snow.ANN_GRAPHICS_ destination size STRUCT 125 set for saving pdf files 90, 195, 359 Snow.Defines 124 Development Kit for the Java Snow.SnowAnn 122, 235 platform 47
snow.snowbnd 117 device
stucky error diffusion 226 set scan device 64, 278
DIB
described 370
442 Index: DICOM – DISK_READ_ERROR error code
file type 382 dis_width
DICOM Snow.Snowbnd field defined 119
described 370 dis_xs
file type 382 Snow.Snowbnd field defined 120
difference dis_xsize
set black and white 192, 349 Snow.Snowbnd field defined 120
dis_crop_xe dis_ys
Snow.Snowbnd field defined 118 Snow.Snowbnd field defined 120
dis_crop_xe, dis_crop_ye 118 dis_ysize
dis_crop_xs Snow.Snowbnd field defined 120
Snow.Snowbnd field defined 118 disallow
dis_crop_xs, dis_crop_ys 118 editing on all SANN_EDIT and SANN_POSTIT text based dis_crop_ye object 61, 240 Snow.Snowbnd field defined 118 editing on SANN_EDIT and dis_crop_ys SANN_POSTIT text based
Snow.Snowbnd field defined 118 object 240
dis_dib disk
Snow.Snowbnd field defined 119 append annotation file to disk 261
dis_height read annotation file 251
Snow.Snowbnd field defined 119 read page of annotation file 252
dis_rotate write annotation to disk 259
Snow.Snowbnd field defined 119 DISK_FULL error code 417
dis_runs_ptrs DISK_READ_ERROR error code 417
Snow.Snowbnd field defined 120
443 Index: display – DOCX license file path
display Snow.Snowbnd method defined 172, 284 change range of displayed pixels 188, 325 DISPLAY_ERROR error code 421
current annotation to graphics dll context 242 scandll 276 current display rotation angle 119 DOC current image at current X and Y described 370 coordinates 60, 62, 175-176, 178, 300, 302 file type 383
image with aspect ratio 176, 178, Docs directory
300, 302 files 386
image with no aspect ratio 60, 62, document 175, 300 number of pages in multipage 146- multipage image from URL 75, 297 147, 217-218, 338-339
partially downloaded image 73, 295 document feeder
rotate image 172, 284 TWAIN scanning 64, 277
set destination container for document formats image 198, 365 rendered in color or black and display area white 200, 202, 351, 353
fill SANN_RECT object with height DOCX and width 237 described 370 display engine file type 383 set cropping rectangle 196, 363 DOCX license file path display_angle get 335 method settings 172, 284 set 351 rotate clockwise 169, 185, 210, 316
444 Index: DOCX license filename – EPS
DOCX license filename drawing name
set 351 current selected 234
DPI 90, 99-100, 134-135, 190, 200, DWG 202, 205-207, 227, 229, 288- file type 371, 383 289, 312-313, 346, 351, 353, 358-359, 365-366 DXF
changing 111, 116 file type 371, 383
set resolution along x-axis of E image 206, 365 edit set resolution along y-axis of activate area for editing 61, 238 image 207, 366 disallow on all SANN_EDIT and viewing 111, 116 SANN_POSTIT text based draw object 61, 240
line width 234 disallow on SANN_EDIT and
object at passed in SANN_POSTIT text based coordinates 243 object 240
source image onto current select annotation with mouse 236
image 219, 309 text object on SANN_EDIT and
drawing color SANN_POSTIT objects 239
current blue background value 233 using built-in annotation editing 271
current blue foreground value 234 editing
current green background photo 162
value 234 EPS
current green foreground value 234 described 371
current red background value 234 file type 381
current red foreground value 234
445 Index: EPS_BITMAP – error code
EPS_BITMAP -14 417
described 371 -15 417
file type 371, 382 -16 417
EPS_BITMAP_G4 -17 418
file type 371, 382 -18 418
EPS_BITMAP_LZW -19 418
file type 371, 383 -2 417 erro code -20 418
-6 417 -21 418 error -22 418
ClassNotFoundException 429 -23 418 error code -24 418
-1 417 -25 418
-10 417 -26 418
-100 420 -27 418
-101 420 -28 418
-102 420 -29 418
-103 420 -3 417, 425
-104 420 -30 418
-105 420 -31 418
-106 420 -32 418
-11 417 -33 418
-12 417 -34 419
-13 417 -35 419
446 Index: error code method – error code
-36 419 BAD_LICENSE_ SECONDARY 419 -37 419 BAD_RETURN 417 -38 419 BAD_STRING 417 -39 419 CAN_CREATE_FILE 417 -4 417 CANT_FIND_TWAIN_DLL 418 -40 419 COMPRESSION_NOT_ -41 419 SUPPORTED 418 -42 419 corrupted file 425 -43 419 CORRUPTED_FILE 417 -44 419 DELETE_ERROR 421 -45 419 DISK_FULL 417 -46 419 DISK_READ_ERROR 417 -47 419 DISPLAY_ERROR 421 -48 419 ERROR_OPENING_ -49 419 SCANNER 417
-5 417 EVAL_TIMEOUT 418
-7 417 EXCEPTION_ERROR 419
-8 417 FEEDER_NOT_READY 418
-9 417 FILE_NOT_FOUND 417
1 420 FORMAT_NOT_ALLOWED 417
ACCESS_DENIED 419 FORMAT_WILL_NOT_
AUTOFEED_FAILED 419 OTFLY 418
BAD_DISPLAY_AREA 417 GENERAL_ STATUS.DEFAULT 420 BAD_HANDLE 417
447 Index: error code method – error code
GENERAL_STATUS.DELETE_ NO_PCL_VERSION 419 ERROR 420 NO_PDF_VERSION 419 GENERAL_STATUS.DISPLAY_ NO_SCANNER_FOUND 417 ERROR 420 NO_TCOLOR_FOUND 418 GENERAL_STATUS.IMAGE_ NOT_AVAILABLE 420 NO_VECTOR_CAPABILITY 419
GENERAL_STATUS.NET_ NO_WORD_VERSION 419
VALID 420 NOT_A_TILED_IMAGE 418
GENERAL_ NOT_SUPPORTED_IN_THIS_ STATUS.SNOWBND_API_ VERSION 418 NOT_AVAILABLE 420 NOT_VALID 421 GENERAL_ OUT_OF_MEMORY 417 STATUS.SNOWBND_ OK 420 PAGE_NOT_FOUND 417
GENERAL_STATUS.SYSTEM_ PALETTE_IMAGE_NOT_ CRASH 420 ALLOWED 418
IMAGE_NOT_AVAILABLE 421 PASSWORD_PROTECTED_ FILE 419 JAR_NOT_FOUND_24 418 PASSWORD_PROTECTED_ METHOD_NOT_FOUND 419 PDF 419 NO_ABIC_VERSION 419 PDF_PACKAGE_NOT_ NO_BITMAP_FOUND 417 SUPPORTED 419
NO_CLIPBOARD_IMAGE 417 PIXEL_DEPTH_
NO_DELAY_TIME_FOUND 418 UNSUPPORTE 418
NO_FAST_TWAIN_ SEARCH_STRING_NOT_ SUPPORTED 419 FOUND 419
NO_JPEG2000_VERSION 419 SNOWBND_API_NOT_ AVAILABLE 421 NO_MORE_PAGES 418
448 Index: error code method – fields
SNOWBND_ERROR 421 exception
SNOWBND_OK 421 print stack trace 121
SYSTEM_CRASH 421 EXCEPTION_ERROR error code 419
TIFF_TAG_NOT_FOUND 418 extract page 139, 216, 331
USER_CANCEL 418 extract text 56, 66, 140, 332
USING_RUNTIME 418 F error code method factor getErrorMessage() 88 set gamma correction 203, 355 error codes fast rotate definitions 417, 420 1-bit skewed image 60, 62, 154, error codeZ 298
NO_LZWZ_VERSION 418 feeder
error message scanning using automatic feeder 64, 277 when converting file format 66 FEEDER_NOT_READY error ERROR_OPENING_SCANNER error code 418 code 417 fields EVAL_TIMEOUT error code 418 alias 117, 121, 127 evaluation banner 384 alias_quality 118 Excel dis_crop_xe 118 color document 200, 202, 351, 353 dis_crop_xs 118 text extraction 56, 66, 140, 332 dis_crop_ye 118 EXCEL dis_crop_ys 118 described 371 dis_dib 119 file type 383 dis_height 119
449 Index: file format – file type
dis_rotate 119 CCITT_G4_FO 382
dis_runs_ptrs 120 CFF 383
dis_width 119 CIFF 383
dis_xs 120 CIMS 383
dis_xsize 120 CLIP 369, 382
dis_ys 120 COD 370, 383
dis_ysize 120 CUT 370, 382
fit_to_width 174, 286 DCS 370, 382
hsb 121 DCX 381
vsb 121 DIB 382 file format DICOM 382
auto detection 65 DOC 383
error when converting 66 DOCX 383
overview 65 DWG 371, 383 file type DXF 371, 383
AFP 383 EPS 381
ASCII 382 EPS_BITMAP 371, 382
BMP_COMPRESSED 381 EPS_BITMAP_G4 371, 382
BMP_UNCOMPRESSED 381 EPS_BITMAP_LZW 371, 383
BROOK_TROUT 382 EXCEL 383
CALS 381 FILENET 383
CCITT_G3 382 FLASHPIX 372, 382
CCITT_G3_FO 382 GIF 381
CCITT_G4 382 GIF_INTERLACED 382
450 Index: file type constants – file type
GX2 372, 382 OOXML 383
HTML 383 PCL_1 382
ICONTYPE 372, 382 PCL_5 383
IFF_ILBM 372, 382 PCX 381
IMG 372, 382 PDF 382
IMNET 382 PDF_15 383
IOCA 382 PDF_16 383
JBIG 383 PDF_LZW 383
JBIG2 383 PHOTOCD 377, 382
JEDMICS 382 PHOTOSHOP 377, 382
JPEG 381 PICT 377, 381
JPEG2000 383 PNG 382
KOFAX 373, 382 POWER_POINT 383
LASER_DATA 373, 381 PPTX 383
LINE_DATA 373, 383 RAST 378, 382
MACPAINT 373, 382 RTF 383
MAG 373, 382 SCITEX 378, 382
MSG 373, 383 TARGA 378, 381
MSP 373, 382 TARGA16 378, 382
NCR 383 TIF_G4_FAX_STRIP 379, 383
ODF 383 TIF_HUFFMAN 379, 381
ODP 383 TIFF_2D 379, 381
ODS 383 TIFF_ABIC 379, 382
ODT 383 TIFF_ABIC_BW 379, 382
451 Index: file type constants – fit_to_height
TIFF_G3_FAX 379, 381 filename extension 427
TIFF_G4_FAX 379, 381 FileNet
TIFF_G4_FAX_FO 379, 382 defined 372
TIFF_JBIG 383 FILENET
TIFF_JPEG 380, 382 file type 383
TIFF_JPEG7 380, 383 files
TIFF_LZW 380-381 Docs directory 386
TIFF_PACK 380-381 Images directory 386
TIFF_UNCOMPRESSED 381 installed 386
WBMP 380, 383 Marketing directory 386
WINFAX 380, 382 Word2007 directory 387
WMF 380-381 filetype
WPG 380-381 image 145, 337
XBM 380-381 fill
Xerox_EPS 380, 382 area of bitmap with pattern 180, 305 XLSX 381, 383 inside or outside of rectangle with XPM 381-382 color 60, 164, 179, 303 XWD 381-382 SANN_RECT object with height file type constants and width of display
PDF_15 375 area 237
PDF_16 376 find
FILE_NOT_FOUND error code 417 white border 162, 174, 289 filename fit_to_height
image 144, 336 method variables 173, 285
452 Index: fit_to_width – Format Hash methods
Snow.Snowbnd method image 114 defined 173, 285 Format Class methods fit_to_width canSaveBitDepth(int) 87 method settings 174, 286 getDisplayName() 87 Snow.Snowbnd method getExtension() 87 defined 173, 285 getFormatCode() 87 FLASHPIX getFormatName() 87 file type 372, 382 isMultipage() 88 flip isTiff() 88 image horizontally 60, 62, 165, 181, 305 isVectorFormat() 88
image vertically 165, 181, 306 toString() 88
font format conversion
height 234 sample 51, 53
selecting drawing name 234 Format Hash methods
set for annotation text 256 getAvailibleSaveFormats(int) 83
font mapping getAvailibleSaveFormats(String) 84 format 96 getFormat(int) 84 foreground color getFormat(String) 84 current blue drawing color 234 getFormatCode(String) 85 current green drawing color 234 getFormatExtension(int) 85 current red drawing color 234 getFormatExtension(String) 85 set for all objects 255 getFormatName(String) 85 format getInstance() 83 header 113
453 Index: FORMAT_NOT_ALLOWED error code – getErrorMessage()
isValidMultiFormat(int) 86 API_NOT_AVAILABLE error code 420 isValidMultiFormat(String) 86 GENERAL_STATUS.SNOWBND_ isVectorFormat(int) 86 ERROR 420 FORMAT_NOT_ALLOWED error GENERAL_STATUS.SNOWBND_ code 417 OK error code 420 FORMAT_WILL_NOT_OTFLY error GENERAL_STATUS.SYSTEM_ code 418 CRASH error code 420 FormatHash 83 get functions DOCX license file path 335 printing 226 getAvailibleSaveFormats(int) 83
G getAvailibleSaveFormats(String) 84 gamma correction getBitsPerPixel
set factor 203, 355 Snow.Snowbnd method general error define values 420 defined 131, 286
GENERAL_STATUS.DEFAULT error GetClientRect
code 420 Snow.SnowAnn annotation method
GENERAL_STATUS.DELETE_ defined 237
ERROR error code 420 getCropboxX
GENERAL_STATUS.DISPLAY_ Snow.Snowbnd method ERROR error code 420 defined 131
GENERAL_STATUS.IMAGE_NOT_ getCropboxY AVAILABLE error code 420 Snow.Snowbnd method GENERAL_STATUS.NOT_VALID defined 132 error code 420 getDisplayName() 87 GENERAL_STATUS.SNOWBND_ getErrorMessage() 88
454 Index: getExtension() – graphic object
getExtension() 87 getYdpi
getFormat(int) 84 Snow.Snowbnd method defined 135, 289 getFormat(String) 84 GIF getFormatCode() 87 described 372 getFormatCode(String) 85 file type 381 getFormatExtension(int) 85 GIF_INTERLACED getFormatExtension(String) 85 described 372 getFormatName() 87 file type 382 getFormatName(String) 85 graphic getHeight delete from current annotation Snow.Snowbnd method list 241 defined 133, 287 delete from memory of object 241 getInitialZoom display current annotation to Snow.Snowbnd method graphic context 242 defined 133, 287 graphic context getInstance() 83 print current annotation 250 getWarningCode(int Index) 128 graphic id 271 getWarningCodes() 127 graphic number getWarningMessage(int Index) 127 highlight bounding box 247 getWidth resize object 253 Snow.Snowbnd method defined 134, 288 return for annotation object 246
getXdpi graphic object
Snow.Snowbnd method handle 235 defined 134, 288 number 235
455 Index: graphic_num – image
graphic_num reverse image to create mirror image 244 Snow.SnowANN field description 235 hsb
GX2 Snow.Snowbnd field defined 121
file type 372, 382 HTML
configuring on Unix 102 H described 372 handle file type 382-383 graphic object 235
return for image 282 I hang 55 ICONTYPE hasWarnings() 127 file type 372, 382 header format 113 IFF_ILBM headless 103 file type 372, 382 height image 114
annotated image 234 antique look 153, 162, 289
container 119 blur 160, 169, 324
font 234 calculate first zoom increment 133, 287 image 133, 287 change internal size 167, 182, 314 set for annotation 258 changing DPI information 111, 116 highlight convert 1, 4, 16, of 24-bit to 8- bounding box specified by graphic bit 158 number 247 convert 1, 4, or 8-bit to 24-bit 159 horizontal convert 24-bit RGB image to 32-bit flip image 60, 62, 165, 181, 305 CMYK 160
456 Index: Image File Directories (IFDs) – horizontal
convert screen coordinates to filetype 145, 337 image coordinates 196, 362 fill in bits per pixel 143, 336 coordinate to screen fill in height 143, 336 coordinates 196, 362 fill in width 143, 336 current image at current X and Y coordinates 60, 62, 175-176, find white border around 178, 300, 302 image 162, 174, 289
decompress 68, 209, 291 flip horizontally 60, 62, 165, 181, 305 decompress fax or proprietary formats which use CCITT flip vertically 165, 181, 306
G3 or G4 74, 296 format 114
decompress from header format 113 DataInputStream 70, 292 height of annotated image 234 decompress partially downloaded improve 8-bit gray scale image 73, 75, 295, 297 image 158, 166, 309 display partially downloaded invert 62, 158, 309 image 73, 295 merge annotation 249 display partially downloaded multipage image 75, 297 palette format 114
display with aspect ratio 176, 178, print image 226, 312 300, 302 print image loaded into applet 227, display with no aspect ratio 60, 62, 311 175, 300 printing 226 draw source image onto current produce mirror image 60, 62, 165, image 219, 309 181, 305-306 fast rotate for 1-bit skewed remove noise from 1-bit image 60, image 60, 62, 154, 298 62, 155, 163, 299 filename 144, 336
457 Index: Image File Directories (IFDs) – IMG_auto_crop_bitmap
resize 1-bit image to 8-bit set resolution along x-axis in grayscale 184 DPI 206, 365 return bit depth of image 131, 286 set resolution along y-axis in DPI 207, 366 return block of data and create object 135, 306 sharpen 138, 160, 169, 215, 324, 328 return data 282 skew angle for 1-bit image 136, return data for handle 282 307 return height 133, 287 viewing DPI information 111, 116 return orientation 175, 290 width of annotated image 234 return width 134, 288 x resolution 134, 288 reverse to create horizontal mirror Image File Directories (IFDs) 390 effect 244 image handle 282 reverse to create vertical mirror effect 244 IMAGE_NOT_AVAILABLE error code 421 rotate all annotations 254 Images directory rotate at display time 172, 284 files 386 rotate clockwise by display angle 169, 185, 210, 316 IMG save to byte array 59, 76-77, 104- file type 372, 382 105, 317-318 IMG_antique_effect saving 124 Snow.Snowbnd method scale using bicubic defined 153, 162, 289 interpolation 168, 183, 315 IMG_auto_crop_bitmap set destination container for image Snow.Snowbnd method display 198, 365 defined 162, 174, 289 set rectangular area for scrollbars 197, 363
458 Index: IMG_auto_orient – IMG_deskew_bitmap
IMG_auto_orient IMG_decompress_bitmap_stream (String, int) Snow.Snowbnd method defined 175, 290 method variables 294
IMG_color_gray(void) Snow.Snowbnd method defined 72, 294 Snow.Snowbnd method defined 153 IMG_decompress_bitmap_stream_ onthefly IMG_create_thumbnail Snow.Snowbnd method Snow.Snowbnd method defined 73, 295 defined 68, 290 IMG_decompress_fax IMG_create_thumbnail(int, int) 428 (java.io.DataInputStream, int, IMG_decompress_bitmap int, int, int, int) (java.awt.Image, int) Snow.Snowbnd method Snow.Snowbnd method defined 70 defined 74, 296
IMG_decompress_bitmap IMG_decompress_fax (java.io.DataInputStream, int) (java.lang.String, int, int, int, int,
Snow.Snowbnd method int)
defined 70, 292 method variables 296
IMG_decompress_bitmap(String, int) Snow.Snowbnd method
Snow.Snowbnd method defined 73, 295
defined 68, 209, 291 IMG_decompress_multipage_bitmap_
IMG_decompress_bitmap_fd(String, stream_onthefly
int, int) Snow.Snowbnd method
method variables 294 defined 75, 297
Snow.Snowbnd method IMG_deskew_bitmap
defined 72, 294 method variables 154, 298
Snow.Snowbnd method defined 154, 298
459 Index: IMG_despeckel_bitmap – IMG_merge_block
IMG_despeckel_bitmap IMG_flip_bitmapy
method variables 155, 163 Snow.Snowbnd method defined 165, 181, 306 Snow.Snowbnd method defined 155, 163, 299 IMG_get_bitmap_block
IMG_diffusion_mono(void) 157 method variables 135
IMG_display_bitmap Snow.Snowbnd method defined 135, 306 Snow.Snowbnd method defined 175, 300 IMG_get_deskew_angle
IMG_display_bitmap_aspect 425 method variables 137
Snow.Snowbnd method Snow.Snowbnd method defined 176, 300 defined 136, 307
IMG_display_bitmap_smooth IMG_get_scanned_image()
Snow.Snowbnd method method variables 282 defined 178, 302 IMG_get_scanned_image_bytes() 282 IMG_erase_rect function variables 282 method variables 304 IMG_get_version Snow.Snowbnd method Snow.Snowbnd method defined 164, 179, 303 defined 137, 308 IMG_fill_bitmap_pattern IMG_histogram_equalize method variables 305 Snow.Snowbnd method Snow.Snowbnd method defined 157, 166, 308 defined 180, 305 IMG_invert_bitmap IMG_flip_bitmapx Snow.Snowbnd method Snow.Snowbnd method defined 158, 309 defined 165, 181, 305 IMG_merge_block
method variables 310
460 Index: IMG_print_applet – IMG_save_bitmap(String, int)
Snow.Snowbnd method IMG_resize_bitmap_bicubic defined 219, 309 Snow.Snowbnd method IMG_print_applet defined 168, 183, 315
Snow.Snowbnd method IMG_resize_to_gray(int,int) defined 227, 311 Snow.Snowbnd method IMG_print_applet_pages defined 184
Snow.Snowbnd method IMG_rgb_to_cmyk(void) defined 228, 311 Snow.Snowbnd method IMG_print_bitmap defined 160
Snow.Snowbnd method IMG_rotate_bitmap defined 226, 312 Snow.Snowbnd method IMG_promote_24 428 defined 169, 185, 210, 316
IMG_promote_24(void) IMG_save_bitmap
Snow.Snowbnd method method variables 105 defined 159 Snow.Snowbnd method IMG_promote_8(void) defined 76, 104, 317
Snow.Snowbnd method IMG_save_bitmap(byte, int, int, int) defined 158 method variables 106 IMG_remove_red_eye Snow.Snowbnd method method variables 159, 166, 313 defined 77, 105, 318
Snow.Snowbnd method IMG_save_bitmap(int, int, int, int) defined 159, 166, 313 method variables 107 IMG_resize_bitmap Snow.Snowbnd method Snow.Snowbnd method defined 78, 106, 211, 319 defined 167, 182, 314 IMG_save_bitmap(String, int)
method variables 108
461 Index: IMG_save_document(byte, bye, int) – IMGLOW_append_page
Snow.Snowbnd method IMG_scan_set_caps() 281 defined 79, 107, 320 function variables 281 IMG_save_document(byte, bye, int) IMG_scan_setup() 281 method variables 109, 322 IMG_scroll_bitmap IMG_save_document(byte, byte, int) Snow.Snowbnd method Snow.Snowbnd method defined 186, 322 defined 81, 109, 321 IMG_set_croprect IMG_save_document(String, bye, int) Snow.Snowbnd method method variables 109 defined 187, 323
IMG_save_document(String, byte, int) IMG_sharpen_bitmap
Snow.Snowbnd method Snow.Snowbnd method defined 80, 108, 321 defined 160, 169, 324
IMG_scan_acquire() 277 IMG_shift_bitmap
function variables 277 Snow.Snowbnd method defined 187, 325 IMG_scan_acquire_feeder() 278 IMG_thresh_mono function variables 278 method variables 161 IMG_scan_feeder_close() 278 Snow.Snowbnd method IMG_scan_get_cap() 280 defined 161 IMG_scan_get_source_list() 279 IMG_window_level IMG_scan_open_source() 278 Snow.Snowbnd method IMG_scan_pages() 279 defined 188, 325
function variables 279 IMGLOW_append_page 326
IMG_scan_set_cap() 280 Snow.Snowbnd method
function variables 280 defined 212-213, 220
462 Index: IMGLOW_delete_page – IMGLOW_get_image_orientation
IMGLOW_delete_page IMGLOW_get_contrast() 143, 335
Snow.Snowbnd method IMGLOW_get_docx_license_filename defined 213-214 Snow.Snowbnd method IMGLOW_delete_page_string 327- defined 335 328 IMGLOW_get_docx_license_path IMGLOW_detect_blank_page Snow.Snowbnd method Snow.Snowbnd method defined 335 defined 137, 214, 328 IMGLOW_get_fileinfo IMGLOW_detect_color method variables 144 Snow.Snowbnd method Snow.Snowbnd method defined 155, 170, 329 defined 143, 336 IMGLOW_extract_page IMGLOW_get_filetype method variables 139, 216 (java.io.DataInputStream)
Snow.Snowbnd method method variables 145 defined 139, 216, 331 Snow.Snowbnd method IMGLOW_extract_text defined 145, 337
method variables 140 IMGLOW_get_filetype(String)
Snow.Snowbnd method method variables 144 defined 140, 151, 332 Snow.Snowbnd method IMGLOW_get_bitmap_date defined 144, 336
Snow.Snowbnd method IMGLOW_get_gamma() 145, 337 defined 142 IMGLOW_get_image_orientation IMGLOW_get_bitmap_name Snow.Snowbnd method Snow.Snowbnd method defined 145, 338 defined 142, 334
IMGLOW_get_brightness() 143, 335
463 Index: IMGLOW_get_ooxml_license_path – IMGLOW_set_contrast
IMGLOW_get_ooxml_license_path IMGLOW_redact_page
Snow.Snowbnd method Snow.Snowbnd method defined 100 defined 94-95, 342-343
IMGLOW_get_pages IMGLOW_search_text (java.io.DataInputStream) method variables 345 method variables 146, 217 Snow.Snowbnd method Snow.Snowbnd method defined 150, 344 defined 146, 217, 338 IMGLOW_set_alias 189, 345 IMGLOW_get_pages(String) IMGLOW_set_ascii_attributes method variables 147, 218 method variables 346 Snow.Snowbnd method Snow.Snowbnd method defined 147, 218, 339 defined 190, 346 IMGLOW_get_raster IMGLOW_set_bitmap_name Snow.Snowbnd method Snow.Snowbnd method defined 148, 339 defined 221, 347 IMGLOW_get_tiff_tag 390 IMGLOW_set_brightness Snow.Snowbnd method Snow.Snowbnd method defined 148, 340 defined 191, 348 IMGLOW_get_warnings IMGLOW_set_comp_quality Snow.Snowbnd method Snow.Snowbnd method defined 150, 341 defined 200, 348 IMGLOW_put_raster IMGLOW_set_contrast method variables 342 Snow.Snowbnd method Snow.Snowbnd method defined 192, 349 defined 189, 342
464 Index: IMGLOW_set_decomp_size – IMGLOW_set_pdf_flags
IMGLOW_set_decomp_size IMGLOW_set_image_orientation
Snow.Snowbnd method Snow.Snowbnd method defined 193, 349 defined 194, 356
IMGLOW_set_decomprect IMGLOW_set_jpg_interleave
method variables 350 Snow.Snowbnd method defined 204, 357 Snow.Snowbnd method defined 350 IMGLOW_set_msg_render_ preferences IMGLOW_set_document_input 428 Snow.Snowbnd method method variables 201, 203, 354 defined 222, 357 Snow.Snowbnd method IMGLOW_set_ooxml_license defined 200, 202, 351, 353 Snow.Snowbnd method IMGLOW_set_docx_license_filename defined 101 Snow.Snowbnd method IMGLOW_set_ooxml_license_input_ defined 351 stream IMGLOW_set_docx_license_path Snow.Snowbnd method Snow.Snowbnd method defined 102 defined 351 IMGLOW_set_overlay_path IMGLOW_set_fast_convert method variables 98 Snow.Snowbnd method Snow.Snowbnd method defined 222, 354 defined 98, 358 IMGLOW_set_fontmap_path IMGLOW_set_pcl_input Snow.Snowbnd method defined 97 Snow.Snowbnd method IMGLOW_set_gamma defined 205, 358
Snow.Snowbnd method IMGLOW_set_pdf_flags 195 defined 203, 355
465 Index: IMGLOW_set_pdf_fontpath – isVectorFormat(int)
IMGLOW_set_pdf_fontpath improve
Snow.Snowbnd method dynamic range of 8-bit gray scale defined 205 image 158, 166, 309
IMGLOW_set_pdf_input inches
Snow.Snowbnd method convert to pixels 270 defined 206, 359 installation IMGLOW_set_third_party_use file 386 method variables 223 installing scandll dll 276 Snow.Snowbnd method internal graphics defined 223 convert from image IMGLOW_set_tiff_tag 390 coordinates 248 Snow.Snowbnd method convert to current window 248 defined 223, 360 internal size IMGLOW_set_UTF_8 change 167, 182, 314 Snow.Snowbnd method defined 225, 361 invert
IMGLOW_write_tiff_stream image 62, 158, 309
Snow.Snowbnd method IOCA
defined 81, 361 described 372
IMNET file type 382
described 372 isMultipage() 88
file type 382 isTiff() 88 import isValidMultiFormat(int) 86
set attributes for ASCII file 190, isValidMultiFormat(String) 86 346 isVectorFormat() 88
isVectorFormat(int) 86
466 Index: italic – last cropping rectangle
italic 191, 346 jni declarations 276
italics JPEG 428
text 234 described 373
itext.jar 389 file type 381
set compression quality for J saving 200, 348 JAR_NOT_FOUND_24 error set interleave factor for writing 204, code 418 357 Java JPEG2000 annotation classes 232 defined 373 java.lang.NoClassDefFoundError 102 file type 383 JAVA_1_6_RUNTIME_ JWebEngine.jar 389 REQUIRE 420 JWEBENGINE_JAR_NOT_IN_ JAVA_OPTIONS 102 CLASSPATH 419 JAVA_OPTS 102 K JBIG KOFAX defined 372 file type 373, 382 file type 383
JBIG2 L
defined 372 large documents
file type 383 printing 230
JDK 47 LASER_DATA
JEDMICS file type 373, 381
described 373 last cropping rectangle 118
file type 382 coordinates 118
467 Index: last display coordinate – methods
last display coordinate 120 map_image_to_wnd license.jar 389 Snow.Snowbnd method defined 196, 362 line map_wnd_to_image set style 256 method variables 363 set width for annotations 257 Snow.Snowbnd method style 234 defined 196, 362 width for drawing 234 margins LINE_DATA scanning 280 file type 373, 383 Marketing directory lineppage 191, 346 files 386 lineSpacing 191, 347 memory lmargin 191, 346 delete from object 241 loadandsave requirements 48 sample 56 memory buffer
M append annotation data 262
MACPAINT write annotation data 258
file type 373, 382 memory requirements 48
MAG METHOD_NOT_FOUND error
file type 373, 382 code 419 main API class 117 methods major version number 137, 308 dis_angle 172, 284 manipulation fit_to_height 173, 285
sample 58 fit_to_width 173, 285
getBitsPerPixel 131, 286
468 Index: minor version number – manipulation
getCropboxX 131 IMG_decompress_bitmap_stream_ onthefly 73, 295 getCropboxY 132 IMG_decompress_fax getHeight 133, 287 (java.io.DataInputStream, getInitialZoom 133, 287 int, int, int, int, int) 74, 296
getWidth 134, 288 IMG_decompress_fax
getXdpi 134, 288 (java.lang.String, int, int, int, int, int) 73, 295 getYdpi 135, 289 IMG_decompress_multipage_ IMG_antique_effect 153, 162, 289 bitmap_stream_onthefly 75, IMG_auto_crop_bitmap 162, 289 297
IMG_auto_orient 175, 290 IMG_deskew_bitmap 154, 298
IMG_autocrop_bitmap 174 IMG_despeckel_bitmap 155, 163, 299 IMG_color_gray(void)IMG_color_ gray(void) 153 IMG_display_bitmap 175, 300
IMG_create_thumbnail 68, 290 IMG_display_bitmap_aspect 176, 300 IMG_decompress_bitmap (java.awt.Image, int) 70 IMG_display_bitmap_smooth 178, 302 IMG_decompress_bitmap (java.io.DataInputStream, IMG_erase_rect 164, 179, 303 int) 70, 292 IMG_fill_bitmap_pattern 180, 305 IMG_decompress_bitmap(String, IMG_flip_bitmapx 165, 181, 305 int) 68, 209, 291 IMG_flip_bitmapy 165, 181, 306 IMG_decompress_bitmap_fd (String, int, int) 72, 294 IMG_get_bitmap_block 135, 306
IMG_decompress_bitmap_stream IMG_get_deskew_angle 136, 307
(String, int) 72, 294 IMG_get_version 137, 308
469 Index: minor version number – manipulation
IMG_histogram_equalize 157, 166, IMG_save_bitmap(String, int) 79, 308 107, 320
IMG_invert_bitmap 158, 309 IMG_save_document(byte, byte, int) 81, 109, 321 IMG_merge_block 219, 309 IMG_save_document(String, byte, IMG_print_applet 227, 311 int) 80, 108, 321 IMG_print_applet_pages 228, 311 IMG_scroll_bitmap 186, 322 IMG_print_bitmap 226, 312 IMG_set_croprect 187, 323 IMG_promote_24(void)IMG_ IMG_sharpen_bitmap promote_24(void) 159 Function 160, 169, 324 IMG_promote_8(void)IMG_ IMG_shift_bitmap 187, 325 promote_8(void) 158 IMG_thresh_mono 161 IMG_remove_red_eye 159, 166, 313 IMG_window_level 188, 325
IMG_resize_bitmap 167, 182, 314 IMGLOW_append_page 212-213, 220 IMG_resize_bitmap_bicubic 168, 183, 315 IMGLOW_delete_page 213-214
IMG_resize_to_gray(int,int)IMG_ IMGLOW_detect_blank_page 137, resize_to_gray(int,int) 184 214, 328
IMG_rgb_to_cmyk(void)IMG_rgb_ IMGLOW_detect_color 155, 170, to_cmyk(void) 160 329
IMG_rotate_bitmap 169, 185, 210, IMGLOW_extract_page 139, 216, 316 331
IMG_save_bitmap 76, 104, 317 IMGLOW_extract_text 140, 151, 332 IMG_save_bitmap(byte, int, int, int 77, 105, 318 IMGLOW_get_bitmap_date 142
IMG_save_bitmap(int, int, int, int) IMGLOW_get_bitmap_name 142, 78, 106, 211, 319 334
470 Index: minor version number – manipulation
IMGLOW_get_docx_license_ IMGLOW_set_bitmap_name 221, filename 335 347
IMGLOW_get_docx_license_ IMGLOW_set_brightness 191, 348 path 335 IMGLOW_set_comp_quality 200, IMGLOW_get_fileinfo 143, 336 348
IMGLOW_get_filetype IMGLOW_set_contrast 192, 349 (java.io.DataInputStream) IMGLOW_set_decomp_size 193, 145, 337 349 IMGLOW_get_filetype(String) 144, IMGLOW_set_decomprect 350 336 IMGLOW_set_document_ IMGLOW_get_image_ input 200, 202, 351, 353 orientation 145, 338 IMGLOW_set_docx_license_ IMGLOW_get_ooxml_license_ filename 351 path 100 IMGLOW_set_docx_license_ IMGLOW_get_pages path 351 (java.io.DataInputStream) 146, 217, 338 IMGLOW_set_fast_convert 222, 354 IMGLOW_get_pages(String) 147, 218, 339 IMGLOW_set_fontmap_path 97
IMGLOW_get_raster 148, 339 IMGLOW_set_gamma 203, 355
IMGLOW_get_tiff_tag 148, 340 IMGLOW_set_image_ orientation 194, 356 IMGLOW_get_warnings 150, 341 IMGLOW_set_jpg_interleave 204, IMGLOW_put_raster 189, 342 357 IMGLOW_redact_page 94-95, 342- IMGLOW_set_msg_render_ 343 preferences 222, 357 IMGLOW_search_text 150, 344 IMGLOW_set_ooxml_license 101 IMGLOW_set_ascii_ attributes 190, 346
471 Index: minor version number – MS Word
IMGLOW_set_ooxml_license_ MODCA input_stream 102 defined 373 IMGLOW_set_overlay_path 98, MODCA resource 358 not displayed 427 IMGLOW_set_pcl_input 205, 358 MODCA troubleshooting IMGLOW_set_pdf_fontpath 205 overlay 427 IMGLOW_set_pdf_input 206, 359 mouse IMGLOW_set_third_party_use 223 coordinate 267 IMGLOW_set_tiff_tag 223, 360 track movements 266 IMGLOW_set_UTF_8 225, 361 mouse button IMGLOW_write_tiff_stream 81, 361 notify annotation library of button release 267 map_image_to_wnd 196, 362 move map_wnd_to_image 196, 362 annotation object instructions 272 photo editing 162 image along x and y axes 187, 325 set_croprect 196, 363 notify annotation library of moved set_croprect_scroll 197, 363 object 265 setFrame 198, 365 object 249 setXdpi 206, 365 movement setYdpi 207, 366 track 266 Snowbnd 54, 56, 366-367 MS Excel minor version number 137, 308 text extraction 56, 66, 140, 332 mirror image of image 60, 62, 165, MS Office Document Imaging 428 181, 305-306 MS Word
text extraction 56, 66, 140, 332
472 Index: MSG – notify
MSG NO_DELAY_TIME_FOUND error code 418 file type 373, 383 NO_FAST_TWAIN_SUPPORTED set rendering prefences 222, 357 error code 419 MSP NO_JPEG2000_VERSION error file type 373, 382 code 419
multipage NO_LZW_VERSION error code 418
number of pages in document 146- NO_MORE_PAGES error code 418 147, 217-218, 338-339 NO_PCL_VERSION error code 419 print document from applet 228, NO_PDF_VERSION error code 419 311 NO_SCANNER_FOUND error multiple systems 429 code 417
N NO_TCOLOR_FOUND error
Name tag 221, 347 code 418
NCR NO_VECTOR_CAPABILITY error code 419 defined 373 NO_WORD_VERSION error file type 383 code 419 new NoClassDefFound error 102-103 add object 271 NOT_A_TILED_IMAGE error add object to current code 418 annotation 239 NOT_SUPPORTED_IN_THIS_ construct snowbound object 47 VERSION error code 418
NO_ABIC_VERSION error code 419 NOT_VALID error code 421
NO_BITMAP_FOUND error code 417 notify
NO_CLIPBOARD_IMAGE error annotation library 267 code 417
473 Index: number – ODS
annotation library of current mouse move 249 coordinates 267 moving instructions 272 annotation library that mouse notify annotation library of button released 267 move 265 annotation library that object is notify annotation library of resized 265 resizing 265 annotation library that object resize 249, 272 moved 265 return graphic number of number annotation 246 graphic object 235 return image block of data and number of pages create 135, 306
in multipage document 146-147, select deleted 264 217-218, 338-339 set current foreground color 255
O snowbound image 47 object type 234
add 271 type to add when using user controlled adding 235 add new to current annotation 239 ODF alternate Snowbnd constructor 54, 56, 366-367 defined 374
construct new 47 file type 383
construct with ANN_GRAPHIC_ ODP STRUCT 125 file type 383 delete 273 ODS delete graphics 241 defined 374 deselect 264 file type 383 draw at passed in coordinates 243
474 Index: ODT – panning
ODT overview
defined 374 file format 65
file type 383 P OOXML page defined 374 append 212, 220 file type 383 appending 213, 326 set license from an delete 327-328 InputStream 102 deleting 213-214 OOXML_LICENE_EXPIRED 420 detect blank 138, 160, 169, 215, OOXML_LICENSE_NOT_ 324, 328 FOUND 420 scan all 64, 279 orientation page manipulation 327-328 image 175, 290 appending pages 213, 326 last image decompressed 145, 338 deleting pages 213-214 scanning 280 sample 63 set flag before saving TIFF format 194, 356 PAGE_NOT_FOUND error code 417
OUT_OF_MEMORY error code 417 pageOffset 191, 347
output Paint method 426
searchable PDF 56, 80, 108, 321 palette 65, 76-79, 87, 104-105, 107- 108, 131-132, 211, 219, 286, overlay 310, 317-320 AFP troubleshooting 427 format 114 MODCA troubleshooting 427 PALETTE_IMAGES_NOT_ set file directory 98, 358 ALLOWED error code 418
panning 121
475 Index: parameters – PDF
parameters PCX
set for scanning 281 described 374 partially downloaded image file type 381
decompress 73, 295 PDF
display 73, 295 append page 212, 220 partially downloaded multipage image configuring on Unix 102
decompress 75, 297 convert current annotation 250
display 75, 297 convert to bitmap 206, 359
PASSWORD_PROTECTED_FILE corrupted file 425 error code 419 defined 374 PASSWORD_PROTECTED_PDF enhanced support 389 error code 419 error code 425 pattern extract text 139, 216, 331 fill area of bitmap 180, 305 file type 382 PCL page manipulation 213-214, 326 color document 200, 202, 351, 353 reading and writing support 56, 80, configuring on Unix 102 108, 321 defined 374 redaction 94-95, 342-343 render bitmap 205, 358 redaction support 94 text extraction 56, 66, 140, 332 searchable 56, 89, 91, 427 PCL_1 searchable output 56, 80, 108, 321 file type 382 set destination size 90, 195, 359 PCL_5 text extraction 56, 66, 140, 332 defined 374
file type 383
476 Index: pdf files – POWER_POINT
pdf files PICT
set file directory 205 file type 377, 381
PDF reading and writing support 56, picture 80, 108, 321 remove red eye 159, 166, 313 PDF v1.4 375 pixel PDF/A 374-375 change range of display 188, 325 PDF_15 pixel depth 200, 202, 351, 353 file type 375, 383 supported 65 PDF_16 PIXEL_DEPTH_UNSUPPORTED file type 376, 383 error code 418
PDF_LZW pixels
file type 383 percentage 138, 215, 328
PDF_PACKAGE_NOT_ PNG SUPPORTED error code 419 described 378 performance file type 382 conversion 222, 354 pointer decompression 222, 354 to each compressed raster for 1-bit pheight 191, 346 images 120
photo Post-it note annotation object
remove red eye 159, 166, 313 get text data 245
photo editing 162 set type of scrollbar 257
PHOTOCD POWER_POINT
file type 377, 382 described 378
PHOTOSHOP file type 383
file type 377, 382
477 Index: PPTX – read_xml_file
PPTX R described 378 RAST file type 383 described 378 print file type 378, 382 color images 226 raster line current annotation to graphic replace with new image data 189, context 250 342 current image 226, 312 return 148, 339 functions 226 RasterMaster gray scale images 226 version high resolution multipage document get 137, 308 from applet 228, 311 read image loaded into applet 227, 311 annotation file from images 226 DataInputStream 251 stack trace 121 annotation file from disk 251 printing annotation file from URL sample 56 address 252
silent 57 page of annotation file from disk 252 Printing TIFF tag 148, 340 large documents 230 read_xml_file psize 191, 346 annotation method variables 237 PTOCA Snow.SnowAnn annotation method extract text 56, 140, 332 defined 237 text extraction 56, 66, 140, 332 pwidth 191, 346
478 Index: readaction – resolution
readaction replace
PDF 342 raster line with new image data 189, 342 rectangle requirements cropping rectangle x position 234 memory 48 cropping rectangle x size 234 system 47 cropping rectangle y position 234 resize cropping rectangle y size 234 1-bit image to 8-bit grayscale 184 fill inside or outside with color 60, 164, 179, 303 notify annotation library of resized object 265 last cropping rectangle coordinates 118 object 249, 272
red eye reduction 159, 166, 313 object indicated by graphic number 253 redaction resize_object PDF 94-95, 343 annotation method variables 238 redactions Snow.SnowAnn annotation method burn in 249 defined 238 reduction resizing 116 remove red eye 159, 166, 313 resolution 90, 99-100, 116, 134-135, relative difference 190, 200, 202, 205-207, 227,
set black and white 192, 349 229, 288-289, 312-313, 346, 351, 353, 358-359, 365-366 remove set along x-axis of image in noise from 1-bit image 60, 62, 155, DPI 206, 365 163, 299 set along y-axis of image in red eye 159, 166, 313 DPI 207, 366
479 Index: resolution, better result through sharpening – run
resolution, better result through raster line 148, 339 sharpening 138, 160, 169, 215, skew angle for 1-bit image 136, 324, 328 307 results TWAIN setting 64, 280 different with same version 429 version id 137, 308 return width of image 134, 288 ANN_GRAPHIC_STRUCT x resolution of image 134, 288 class 245 return image data 282 bounding box of object in image pixel coordinates 245 reverse
cropping rectangle for current image to create a horizontal mirror annotation area 244 effect 244
graphic number of annotation image to create a vertical mirror object 246 effect 244
height of image 133, 287 rmargin 191, 346
image block of data and create rotate
object 135, 306 all annotations on image 254
image data 282 current display rotation angle 119
image data for handle 282 current image clockwise by display
instance of Snow.ANN_ angle 169, 185, 210, 316
GRAPHIC_STRUCT class image at display time 172, 284 (internal wrapper) 246 RTF number of pages in multipage described 378 document 146-147, 217- 218, 338-339 file type 383
orientation of image 175, 290 run
orientation of last image samples 50 decompressed 145, 338
480 Index: running – SANN_delete_object
running SANN_activate_all_objects
demo 45, 50 Snow.SnowAnn annotation method defined 238 S SANN_activate_object sample Snow.SnowAnn annotation method HangDetector 55 defined 239
scanning 283 SANN_add_object
samples 389 Snow.SnowAnn annotation method
batch convert 53 defined 239
color detection 58 SANN_deactivate_all_objects
convert 51, 54 Snow.SnowAnn annotation method defined 240 loadandsave 56 SANN_deactivate_object manipulation 58 annotation method variables 241 overview 50 SANN_deactivate_objects printing 56 Snow.SnowAnn annotation method save searchable PDF 56 defined 240 save to memory 59 SANN_delete_all_objects scanning 63, 276 Snow.SnowAnn annotation method silent print 57 defined 241
swing 61 SANN_delete_object
thumbnails 57 annotation method variables 242
vector PDF 63 Snow.SnowAnn annotation method defined 241 vector PDF Page Manipulation 63
Viewing and Annotation 59
watermark 58
481 Index: SANN_display_annotations – SANN_move_object
SANN_display_annotations SANN_get_object_data
Snow.SnowAnn annotation method Snow.SnowAnn annotation method defined 242 defined 245
SANN_draw_object SANN_get_object_info
annotation method variables 243 annotation method variables 246
Snow.SnowAnn annotation method Snow.SnowAnn annotation method defined 243 defined 246
SANN_flipx SANN_get_object_num
Snow.SnowAnn annotation method Snow.SnowAnn annotation method defined 244 defined 246
SANN_flipy SANN_highlight_object
Snow.SnowAnn annotation method Snow.SnowAnn annotation method defined 244 defined 247
SANN_get_croprect SANN_map_image_to_wnd
annotation method variables 244 Snow.SnowAnn annotation method defined 248 Snow.SnowAnn annotation method defined 244 SANN_map_wnd_to_image
SANN_get_graphic_struct Snow.SnowAnn annotation method defined 248 annotation method variables 245 SANN_merge_annotations Snow.SnowAnn annotation method defined 245 annotation method variables 249
SANN_get_object_bounds Snow.SnowAnn annotation method defined 248 annotation method variables 245 SANN_move_object Snow.SnowAnn annotation method defined 245 annotation method variables 249
482 Index: SANN_ouput_pdf – SANN_set_croprect
Snow.SnowAnn annotation method SANN_read_ann_stream defined 249 Snow.SnowAnn annotation method SANN_ouput_pdf defined 252
Snow.SnowAnn annotation method SANN_recalc_size defined 250 annotation method variables 253 SANN_output_pdf Snow.SnowAnn annotation method annotation method variables 250 defined 253
SANN_POINT SANN_RECT
class defined 126 class defined 126
class variables 126 class variables 127
SANN_print_annotations fill object with height and width of display area 237 annotation method variables 250 SANN_resize_object Snow.SnowAnn annotation method defined 250 annotation method variables 253
SANN_read_ann(DataInputStream, Snow.SnowAnn annotation method int) defined 253
Snow.SnowAnn annotation method SANN_rotate defined 251 Snow.SnowAnn annotation method SANN_read_ann(String) defined 254
annotation method variables 252 SANN_set_bcolor
Snow.SnowAnn annotation method annotation method variables 254 defined 251 Snow.SnowAnn annotation method SANN_read_ann(String, int) defined 254
Snow.SnowAnn annotation method SANN_set_croprect defined 252 annotation method variables 255
483 Index: SANN_set_fcolor – SANN_write_ann_xml(byte, Snow.SnowXMLWriter)
Snow.SnowAnn annotation method Snow.SnowAnn annotation method defined 60, 255 defined 258-259
SANN_set_fcolor SANN_write_ann_idm(String, int, String, int) annotation method variables 255 annotation method variables 261 Snow.SnowAnn annotation method defined 255 SANN_write_ann_idm(String, String, int, int) 260 SANN_set_font SANN_write_ann_idm(String, String, Snow.SnowAnn annotation method String, int) 260 defined 256 annotation method variables 260 SANN_set_line_style SANN_write_ann_pages(byte, int, annotation method variables 256 byte) Snow.SnowAnn annotation method annotation method variables 262 defined 256 Snow.SnowAnn annotation method SANN_set_line_width defined 262 annotation method variables 257 SANN_write_ann_pages(String, int, Snow.SnowAnn annotation method byte) defined 257 annotation method variables 261 SANN_set_scrollbars Snow.SnowAnn annotation method Snow.SnowAnn annotation method defined 261 defined 257 SANN_write_ann_xml(byte, SANN_set_size Snow.SnowXMLWriter)
Snow.SnowAnn annotation method annotation method variables 260 defined 258 Snow.SnowXMLWriter annotation SANN_write_ann method defined 259, 262
annotation method variables 258- 259
484 Index: SANN_write_ann_xml_document(Snow.SnowXMLWriter) – screen coordinates
SANN_write_ann_xml_document scan (Snow.SnowXMLWriter) all pages 64, 279 Snow.SnowXMLWriter annotation image data for handle 282 method defined 263 interface 276 SANN_write_ann_xml_page (Snow.SnowXMLWriter) parameter user interface 281
annotation method variables 263 return image data 282
Snow.SnowXMLWriter annotation sample 283
method defined 263 set device 64, 278
save set parameters 281
image 124 set TWAIN value 280
image object to byte array 59, 76- using automatic feeder 64, 277 77, 104-105, 317-318 scanner JPEG compression quality 200, close 278 348 scanners set orientation before saving TIFF format 194, 356 get list 64, 279
timeout 55 scanning
save searchable PDF margins 280
sample 56 orientation 280
save to memory sample 63, 276
sample 59 SCITEX
scale file type 378, 382
image using bicubic screen coordinates interpolation 168, 183, 315 convert image to screen coordinates 196, 362
485 Index: scroll – set
convert to image coordinates 196, sepia tones 153, 162, 289 362 Server environment scroll running in 102 bitmap 186, 322 set heavyweight scroll bars 121 attributes for ASCII file 190, 346 scrollbar compression quality factor for set rectangular area of image 197, saving JPEG 200, 348 363 cropping rectangle 60, 255 set type in Post-it or Text cropping rectangle for display annotation object 257 engine 196, 363 scrollbar arrow current background color 254 overlaps 425 current foreground color for all scrollbars objects 255
horizontal 425 destination container for image display 198, 365 vertical 425 difference between black and SEARCH_STRING_NOT_FOUND white 192, 349 error code 419 DOCX license file path 351 searchable PDF 56, 89, 91, 427 filename of DOCX license file 351 searchable PDF output 56, 80, 108, 321 font for text annotations 256
Searchable PDF sample 56, 80, 108, gamma correction factor 203, 355 321 height and width of annotation 258 select JPEG interleave factor for writing annotation with mouse for JPEG 204, 357 editing 236 orientation flag before saving TIFF current drawing name 234 format 194, 356
486 Index: set_croprect – single conversion
overlay files 98, 358 setFrame
path for pdf files 205 method variables 365
rectangular area of image to display Snow.Snowbnd method scrollbars 197, 363 defined 198, 365
rendering preferences for .MSG setting files 222, 357 return TWAIN 64, 280 resolution along x-axis of image in settings DPI 206, 365 display_angle 172, 284 resolution along y-axis of image in DPI 207, 366 setXdpi
scan device 64, 278 Snow.Snowbnd method defined 206, 365 scanning parameters 281 setYdpi style of line 256 Snow.Snowbnd method TWAIN value 280 defined 207, 366 type of scrollbar in Post-it note or sharpen Text annotation object 257 image 160, 169, 324 width of line in annotation library 257 sharpen bitmap 138, 160, 169, 215, 324, 328 set_croprect shift Snow.Snowbnd method defined 196, 363 image along x and y axes 187, 325
set_croprect_scroll silent print
method variables 364 sample 57
Snow.Snowbnd method single conversion
defined 197, 363 sample 54
487 Index: size – Snow.SnowAnn annotation method
size SANN_delete_object 241
recalculate 253 SANN_display_annotations 242 skew angle SANN_draw_object 243
1-bit image 136, 307 SANN_flipx 244 skewed image SANN_flipy 244
fast rotate for 1-bit skewed SANN_get_croprect 244 image 60, 62, 154, 298 SANN_get_graphic_struct 245 SnbdWarningCode SANN_get_object_bounds 245 class 127 SANN_get_object_data 245 Snow.ANN_GRAPHICS_STRUCT SANN_get_object_info 246 defined 125 SANN_get_object_num 246 Snow.Defines SANN_highlight_object 247 defined 124 SANN_map_image_to_wnd 248 snow.jar 388 SANN_map_wnd_to_image 248 Snow.SnowAnn annotation method SANN_merge_annotations 248 ann_dblick 236 SANN_move_object 249 GetClientRect 237 SANN_output_pdf 250 read_xml_file 237 SANN_print_annotations 250 resize_object 238 SANN_read_ann SANN_activate_all_objects 238 (DataInputStream, int) 251 SANN_activate_object 239 SANN_read_ann(String) 251 SANN_add_object 239 SANN_read_ann(String, int) 252 SANN_deactivate_all_objects 240 SANN_read_ann_stream 252 SANN_deactivate_objects 240 SANN_recalc_size 253 SANN_delete_all_objects 241
488 Index: Snow.SnowANN field description – Snow.Snowbnd field
SANN_resize_object 253 xml_convert 269
SANN_rotate 254 xml_find_file 269
SANN_set_bcolor 254 xml_inches_pixels 270
SANN_set_croprect 60, 255 xml_read 270
SANN_set_fcolor 255 Snow.SnowANN field description 235
SANN_set_font 256 snow.snowbnd
SANN_set_line_style 256 class 117
SANN_set_line_width 257 defined 117
SANN_set_scrollbars 257 Snow.Snowbnd field
SANN_set_size 258 alias_quality 117-118, 121-122
SANN_write_ann 258-259 dis_crop_xe 118
SANN_write_ann_pages(byte, int, dis_crop_xs 118 byte) 262 dis_crop_ye 118 SANN_write_ann_pages(String, dis_crop_ys 118 int, byte) 261 dis_dib 119 ui_delete 264 dis_height 119 ui_exit 264 dis_rotate 119 ui_rotate_object 265 dis_runs_ptrs 120 ui_startmove 265 dis_width 119 ui_startresize 265 dis_xs 120 ui_wm_lbuttondown 266 dis_xsize 120 ui_wm_lbuttonup 267 dis_ys 120 ui_wm_mousemove 267 dis_ysize 120 xml_boolean 268 hsb 121 xml_color 268
489 Index: Snow.Snowbnd method – Snow.Snowbnd method
vsb 121 IMG_decompress_bitmap(String, int) 68, 209, 291 Snow.Snowbnd method IMG_decompress_bitmap_fd display_angle 172, 284 (String, int, int) 72, 294 fit_to_height 173, 285 IMG_decompress_bitmap_stream fit_to_width 173, 285 (String, int) 72, 294
getBitsPerPixel 131, 286 IMG_decompress_bitmap_stream_
getCropboxX 131 onthefly 73, 295
getCropboxY 132 IMG_decompress_fax (java.io.DataInputStream, getHeight 133, 287 int, int, int, int, int) 74, 296 getInitialZoom 133, 287 IMG_decompress_fax getWidth 134, 288 (java.lang.String, int, int, int, int, int) 73, 295 getXdpi 134, 288 IMG_decompress_multipage_ getYdpi 135, 289 bitmap_stream_onthefly 75, IIMG_rgb_to_cmyk(void) 160 297
IMG_antique_effect 153, 162, 289 IMG_deskew_bitmap 154, 298
IMG_auto_crop_bitmap 162, 174, IMG_despeckel_bitmap 155, 163, 289 299
IMG_auto_orient 175, 290 IMG_display_bitmap 175, 300
IMG_color_gray(void) 153 IMG_display_bitmap_aspect 176, 300 IMG_create_thumbnail 68, 290 IMG_display_bitmap_smooth 178, IMG_decompress_bitmap 302 (java.awt.Image, int) 70 IMG_erase_rect 164, 179, 303 IMG_decompress_bitmap (java.io.DataInputStream, IMG_fill_bitmap_pattern 180, 305 int) 70, 292 IMG_flip_bitmapx 165, 181, 305
490 Index: Snow.SnowXMLWriter annotation method – Snow.Snowbnd method
IMG_flip_bitmapy 165, 181, 306 IMG_save_bitmap(String, int) 79, 107, 320 IMG_get_bitmap_block 135, 306 IMG_save_document(byte, byte, IMG_get_deskew_angle 136, 307 int) 81, 109, 321 IMG_get_version 137, 308 IMG_save_document(String, byte, IMG_histogram_equalize 157, 166, int) 80, 108, 321 308 IMG_scroll_bitmap 186, 322 IMG_invert_bitmap 158, 309 IMG_set_croprect 187, 323 IMG_merge_block 219, 309 IMG_sharpen_bitmap 160, 169, IMG_print_applet 227, 311 324
IMG_print_applet_pages 228, 311 IMG_shift_bitmap 187, 325
IMG_print_bitmap 226, 312 IMG_thresh_mono 161
IMG_promote_24(void) 159 IMG_window_level 188, 325
IMG_promote_8(void) 158 IMGLOW_append_page 212-213,
IMG_remove_red_eye 159, 166, 220
313 IMGLOW_delete_page 213-214
IMG_resize_bitmap 167, 182, 314 IMGLOW_detect_blank_page 137,
IMG_resize_bitmap_bicubic 168, 214, 328
183, 315 IMGLOW_detect_color 155, 170,
IMG_resize_to_gray(int,int) 184 329
IMG_rotate_bitmap 169, 185, 210, IMGLOW_extract_page 139, 216, 316 331
IMG_save_bitmap 76, 104, 317 IMGLOW_extract_text 140, 151, 332 IMG_save_bitmap(byte, int, int, int) 77, 105, 318 IMGLOW_get_bitmap_date 142
IMG_save_bitmap(int, int, int, int) IMGLOW_get_bitmap_name 142, 78, 106, 211, 319 334
491 Index: Snow.SnowXMLWriter annotation method – Snow.Snowbnd method
IMGLOW_get_docx_license_ IMGLOW_set_bitmap_name 221, filename 335 347
IMGLOW_get_docx_license_ IMGLOW_set_brightness 191, 348 path 335 IMGLOW_set_comp_quality 200, IMGLOW_get_fileinfo 143, 336 348
IMGLOW_get_filetype IMGLOW_set_contrast 192, 349 (java.io.DataInputStream) IMGLOW_set_decomp_size 193, 145, 337 349 IMGLOW_get_filetype(String) 144, IMGLOW_set_decomprect 350 336 IMGLOW_set_document_ IMGLOW_get_image_ input 200, 202, 351, 353 orientation 145, 338 IMGLOW_set_docx_license_ IMGLOW_get_ooxml_license_ filename 351 path 100 IMGLOW_set_docx_license_ IMGLOW_get_pages path 351 (java.io.DataInputStream) 146, 217, 338 IMGLOW_set_fast_convert 222, 354 IMGLOW_get_pages(String) 147, 218, 339 IMGLOW_set_fontmap_path 97
IMGLOW_get_raster 148, 339 IMGLOW_set_gamma 203, 355
IMGLOW_get_tiff_tag 148, 340 IMGLOW_set_image_ orientation 194, 356 IMGLOW_get_warnings 150, 341 IMGLOW_set_jpg_interleave 204, IMGLOW_put_raster 189, 342 357 IMGLOW_redact_page 94-95, 342- IMGLOW_set_msg_render_ 343 preferences 222, 357 IMGLOW_search_text 150, 344 IMGLOW_set_ooxml_license 101 IMGLOW_set_ascii_ attributes 190, 346
492 Index: Snow.SnowXMLWriter annotation method – style
IMGLOW_set_ooxml_license_ SANN_write_ann_xml_document input_stream 102 (Snow.SnowXMLWriter) 263 IMGLOW_set_overlay_path 98, 358 SANN_write_ann_xml_page (Snow.SnowXMLWriter) IMGLOW_set_pcl_input 205, 358 263 IMGLOW_set_pdf_fontpath 205 Snowbnd IMGLOW_set_pdf_input 206, 359 object 54, 56, 366-367 IMGLOW_set_third_party_use 223 Snow.Snowbnd method IMGLOW_set_tiff_tag 223, 360 defined 54, 56, 366-367
IMGLOW_set_UTF_8 225, 361 SNOWBND_API_NOT_AVAILABLE
IMGLOW_write_tiff_stream 81, error code 421
361 SNOWBND_ERROR error code 421
map_image_to_wnd 196, 362 SNOWBND_OK error code 421
map_wnd_to_image 196, 362 snowcommon.jar 389
set_croprect 196, 363 SnowXMLWriter
set_croprect_scroll 197, 363 write out data 263
setFrame 198, 365 write out content 259, 262
setXdpi 206, 365 write out data to associated
setYdpi 207, 366 annotation 263
Snowbnd 54, 56, 366-367 stack trace
Snow.SnowXMLWriter annotation printout 121
method stucky error diffusion
SANN_write_ann_xml(byte, defined 226 Snow.SnowXMLWriter) style 259, 262 line 234
493 Index: support – TIFF
support Text annotation object
pixel depth 65 get text data 245 swing set type of scrollbar 257
sample 61 text data system get from Post-it note or Text annotation object 245 requirements 47 text extraction SYSTEM_CRASH error code 421 PTOCA, PCL, PDF, MS Word, T AFP, Excel, Word, MS tabs 191, 346 Excel 56, 66, 140, 332 tag text object
read TIFF 148, 340 edit on SANN_EDIT and SANN_ POSTIT 239 write new and current 223, 360 third party technology 223 tag specifications 390 third party viewers 428 TARGA threshold 58, 161 file type 378, 381 thumbnail TARGA16 create 68, 290 file type 378, 382 thumbnails text sample 57 activate for editing 61, 238 tiff bold 234 create with compressed data 81, extract 56, 66, 140, 332 361 italics 234 TIFF set font for annotation text 256 append page 212, 220
494 Index: TIFF image – troubleshooting
extract text 139, 216, 331 TIFF_JBIG
read tag 148, 340, 390 file type 383
saving 221, 347 TIFF_JPEG 428
set orientation before saving file type 380, 382 format 194, 356 TIFF_JPEG7 TIFF image file type 380, 383 decompressing 142, 334 TIFF_LZW TIFF tags 390 file type 380-381 TIFF_2D TIFF_PACK file type 379, 381 file type 380-381 TIFF_ABIC TIFF_TAG_NOT_FOUND error file type 379, 382 code 418
TIFF_ABIC_BW TIFF_UNCOMPRESSED
file type 379, 382 described 380
TIFF_G3_FAX file type 381
file type 379, 381 timeout 55
TIFF_G4_FAX tmargin 191, 346
file type 379, 381 toString() 88
TIFF_G4_FAX_FO track
file type 379, 382 mouse movements 266
TIFF_G4_FAX_STRIP troubleshooting 422
file type 379, 383 AFP 427
TIFF_HUFFMAN color text 427
file type 379, 381 corrupted file 425
495 Index: TWAIN – ui_wm_lbuttondown
error code 422 typeFace 191, 347
larger file size 422 U lower quality 423 ui_delete missing characters 422 annotation method variables 264 MODCA 427 Snow.SnowAnn annotation method output differs 422 defined 264
overlapping scrollbar arrow 425 ui_exit
overlay resources 427 Snow.SnowAnn annotation method defined 264 searching text 427 ui_rotate_object smart quotes 424 annotation method variables 265 TIFF_JPEG files 428 Snow.SnowAnn annotation method unknown file format 424 defined 265 TWAIN ui_startmove close scanner 278 annotation method variables 265 return setting 64, 280 Snow.SnowAnn annotation method scan all pages 64, 279 defined 265
set scan device 64, 278 ui_startresize
set value 280 annotation method variables 266
user interface 281 Snow.SnowAnn annotation method
using automatic feeder 64, 277 defined 265 type ui_wm_lbuttondown
object 234 annotation method variables 266
object to add when using user Snow.SnowAnn annotation method controlled 235 defined 266
496 Index: ui_wm_lbuttonup – variables
ui_wm_lbuttonup fit_to_height 173, 285
annotation method variables 267 IMG_auto_crop_bitmap 163, 174, 289 Snow.SnowAnn annotation method defined 267 IMG_auto_orient 175, 290
ui_wm_mousemove IMG_autocrop_bitmap 84-87, 89
Snow.SnowAnn annotation method IMG_decompress_bitmap_fd defined 267 (String, int, int) 294
Unix IMG_decompress_bitmap_stream (String, int) 294 configuring RasterMaster 102 IMG_decompress_fax URL (java.lang.String, int, int, int, read annotation file 252 int, int) 296
user control IMG_deskew_bitmap 154, 298
type of object to add 235 IMG_despeckel_bitmap 155, 163
user interface IMG_erase_rect 304
TWAIN 281 IMG_fill_bitmap_pattern 305
USER_CANCEL error code 418 IMG_get_bitmap_block 135
using IMG_get_deskew_angle 137
scanInterface class 276 IMG_get_scanned_image() 282
USING_RUNTIME error code 418 IMG_get_scanned_image_bytes()
UTF 225, 361 282
processing 225, 361 IMG_merge_block 310
IMG_remove_red_eye 159, 166, V 313 variables IMG_save_bitmap 105 ANN_GRAPHIC_STRUCT 125
497 Index: vector PDF – variables
IMG_save_bitmap(byte, int, int, int) IMGLOW_get_pages(String) 147, 106 218
IMG_save_bitmap(int, int, int, int) IMGLOW_put_raster 342 107 IMGLOW_search_text 345 IMG_save_bitmap(String, int) 108 IMGLOW_set_ascii_attributes 346 IMG_save_document(byte, byte, IMGLOW_set_decomprect 350 int) 109, 322 IMGLOW_set_document_ IMG_save_document(String, byte, input 201, 203, 354 int) 109 IMGLOW_set_overlay_path 98 IMG_scan_acquire() 277 IMGLOW_set_third_party_use 223 IMG_scan_acquire_feeder() 278 map_wnd_to_image 363 IMG_scan_pages() 279 read_xml_file 237 IMG_scan_set_cap() 280 resize_object 238 IMG_scan_set_caps() 281 SANN_deactivate_object 241 IMG_thresh_mono 161 SANN_delete_object 242 IMGLOW_detect_blank_page 138, 215 SANN_draw_object 243
IMGLOW_extract_page 139, 216 SANN_get_croprect 244
IMGLOW_extract_text 140 SANN_get_graphic_struct 245
IMGLOW_get_fileinfo 144 SANN_get_object_bounds 245
IMGLOW_get_filetype SANN_get_object_info 246
(java.io.DataInputStream) SANN_merge_annotations 249 145 SANN_move_object 249 IMGLOW_get_filetype(String) 144 SANN_output_pdf 250 IMGLOW_get_pages SANN_POINT 126 (java.io.DataInputStream) 146, 217 SANN_print_annotations 250
498 Index: vector PDF – vertical
SANN_read_ann(String) 252 ui_delete 264
SANN_recalc_size 253 ui_rotate_object 265
SANN_RECT 127 ui_startmove 265
SANN_resize_object 253 ui_startresize 266
SANN_set_bcolor 254 ui_wm_lbuttondown 266
SANN_set_croprect 255 ui_wm_lbuttonup 267
SANN_set_fcolor 255 xml_boolean 268
SANN_set_line_style 256 xml_find_page 270
SANN_set_line_width 257 xml_inches_pixels 270
SANN_set_scrollbars 257 xml_read 270
SANN_write_ann 258-259 vector PDF
SANN_write_ann_idm(String, return xpos of the cropbox 131 String, int, int) 261 return ypos of the cropbox 132 SANN_write_ann_idm(String, sample 63 String, String, int) 260 vector PDF output 56, 80, 108, 321 SANN_write_ann_pages(byte, int, byte) 262 vector PDF Page Manipulation 63
SANN_write_ann_pages(String, VectorPDFPageManipulation int, byte) 261 sample 63
SANN_write_ann_xml(byte, version
Snow.SnowXMLWriter) 260 get 137, 308
SANN_write_ann_xml_page version id (Snow.SnowXMLWriter) return 137, 308 263 vertical set_croprect_scroll 364 flip image 165, 181, 306 setFrame 365
499 Index: viewing – x resolution of image
reverse image to create mirror set line width for annotations 257 image 244 Windows Photo Viewer 428 viewing WINFAX DPI information 111, 116 file type 380, 382 Viewing and Annotation sample 59 WMF vsb file type 380-381 Snow.Snowbnd field defined 121 Word
W color document 200, 202, 351, 353 warnings configuring on Unix 102
decompressing document 150, 341 text extraction 56, 66, 140, 332 watermark Word2007 directory
sample 58 files 387
WBMP WPG
file type 380, 383 file type 380-381 weight 191, 346 write white border annotation to disk file 259
clip 162, 174, 289 annotation to memory buffer 258
find 162, 174, 289 set JPEG interleave factor for JPEG 204, 357 width
annotated image 234 X
container 119 x position
line width for drawing 234 cropping rectangle 234
of image 134, 288 x resolution of image 134, 288
set for annotation 258
500 Index: x size – ypos of the cropbox
x size xml_find_page
cropping rectangle 234 annotation method variables 270
X11 environment xml_inches-pixels
setting up virtual for AWT 102 annotation method variables 270
XBM xml_inches_pixels
file type 380-381 Snow.SnowAnn annotation method defined 270 xdpi 191, 346 xml_read Xerox_EPS annotation method variables 270 file type 380, 382 Snow.SnowAnn annotation method XLSX defined 270 file type 381, 383 XPM XML annotation 259, 262-263 file type 381-382 xml_boolean xpos of the cropbox 131 annotation method variables 268 Xvfb software 102 Snow.SnowAnn annotation method XWD defined 268 file type 381-382 xml_color
Snow.SnowAnn annotation method Y defined 268 y position xml_convert cropping rectangle 234 Snow.SnowAnn annotation method y size defined 269 cropping rectangle 234 xml_find_file ydpi 191, 346 Snow.SnowAnn annotation method defined 269 ypos of the cropbox 132
501 Index: zoom – zoom
Z zoom 425
calculate first zoom increment 133, 287
502