本文介绍如何使用spire.pdf for java将pdf转为符合pdf/a-1a, 2a, 3a, 1b, 2b和3b标准的pdf。
import com.spire.pdf.conversion.pdfstandardsconverter;
public class convertpdftopdfa {
public static void main(string[] args) {
//指定输入文档路径
string inputfile = "c:/users/administrator/desktop/sample.pdf";
//指定输出文档的存放文件夹
string outputfolder = "c:/users/administrator/desktop/output/";
//创建pdfstandardsconverter对象,传入输入文档路径
pdfstandardsconverter converter = new pdfstandardsconverter(inputfile);
//转换为pdfa1a
converter.topdfa1a(outputfolder "topdfa1a.pdf");
//转换为pdfa1b
converter.topdfa1b(outputfolder "topdfa1b.pdf");
//转换为pdfa2a
converter.topdfa2a(outputfolder "topdfa2a.pdf");
//转换为pdfa2b
converter.topdfa2b(outputfolder "topdfa2b.pdf");
//转换为pdfa3a
converter.topdfa3a(outputfolder "topdfa3a.pdf");
//转换为pdfa3b
converter.topdfa3b(outputfolder "topdfa3b.pdf");
}
}