Reduce file size of output PDF in IronOcr
How do I reduce the file size of the output PDF in IronOcr?
To reduce output file size you can set a lower TargetDPI, which will create smaller PDFs, but going too low may affect OCR performance. Everything in balance.
Suggested values are 96, 72, 48
// how to reduce and usage by by reducing DPI //Example 1 using IronOcr; var Ocr = new IronTesseract(); using (var Input = new OcrInput()) { Input.TargetDPI = 96; // DPI of output, default is 225 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); //TargetDPI var ocrResult = ocr.Read(ocrInput); ocrResult.SaveAsSearchablePdf(@"Output.pdf"); }
To disable automatic upscaling, please use TargetDPI = 0
. This will ignore the TargetDPI value and the input file will be read as-in.
See the API for more information: https://ironsoftware.com/csharp/ocr/object-reference/api/IronOcr.OcrInput.html?q=targetdpi#IronOcr_OcrInput_TargetDPI