PDF 파일 버전
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");
Imports IronPdf
Private renderer = New ChromePdfRenderer()
' Render the initial PDF that needs its version changed.
Private pdf1 = renderer.RenderHtmlAsPdf("<h1>Hello, this is the required PDF</h1>")
' Render a mock PDF to use with the Merge() method.
Private 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.
Private pdf3 = PdfDocument.Merge(pdf1, pdf2)
' Remove the page from the mock PDF, keeping only the original content.
Private pdf4 = pdf3.RemovePage(1)
' Save the resulting PDF document. It should have a version updated to 1.7.
pdf4.SaveAs("anothermerged.pdf")
생성된 PDF 출력물의 PDF 버전을 확인할 수 있습니다.
반면에 PDF에서 버전 태그를 수동으로 변경할 수도 있습니다. 예를 들어 1.4에서 2.0으로 변경할 수 있지만, 이는 단순히 태그일 뿐이며 이 방법을 사용해도 PDF 자체에는 실질적인 변화가 없습니다.

