IronOCR에서 PDF 파일 크기 줄이기

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

IronOCR에서 출력 PDF의 파일 크기를 줄이려면 어떻게 하나요?

IronOCR은 정확한 읽기 결과를 보장하기 위해 저품질(150DPI 미만)로 감지된 입력을 자동으로 업스케일합니다.

DPI가 150 미만으로 감지되면, TargetDPI(기본 225DPI)가 PDF가 렌더링되는 DPI를 정의합니다. 이것은 TargetDPI = 225을 수동으로 설정하는 것과 같습니다.

출력 파일 크기를 줄이기 위해, 더 작은 PDF를 생성할 수 있는 낮은 TargetDPI을 설정할 수 있습니다. 그러나 너무 낮게 설정하면 OCR 성능에 영향을 미칠 수 있으므로 균형을 유지하는 것이 중요합니다.

권장 값은 각각 96, 72, 48입니다.

// Example of reducing PDF output file size by lowering the DPI

// Example 1: Reducing DPI to 96
using IronOcr;  // Import IronOCR namespace

var Ocr = new IronTesseract(); // Initialize IronTesseract for OCR operations

using (var Input = new OcrInput()) // Create OCR input object
{
    Input.TargetDPI = 96;    // Set the desired DPI; 96 is used for smaller output size
    Input.AddPdf("example.pdf", "password"); // Add input PDF (with optional password)

    var Result = Ocr.Read(Input); // Perform OCR on the input
    Console.WriteLine(Result.Text); // Output recognized text to the console
}

// Example 2: Another way to set DPI
var ocr = new IronTesseract();

using (var ocrInput = new OcrInput()) // Create a new OCR input object
{
    ocrInput.AddPdf("img/Input.pdf", 72); // Add PDF with the specified DPI of 72
    var ocrResult = ocr.Read(ocrInput); // Read and process the PDF

    ocrResult.SaveAsSearchablePdf(@"Output.pdf"); // Save result to a searchable PDF
}
// Example of reducing PDF output file size by lowering the DPI

// Example 1: Reducing DPI to 96
using IronOcr;  // Import IronOCR namespace

var Ocr = new IronTesseract(); // Initialize IronTesseract for OCR operations

using (var Input = new OcrInput()) // Create OCR input object
{
    Input.TargetDPI = 96;    // Set the desired DPI; 96 is used for smaller output size
    Input.AddPdf("example.pdf", "password"); // Add input PDF (with optional password)

    var Result = Ocr.Read(Input); // Perform OCR on the input
    Console.WriteLine(Result.Text); // Output recognized text to the console
}

// Example 2: Another way to set DPI
var ocr = new IronTesseract();

using (var ocrInput = new OcrInput()) // Create a new OCR input object
{
    ocrInput.AddPdf("img/Input.pdf", 72); // Add PDF with the specified DPI of 72
    var ocrResult = ocr.Read(ocrInput); // Read and process the PDF

    ocrResult.SaveAsSearchablePdf(@"Output.pdf"); // Save result to a searchable PDF
}
$vbLabelText   $csharpLabel

자동 업스케일링을 비활성화하려면 TargetDPI = 0을 사용하세요. 이렇게 하면 IronOCR이 TargetDPI 값을 무시하고 입력 파일을 그대로 읽습니다.

API에 대한 자세한 정보는 다음을 참조하세요: IronOCR API 참조문서

커티스 차우
기술 문서 작성자

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다.

시작할 준비 되셨나요?
Nuget 다운로드 5,525,971 | 버전: 2026.3 방금 출시되었습니다
Still Scrolling Icon

아직도 스크롤하고 계신가요?

빠른 증거를 원하시나요? PM > Install-Package IronOcr
샘플을 실행하세요 이미지가 검색 가능한 텍스트로 바뀌는 것을 확인해 보세요.