Apryse
Published April 03, 2025
Updated August 06, 2026
6 min
Convert an Image to Grayscale PDF for Better OCR in C#
Apryse

Pre-processing is a critical step in improving the accuracy and quality of OCR (and also for ICR of handwriting) results.
One aspect of pre-processing involves de-skewing, and removal of artifacts such as staples and punched holes. Another is adjusting the color used by the document. OCR may give different results for text data extraction depending on whether a document is black and white, grayscale or color.
The Apryse SDK makes it easy to convert images to grayscale then import them into a PDF. In this article we will look at how to do this using C#, but the SDK also supports many other programming languages, and can be used on Windows, Linux and macOS.
General Process for Converting an Image to a Grayscale PDF
- Create PDF from source image.
- Render page using
PDFDraw. - Force grayscale color space.
- Export JPEG.
- Re-import image.
- Save resulting PDF.
PDFNet needs to be initialized with a license key before it is used, and should be terminated when you have finished with it.
C#
Keep your license key confidential
License keys are uniquely generated and strictly confidential. Don't publish or store them in any public location, including public GitHub repositories.
You can get a trial license key for testing purposes, but you will need a commercial license in a production environment.
What next?
You can now take the grayscale PDF and feed that into an OCR engine, or use it for any other purpose that suits your business needs.
Next Steps
If you’re interested in trying Apryse SDK, you can start your trial right away. If you have any questions, please contact sales or check out our Discord.
Learn how to convert JPEG to PDF in C#.


