Blog: Tech Talk

agsdix-fas fa-home

Blog: Home

agsdix-fas fa-pen-fancy

Blog: CEO's Corner

agsdix-fas fa-code

Blog: Tech Talk

Blog: Product Releases

agsdix-fas fa-chalkboard-teacher

Blog: Viewing

Blog: Conversion

arrow left circle icon Blog: Tech Talk

Retaining Color When Converting Documents

by | Apr 24, 2012

Snowbound Software’s RasterMaster™ for the Java™ Platform includes the ability to convert documents from one file format to other file formats such as PDF. AFP, PCL, Word and Excel documents are converted to black and white by default. To retain the color in the original document, use Snowbound Software’s IMGLOW_set_document_input method.

The following describes the IMGLOW_set_document_input method:

IMGLOW_set_document_input(int, int, int)

This method allows document formats to be rendered in color or black and white. It also allows you to set the document size. It is used for the PDF, Word, Excel, PCL, and AFP formats.

Note: The default is 200 dots per inch (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);

Remark

The table The table below lists the IMGLOW_set_document_input(int, int, int) method variable descriptions.

VariableDescription
dpiSets the document in dots per inch.
bits_pixSets the bits per pixel.1 = black and white documents8 = grayscale or color images24 = color images
formatSets the format parameter.Please see Appendix C: File Format Constants in theRasterMaster Imaging SDK for the Java Platform Programmer’s Reference Manual for a list of the file format numbers.

Returns

Integer. Any positive value (as well as 0) is a valid return. A negative value indicates an error. See Appendix F: Snowbound Error Codes in the RasterMaster Imaging SDK for the Java Platform Programmer’s Reference Manual for more information.

To use the IMGLOW_set_document_input(int dpi, int bits_pix, int format) method to retain color, set the variables as follows:

  • Set the dpi variable to the DPI. For example, set the variable to 200 for the DPI to be 200.
  • Set the bits_pix variable to the bits per pixel. For example, set the variable to 24 for the bits per pixel to be 24.
  • Set the format variable to the file format number for the file format that you are converting. For example, if you are converting a Word document, set the format variable to 86. For a list of file format variables, please see Appendix C: File Type Constants in the RasterMaster Imaging SDK for the Java Platform Programmer’s Reference Manual.

To retain the color in your Word document, set the method to the following:

IMGLOW_set_document_input(200,24, Snow.Defines.DOC( or 86)) .

  • The DPI is 200.
  • The bits per pixel or color is 24.
  • The file format number is 86.

To retain the color in your Excel document, set the method to the following: 

IMGLOW_set_document_input(200,24,Snow.Defines.EXCEL( or 84)) .

  • The DPI is 200.
  • The bits per pixel or color is 24.
  • The file format number is 84.

Note: Files can be very large and may run out of memory when rendering as color.