This article aims to provide you withway to render PDF to image data of text and set color depth, and you can keep reading this article to get more details.
First, you need to know which tool we need to use for the later process, it is VeryDOC Raster to Text OCR Converter Command Line. This tool allows lots of operations to happen in basic process from PDF file to text and setting text properties flexibly and professionally. And of course, even when image color depth needs to be set, which is located in source PDF file, this software also support rendering image data from PDF file to text file. So by now, if my description arises your interest at this tool, please feel free to download trial version here, which means watermark will be left on produced file.
Then, here are details to use this tool to set color depth during rendering PDF to image data of text through commands:
Step1. Open command prompt
You need to run cmd.exe to open running environment of commands for Windows systems, and then, command prompt can be popped on screen directly.
Step2. Render PDF to image data of text and edit image color depth
It is not complex for you to fulfill these operation at all, and all you need to do is just to refer to the following example and then input your own commands and parameters to accomplish them in your own computer. So, firstly, here is relevant parameter you need to know:
-bitcount <int>: set color depth when render PDF page to image data, it can be set 1, 8, 24, default is 8bit
NOTE: if source PDF file is image PDF, suppose you would not use OCR technology to scan detail characters, image PDF will be converted to image data text. Or, source PDF contains images, this parameter still work:)
Then, here are examples that you can refer to:
pdf2txtocr.exe -bitcount 1 C:\in.pdf C:\out.txt
pdf2txtocr.exe -bitcount 8 C:\in.pdf C:\out.txt
pdf2txtocr.exe –ocr -bitcount 24 C:\in.pdf C:\out.txt
note: the 1st, 2nd examples show us how to render normal PDF file to text with specific image color depth when there are some images in source PDF; the 3rd example shows us how to edit color depth during using OCR technology to render scanned PDF file to image data of text and set image color depth.
- pdf2txtocr.exe: call executive file “pdf2txtocr.exe”
- C:\in.pdf: specify input PDF file
- C:\out.txt: specify output TXT file
- -ocr: enable OCR function for scanned PDF file
After you use our tool to convert PDF file to image data of text and set image color depth through commands, targeting text file containing specific color depth images can be produced into destination folder directly and instantly. 🙂
For more articles about this software with more functions, welcome to visit here frequently. And for full version of VeryDOC Raster to Text OCR Converter Command Line, please click following icon:
Thank you for reading this article, which aims to show you how to set color depth when rendering PDF to image data of text through commands.