我无法在创建 Pdf/A 的 pdf 中嵌入颜色 space

I can't get embed a color space in a pdf for Pdf/A creation

这是我的问题,我已经用库 PdfBox 制作了一个 java 程序来从图像和其他 pdf 制作 pdf 所以这个工作正常,但我想要生成 PDF/A-1。问题是我无法嵌入颜色 space.

我试过 PDFBox

给出的CreatePDFA.java的代码
// Create output intent
InputStream colorProfile = CreatePDFA.class.getResourceAsStream("colorSpacePath");
PDOutputIntent oi = new PDOutputIntent(doc, colorProfile); 
oi.setInfo("sRGB IEC61966-2.1"); 
oi.setOutputCondition("sRGB IEC61966-2.1"); 
oi.setOutputConditionIdentifier("sRGB IEC61966-2.1"); 
oi.setRegistryName("http://www.color.org"); 
doc.getDocumentCatalog().addOutputIntent(oi);

我在行中收到 NullPointerException
PDOutputIntent oi = new PDOutputIntent(doc, colorProfile);

异常:

Exception in thread "main" java.lang.NullPointerException
at java.desktop/java.awt.color.ICC_Profile.getProfileDataFromStream(ICC_Profile.java:1034)
at java.desktop/java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:1016)
at org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent.configureOutputProfile(PDOutputIntent.java:112)
at org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent.<init>(PDOutputIntent.java:49)
at src.Kairos.CreatePDFA.doIt(CreatePDFA.java:124)
at src.Kairos.CreatePDFA.main(CreatePDFA.java:153)

这是有效的代码:

InputStream colorProfile = new FileInputStream(colorSpacePath);
PDOutputIntent oi = new PDOutputIntent(doc, colorProfile);
oi.setInfo("sRGB IEC61966-2.1");
oi.setOutputCondition("sRGB IEC61966-2.1");
oi.setOutputConditionIdentifier("sRGB IEC61966-2.1")
oi.setRegistryName("http://www.color.org");
doc.getDocumentCatalog().addOutputIntent(oi);
colorProfile.close()