Attacing the source code that we had used to convert:
import Snow.Snowbnd;
import Snow.Defines;
public class SimpleConvert
{
public static void Convert( String input , String output, String extension,
int format , boolean doSplit )
{
try{
Snowbnd s = new Snowbnd();
int totalPageCount = 0;
String absoluteOutput = null;
/* used to check return values from library */
int stat = ErrorCodes.OUT_OF_MEMORY;
/* use Snowbound to determine how many pages exist in input file */
/* FIXME: this should be wrapped in try/catch */
totalPageCount = s.IMGLOW_get_pages(input);
/* print out some setup information before processing */
System.out.println("Processing File: " + input);
System.out.println("Processing format: " + format);
System.out.println("Converting To: " + FormatHash.getFormatName(format));
System.out.println("Total page: "+totalPageCount);
totalPageCount=2;
if( doSplit ) {
System.out.println("Splitting out individual pages");
}
else if( totalPageCount > 1 )
{
System.out.println("Saving as multipage document");
if( !FormatHash.isValidFormatMultipage(format)) {
System.out.println("WARNING: " +
FormatHash.getFormatName(format) +
" may not be a valid multipage format!");
}
}
for( int currentPage = 0 ; currentPage < totalPageCount ; currentPage++ ) {
System.out.println("Processing Page: " + currentPage);
stat = s.IMG_decompress_bitmap(input, currentPage);
/* verify no errors occured while decompressing */
if( stat > ErrorCodes.OUT_OF_MEMORY ) {
System.out.println(" IMG_decompress_bitmap(): " + stat);
if( doSplit ) {
/* create unique file name based on page number */
absoluteOutput = output + "_" + currentPage + "_" + extension;
} else {
/* if format is a valid multipage format, Snowbound will append to existing data */
/* if format is a single page format, Snowbound will overwrite existing data */
absoluteOutput = output + extension;
}
//Surendar
// int dpi = s.getXdpi();
// int width = s.getWidth();
// int height = s.getHeight();
//
// int x_pt_size;
// int y_pt_size;
// System.out.println("dpi"+dpi);
// System.out.println("width"+width);
// System.out.println("height"+height);
// x_pt_size = width * 72 / 100;
// y_pt_size = height * 92 / 100;
Snowbnd sb2 = new Snowbnd(s.getWidth(), (int) (s.getWidth() * 11 / 8.5), 1);
stat = sb2.IMG_merge_block(s,0,0,0);
stat = sb2.IMG_save_bitmap(absoluteOutput, format);
//stat=s.IMGLOW_set_pdf_output(x_pt_size,y_pt_size);
//stat=s.IMG_save_bitmap(absoluteOutput, format);
//Surendar
//stat = s.IMG_save_bitmap(absoluteOutput, format); //Surendar
if( stat == ErrorCodes.PIXEL_DEPTH_UNSUPPORTED ) {
System.out.println(" IMG_save_bitmap(): " + stat);
System.out.println(" IMG_save_bitmap(): " + ErrorCodes.getErrorMessage(stat));
System.out.println(" Dropping pixel depth.");
stat = s.IMG_diffusion_mono();
System.out.println(" IMG_diffusion_mono(): " + stat);
stat = s.IMG_save_bitmap(absoluteOutput, format);
}
/* If successful, IMG_save_bitmap() returns the cumulative number of bytes written out */
System.out.println(" IMG_save_bitmap(): " + stat);
}
/* error on decompression, display message */
else {
System.out.println(" IMG_decompress_bitmap(): " + stat);
System.out.println(" IMG_save_bitmap(): " + ErrorCodes.getErrorMessage(stat));
}
}
}catch(Exception e){
e.printStackTrace();
}
}
public static void main( String args[] ) {
boolean errorParsing = false;
/* hashtable represents formats supported for writing */
FormatHash.init();
/* these defaults can be overriden by user input */
//int formatValue = Defines.TIFF_JPEG;
//String formatExtension = null;
//String formatExtension = FormatHash.getFormatExtension(formatValue);
String input = null;
String output = null;
boolean doSplit = false;
/* parse the input arguments */
/* do the actual conversion if the arguments are valid */
//C:\poller\Backup of failed files
String path = "C:\\Documents and Settings\\adcxn2j\\Desktop\\Performance Files\\2page_plain_txt.docx";
//String path = "C:\\Documents and Settings\\adcxn2j\\Desktop\\2009-11-24\\bart\\a";
String out = "C:\\Documents and Settings\\adcxn2j\\Desktop\\Performance Files\\2page_plain_txt";
if( !errorParsing )
Convert( path, out, ".pdf", 59, false);
}
}