PDF File Versions
How do I change the PDF version?
The PDF version tag is set according to the features used when you create a PDF.
For example:
- A basic PDF with no advanced features used will likely be 1.4
- Adding an advanced feature, such as layers, means the version tag updates to 1.7
- Removing layers from the PDF would change the version tag back to 1.4
PDF creation tools will always try to use the lowest PDF version for compatibility reasons.
However, a hack that can be used to change a PDF File version from 1.4 to 1.7 via IronPDF is by using the combination of PdfDocument.Merge()
static method and PdfDocument.Remove()
method.
Code snippet below demonstrates
using IronPdf;
var ren = new ChromePdfRenderer();
var pdf1 = ren.RenderHtmlAsPdf("<h1>hello, this is required PDF</h1>"); //PDF to change file version
var pdf2 = ren.RenderHtmlAsPdf("<h1>this is mock PDF</h1>"); //mock PDF for Merge() method
//PdfDocument.Merge(pdf1, pdf2).SaveAs("merged.pdf");
var pdf3 = PdfDocument.Merge(pdf1, pdf2);
var pdf4 = pdf3.RemovePage(1);
pdf4.SaveAs("anothermerged.pdf"); //output PDF with 1.7 PDF document version
using IronPdf;
var ren = new ChromePdfRenderer();
var pdf1 = ren.RenderHtmlAsPdf("<h1>hello, this is required PDF</h1>"); //PDF to change file version
var pdf2 = ren.RenderHtmlAsPdf("<h1>this is mock PDF</h1>"); //mock PDF for Merge() method
//PdfDocument.Merge(pdf1, pdf2).SaveAs("merged.pdf");
var pdf3 = PdfDocument.Merge(pdf1, pdf2);
var pdf4 = pdf3.RemovePage(1);
pdf4.SaveAs("anothermerged.pdf"); //output PDF with 1.7 PDF document version
Imports IronPdf
Private ren = New ChromePdfRenderer()
Private pdf1 = ren.RenderHtmlAsPdf("<h1>hello, this is required PDF</h1>") 'PDF to change file version
Private pdf2 = ren.RenderHtmlAsPdf("<h1>this is mock PDF</h1>") 'mock PDF for Merge() method
'PdfDocument.Merge(pdf1, pdf2).SaveAs("merged.pdf");
Private pdf3 = PdfDocument.Merge(pdf1, pdf2)
Private pdf4 = pdf3.RemovePage(1)
pdf4.SaveAs("anothermerged.pdf") 'output PDF with 1.7 PDF document version
You can check the PDF version of the resulting PDF output.
On the other hand, you can also change the PDF version tag manually in a PDF, say 1.4 to 2.0, but it is just a tag and won't change the PDF itself in any meaningful way, if using this method.