Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Images converted from PDF->TIFF are having black background color instead of white in mspaint and microsoftoffice image tools

$
0
0

 Hi,

 

We recently purchased Aspose PDF component, by using below code snippet PDF files are converted to TIFF image.

 

Converted Tiff images –

1)      Images are legitimate when it opens by using “IrfanImage”, “Microsoft office Document Imaging” tools. (Background color is : white and Text color is Black)

2)      Same images when it opens by using “mspaint”, “Windows picture & Fax Viewer” tool – Image background coming in Black and Text in White color. Actually images suppose to be having white background and black text.

 

We would need a quick solution to view converted images uniformly in all image viewing tools.  We appreciate quick response and solution.

 

Attached are:

1)      Original PDF file.( 4831 EBDRTransactionAmountDiffersForm.pdf)

2)      4831 EBDRTransactionAmountDiffersForm_AsposeConverted.tif converted one.

 

Environment: JRE 7, OS: Linux and Windows.

 

Thanks

Raghu

 

Code Snippet:

 

SimpleDateFormat dateForamt=new SimpleDateFormat("dd-MM-yy:HH:mm:ss");

            System.out.println("Image Conversion Start"+ dateForamt.format(System.currentTimeMillis()));

            //Open document

            com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("C:\\ImageConversion\\Pdf\\ImageConversionNewtry\\EBDResolutionProcessForm(8).pdf");

            //Create stream object to save the output image

java.io.OutputStream imageStream = new java.io.FileOutputStream("C:\\ImageConversion\\Pdf\\ImageConversionNewtry\\EBDResolutionProcessForm(8)_Converted.tif");

            //Create Resolution object

            com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(200);

            // instantiate TiffSettings object

            com.aspose.pdf.devices.TiffSettings tiffSettings  = new com.aspose.pdf.devices.TiffSettings();

            // set the compression of resultant TIFF image

            tiffSettings.setCompression(com.aspose.pdf.devices.CompressionType.CCITT4);

            // set the color depth for resultant image

            tiffSettings.setDepth(com.aspose.pdf.devices.ColorDepth.Format1bpp);         

            // skip blank pages while rendering PDF to TIFF

            tiffSettings.setSkipBlankPages(false);

            //Create TiffDevice object with particular resolution

            com.aspose.pdf.devices.TiffDevice   tiffDevice = new com.aspose.pdf.devices.TiffDevice(resolution,tiffSettings);

            //Convert a particular page (Page 1) and save the image to stream

            tiffDevice.process(pdfDocument,1,1, imageStream);

            //Close the stream

            imageStream.close();

            dateForamt=new SimpleDateFormat("dd-MM-yy:HH:mm:ss");

            System.out.println("After Save IMAGE"+ dateForamt.format(System.currentTimeMillis()));

 

 


Viewing all articles
Browse latest Browse all 3131

Trending Articles