This is a concise sample to help get Solid Framework up and running. It has been tested with the Free Developer License for Solid Framework using different versions of Microsoft's Visual Studio.
The code below shows you how to convert PDF files to searchable PDF/A-2b, using the OpenFileDialog function to find your PDFs and then the PdfToPdfAConverter to convert them to PDF/A-2b.
- Import the trial Developer License:
License.Import(new StreamReader(@"C:\Users\Joe\license.xml"));
- Locate the PDF files to using OpenFileDialog:
OpenFileDialog dialog = new OpenFileDialog();
//show PDF files
OpFile.Filter = "PDF files (*.pdf)|*.pdf";
//Exit if someone clicks Cancel
if (OpFile.ShowDialog() != System.Windows.Forms.DialogResult.OK)
{
return; // bail on cancel
}
...
- Convert to PDF/A using the PdfToPdfAConverter:
...
string strPDFFullPath = OpFile.FileName;
string strPDFPath = Path.ChangeExtension(strPDFFullPath, "pdfa.pdf");
//Then using a variable called converter convert the pdf to PDF/A using the settings below.
using (PdfToPdfAConverter converter = new PdfToPdfAConverter())
{
//this makes it searchable
converter.OcrType = SolidFramework.Converters.Plumbing.OcrType.CreateSearchableTextLayer;
//this sets the validation
converter.ValidationMode = SolidFramework.Plumbing.ValidationMode.PdfA2B;
//Then Convert the File
converter.AddSourceFile(strPDFFullPath);
converter.ConvertTo(strPDFPath, true);
}