PDF File Versions

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

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")
$vbLabelText   $csharpLabel

得られるPDF出力のPDFバージョンを確認できます。

一方、PDFバージョンタグを例えば1.4から2.0に手動で変更することもできますが、それは単なるタグであり、この方法を使用してPDF自体が何か意味のある形で変更されるわけではありません。

Curtis Chau
テクニカルライター

Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。

開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。

準備はいいですか?
Nuget ダウンロード 16,154,058 | バージョン: 2025.11 ただ今リリースされました