Reduce file size of output PDF in IronOcr
How do I reduce the file size of the output PDF in IronOcr?
Input.TargetDPI defines the DPI that a PDF is rendered at. (The default value is 225 DPI).
To reduce file size, you can set a lower DPI, as follow. This will create smaller PDFs, but going too low will affect OCR performance.
Everything in balance:
// how to reduce and usage by by reducing DPI //Example 1 using IronOcr; var Ocr = new IronTesseract(); using (var Input = new OcrInput()) { Input.MinimumDPI = 150; // default is 225 Input.TargetDPI = 150; // default is 250 Input.AddPdf("example.pdf", "password"); var Result = Ocr.Read(Input); Console.WriteLine(Result.Text); } //Example 2 var ocr = new IronTesseract(); using (var ocrInput = new OcrInput()) { ocrInput.AddPdf("img/Input.pdf", 72); //DPI var ocrResult = ocr.Read(ocrInput); ocrResult.SaveAsSearchablePdf(@"Output.pdf"); }
See the API for more information: https://ironsoftware.com/csharp/ocr/object-reference/api/IronOcr.OcrInput.html?q=targetdpi#IronOcr_OcrInput_TargetDPI