Reputation: 3746
I using iTextSharp version 5.5.9
My PDF file is version 1.7,
I try using Writer.SetPdfVersion
or Writer.PdfVersion
to set PDF Version is 1.6
But result output still is version 1.7
My code bellow:
public void SetPDFVer(string parm_strFile,string parm_strOutputFile )
{
PdfReader reader = new PdfReader(parm_strFile);
using (FileStream fs = new FileStream(parm_strOutputFile, FileMode.Create, FileAccess.Write, FileShare.None))
{
using (PdfStamper stamper = new PdfStamper(reader, fs))
{
stamper.Writer.SetPdfVersion(PdfWriter.PDF_VERSION_1_6);
// stamper.Writer.PdfVersion = PdfWriter.VERSION_1_6;
}
}
}
How can change version PDF from 1.7 to 1.6?
Thank you.
Upvotes: 0
Views: 68
Reputation: 95918
For a PdfStamper
you cannot decrease the version using
stamper.Writer.SetPdfVersion
This allows only increasing it.
If you need to decrease it, this can only be done with a different PdfStamper
constructor:
new PdfStamper(reader, fs, PdfWriter.VERSION_1_6)
Upvotes: 1