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 \samples\snippets\SavePageToMemory.java directory.

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.

For instructions on running this sample, please see the instructions to Run RasterMaster samples in your IDE or to Run samples from the Command Prompt in the Overview.

Listed below are the methods used in this sample:

  • IMGLOW_get_pages(String) prints the total number of pages in the input document.
  • IMG_decompress_bitmap(String, int) reads in a document in any format and converts it to a valid RasterMaster image.
  • 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.
  • IMG_save_bitmap(byte, int, int, int) saves the current Snowbnd image object to a returned byte array.
  • IMG_decompress_bitmap(java.io.DataInputStream,int) decompresses the current page and print the resulting status code.