PDF 파일 버전

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

PDF 버전을 어떻게 변경하나요?

PDF 버전 태그는 PDF를 생성할 때 사용된 기능에 따라 설정됩니다.

예를 들어:

고급 기능을 사용하지 않은 기본 PDF 파일의 경우 PDF 파일 크기는 1.4 정도일 것으로 예상됩니다. 레이어와 같은 고급 기능을 추가하면 버전 태그가 1.7로 업데이트됩니다.

  • PDF에서 레이어를 제거하면 버전 태그가 1.4로 되돌아갑니다.

PDF 생성 도구는 호환성 문제 때문에 항상 가장 낮은 버전의 PDF를 사용하려고 합니다.

하지만 IronPDF를 통해 PDF 파일 버전을 1.4에서 1.7로 변경하는 데 사용할 수 있는 해킹 방법은 PdfDocument.Merge() 정적 메서드와 PdfDocument.RemovePage() 메서드를 조합하여 사용하는 것입니다. 아래 코드 조각은 이를 수행하는 방법을 보여줍니다.

using IronPdf;

var renderer = new ChromePdfRenderer();

// Render the initial PDF that needs its version changed.
var pdf1 = renderer.RenderHtmlAsPdf("<h1>Hello, this is the required PDF</h1>");

// Render a mock PDF to use with the Merge() method.
var pdf2 = renderer.RenderHtmlAsPdf("<h1>This is a mock PDF</h1>");

// Merge the two PDFs. This will update the version to 1.7 if new features from pdf2 are used.
var pdf3 = PdfDocument.Merge(pdf1, pdf2);

// Remove the page from the mock PDF, keeping only the original content.
var pdf4 = pdf3.RemovePage(1);

// Save the resulting PDF document. It should have a version updated to 1.7.
pdf4.SaveAs("anothermerged.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();

// Render the initial PDF that needs its version changed.
var pdf1 = renderer.RenderHtmlAsPdf("<h1>Hello, this is the required PDF</h1>");

// Render a mock PDF to use with the Merge() method.
var pdf2 = renderer.RenderHtmlAsPdf("<h1>This is a mock PDF</h1>");

// Merge the two PDFs. This will update the version to 1.7 if new features from pdf2 are used.
var pdf3 = PdfDocument.Merge(pdf1, pdf2);

// Remove the page from the mock PDF, keeping only the original content.
var pdf4 = pdf3.RemovePage(1);

// Save the resulting PDF document. It should have a version updated to 1.7.
pdf4.SaveAs("anothermerged.pdf");
$vbLabelText   $csharpLabel

생성된 PDF 출력물의 PDF 버전을 확인할 수 있습니다.

반면에 PDF에서 버전 태그를 수동으로 변경할 수도 있습니다. 예를 들어 1.4에서 2.0으로 변경할 수 있지만, 이는 단순히 태그일 뿐이며 이 방법을 사용해도 PDF 자체에는 실질적인 변화가 없습니다.

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

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

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

시작할 준비 되셨나요?
Nuget 다운로드 17,527,568 | 버전: 2026.2 방금 출시되었습니다