Convert existing PDF document to PDF/A-1b

  • Reference KB000156
  • Type Code sample
  • Product PDFKit.NET
  • Category Convert PDF
  • Created 11/10/2011

This code sample shows how to convert an existing PDF document to a PDF/A-1b compliant PDf document. PDF/A is an ISO-standardized version of the Portable Document Format (PDF) specialized for the digital preservation of electronic documents.


using (FileStream fileIn = new FileStream("in.pdf", FileMode.Open, FileAccess.Read))
{
  Document document = new Document(fileIn);

  using (FileStream fileOut = new FileStream("out.pdf", FileMode.Create, FileAccess.Write))
  {
    WriteOptions options = new WriteOptions();
    options.Format = DocumentFormat.PdfA1b;
                    
    document.Write(fileOut, options); 
  }
}
 1 using (FileStream fileIn = new FileStream("in.pdf", FileMode.Open, FileAccess.Read))
 2 {
 3   Document document = new Document(fileIn);
 4 
 5   using (FileStream fileOut = new FileStream("out.pdf", FileMode.Create, FileAccess.Write))
 6   {
 7     WriteOptions options = new WriteOptions();
 8     options.Format = DocumentFormat.PdfA1b;
 9                     
10     document.Write(fileOut, options); 
11   }
12 }