Reducir el tamaño del archivo PDF de salida en IronOCR

This article was translated from English: Does it need improvement?
Translated
View the article in English

¿Cómo puedo reducir el tamaño del archivo PDF de salida en IronOCR?

IronOCR aumentará automáticamente la escala de las entradas detectadas como de baja calidad. (por debajo de 150DPI) para garantizar resultados de lectura precisos.

Si se detecta un DPI inferior a 150, TargetDPI (225DPI por defecto) define el DPI al que se renderiza un PDF - es lo mismo que establecer manualmente TargetDPI = 225.

Para reducir el tamaño del archivo de salida, puede establecer un TargetDPI más bajo, lo que creará PDF más pequeños, pero un valor demasiado bajo puede afectar al rendimiento del OCR. Todo en equilibrio.

Los valores sugeridos son 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");
    }
// 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");
    }
' how to reduce and usage by by reducing DPI
	'Example 1
	Imports IronOcr
	Private Ocr = New IronTesseract()
	Using Input = New OcrInput()
		Input.TargetDPI = 96 ' DPI of output, default is 225
		Input.AddPdf("example.pdf", "password")
		Dim Result = Ocr.Read(Input)
		Console.WriteLine(Result.Text)
	End Using

	'Example 2
	Dim ocr = New IronTesseract()
	Using ocrInput As New OcrInput()
	ocrInput.AddPdf("img/Input.pdf", 72) 'TargetDPI
	Dim ocrResult = ocr.Read(ocrInput)
	ocrResult.SaveAsSearchablePdf("Output.pdf")
	End Using
VB   C#

Para desactivar el escalado automático, utilice TargetDPI = 0. Esto ignorará el valor TargetDPI y el archivo de entrada se leerá tal cual.

Consulte la API para obtener más información: https://ironsoftware.com/csharp/ocr/object-reference/api/IronOcr.OcrInput.html?q=targetdpi#IronOcr_OcrInput_TargetDPI