PDF to TIFF with adjusted contrast

Hi all,

I’m using following code in order to convert a PDF file into Tiff:

//create PdfConverter object and bind input PDF file
PdfConverter pdfConverter = new PdfConverter();
// create Resolution object with 300 as an argument
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(300);
// specify the resolution value for PdfConverter object
pdfConverter.Resolution = resolution;
// bind the source PDF file
pdfConverter.BindPdf(“input.pdf”);
// start the conversion process
pdfConverter.DoConvert();
//create TiffSettings object and set ColorDepth
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format1bpp;
//convert to TIFF image
pdfConverter.SaveAsTIFF(“output.tif”, 300, 300, tiffSettings);
// close Converter object
pdfConverter.Close();

The result for some PDF files isn’t very well. The letters have lots of gaps. You can have a look into the attached screenshot.

I guess the adjustment of contrast would be helpful. But I don’t know how to intigrate an adjustment of output Tiff’s contrast value in my code.

Any help is appreciated.

Thanks,
Philipp

Hi Philipp,


Thanks for using our API’s.

Can you please share the resource PDF file so that we can test the scenario in our environment. We are sorry for this inconvenience.

Hello Nayyer,

I add an example to my post.

Thanks for supporting me!

Cheers,
Philipp

Hi Philipp,

Thanks for sharing the resource file.

I have tested the scenario using Aspose.Pdf for .NET 10.7.0 and as per my observations, the PDF file is properly being converted to TIFF format and I am unable to notice any characters spacing issue. For your convenience, I have also attached the resultant file generated over my end.

Can you please try using the latest release and in case the issue still persists, please share some details regarding your working environment. We are sorry for this inconvenience.

[C#]

//create PdfConverter object and bind input PDF file
PdfConverter pdfConverter = new PdfConverter();
// create Resolution object with 300 as an argument
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(300);
// specify the resolution value for PdfConverter object
pdfConverter.Resolution = resolution;
// bind the source PDF file
pdfConverter.BindPdf("c:/pdftest/example.2.PDF");
// start the conversion process
pdfConverter.DoConvert();
//create TiffSettings object and set ColorDepth
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format1bpp;
//convert to TIFF image
pdfConverter.SaveAsTIFF("c:/pdftest/example_output.tif", tiffSettings);
// close Converter object
pdfConverter.Close();

Hi Nayye,

thanks for your support again.

I don’t see a difference between your Tiff and mine. Your output_example contains the same gaps between the pixels. Our OCR engine isn’t able to read the characters in a proper way.
You need to zoom into the Tiff image in order to see the problem.

Thank you for any help.

Regards,
Philipp

Hi Philipp,


Thanks for sharing the details.

Please take a look over attached image file which shows the view of TIFF image and PDF document. The output TIFF image shows exact character spacing as shown for characters in PDF document. However we have Aspose.OCR for .NET which provides the feature to perform OCR over image file. Meanwhile I have intimated my fellow workers from respective team to test the OCR over resultant image and share their findings.
Hi Philipp,

Please, note that the language detected in the attached image is German. This is to update you that currently Aspose.OCR APIs do not support the German language. For more information on different language support, please follow the link Working with Different Languages. We already have this feature on our road map. We have attached this thread with the appropriate feature ticket ID i.e. OCR-31611. We will update you accordingly about the progress and availability of the said feature.

Hope the above information helps. In case of any issues, need further clearance please be sure to let us know, we will be glad to assist you.