PDF Xpress for .NET - User Guide > How To > Save Image as PDF/A |
PDF Xpress supports saving the image in PDF/A format.
C# Example |
Copy Code
|
---|---|
//this method demonstrates how to create a PDF/A-1b compliant //document from a compressed image of a Document public void saveImageAsPDFa(string imageFileName, Document targetDocument, string iccFileName) { PageOptions targetPageOptions = new PageOptions(); //using standard page size targetPageOptions.MediaHeight = 72.0 * 11; targetPageOptions.MediaWidth = 72.0 * 8.5; targetDocument.CreatePage(-1, targetPageOptions); targetDocument.AddImage(0, 0, 0, targetPageOptions.MediaWidth, targetPageOptions.MediaHeight, ImageFitSettings.Shrink, imageFileName, 0); ConvertOptions convertOpts = new ConvertOptions(); //specify a valid ICC profile to embed convertOpts.IccProfileFilename = iccFileName; convertOpts.PdfType = PdfType.pdfA1b; //convert the target document to PDF/A-1b try { targetDocument.ConvertToPdfA(convertOpts); } catch (PdfXpressException pdfXexception) { //an error occurred in conversion } //save the converted PDF/A-1b document Accusoft.PdfXpressSdk.SaveOptions saveOpts = new Accusoft.PdfXpressSdk.SaveOptions(); saveOpts.Filename = "imagePDFa.pdf"; targetDocument.Save(saveOpts); } |