ALT Linux repositórios
Group :: Desenvolvimento/Java
RPM: pdfbox
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: pdfbox-1.8.13-use-system-icc-profiles-openicc.patch
Download
Download
diff -Nru pdfbox-1.8.13/examples/src/main/java/org/apache/pdfbox/examples/pdfa/CreatePDFA.java pdfbox-1.8.13.icc-profiles-openicc/examples/src/main/java/org/apache/pdfbox/examples/pdfa/CreatePDFA.java
--- pdfbox-1.8.13/examples/src/main/java/org/apache/pdfbox/examples/pdfa/CreatePDFA.java 2016-12-05 20:30:10.000000000 +0100
+++ pdfbox-1.8.13.icc-profiles-openicc/examples/src/main/java/org/apache/pdfbox/examples/pdfa/CreatePDFA.java 2017-01-01 12:02:28.571917093 +0100
@@ -112,16 +112,20 @@
System.err.println(xmpException.getMessage());
}
- InputStream colorProfile = CreatePDFA.class
- .getResourceAsStream("/org/apache/pdfbox/resources/pdfa/sRGB.icc");
- // create output intent
- 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");
- cat.addOutputIntent(oi);
-
+ InputStream colorProfile = null;
+ try {
+ colorProfile = new java.io.FileInputStream("/usr/share/color/icc/OpenICC/sRGB.icc");
+ // create output intent
+ 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");
+ cat.addOutputIntent(oi);
+ } catch (java.io.FileNotFoundException e) {
+ colorProfile = null;
+ }
+
doc.save( file );
}
diff -Nru pdfbox-1.8.13/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java pdfbox-1.8.13.icc-profiles-openicc/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
--- pdfbox-1.8.13/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java 2016-12-05 20:30:10.000000000 +0100
+++ pdfbox-1.8.13.icc-profiles-openicc/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java 2017-01-01 12:07:20.344725478 +0100
@@ -107,25 +107,28 @@
List<PDOutputIntent> outputIntents = catalog.getOutputIntent();
assertTrue(outputIntents.isEmpty());
- // add an OutputIntent
- colorProfile = TestPDDocumentCatalog.class.getResourceAsStream("sRGB.icc");
- // create output intent
- 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);
+ try {
+ // add an OutputIntent
+ colorProfile = new java.io.FileInputStream("/usr/share/color/icc/OpenICC/sRGB.icc");
+ // create output intent
+ 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);
- // retrieve OutputIntents
- outputIntents = catalog.getOutputIntent();
- assertEquals(1,outputIntents.size());
-
- // set OutputIntents
- catalog.setOutputIntents(outputIntents);
- outputIntents = catalog.getOutputIntent();
- assertEquals(1,outputIntents.size());
+ // retrieve OutputIntents
+ outputIntents = catalog.getOutputIntent();
+ assertEquals(1,outputIntents.size());
+ // set OutputIntents
+ catalog.setOutputIntents(outputIntents);
+ outputIntents = catalog.getOutputIntent();
+ assertEquals(1,outputIntents.size());
+ } catch (java.io.FileNotFoundException e) {
+ colorProfile = null;
+ }
} finally {
if(doc != null)
{