You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2015/12/07 21:02:36 UTC
svn commit: r1718449 -
/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDOutputIntent.java
Author: tilman
Date: Mon Dec 7 20:02:36 2015
New Revision: 1718449
URL: http://svn.apache.org/viewvc?rev=1718449&view=rev
Log:
PDFBOX-3157: don't hardcode N to 3
Modified:
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDOutputIntent.java
Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDOutputIntent.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDOutputIntent.java?rev=1718449&r1=1718448&r2=1718449&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDOutputIntent.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDOutputIntent.java Mon Dec 7 20:02:36 2015
@@ -16,6 +16,8 @@
*/
package org.apache.pdfbox.pdmodel.graphics.color;
+import java.awt.color.ICC_Profile;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -87,12 +89,14 @@ public class PDOutputIntent implements C
dictionary.setString(COSName.REGISTRY_NAME, value);
}
- private PDStream configureOutputProfile (PDDocument doc, InputStream colorProfile) throws IOException {
- PDStream stream = new PDStream(doc,colorProfile, false);
- stream.getStream().setFilters(COSName.FLATE_DECODE);
- stream.getStream().setInt( COSName.LENGTH, stream.getByteArray().length );
- stream.getStream().setInt(COSName.N, 3);
- stream.addCompression();
+ private PDStream configureOutputProfile(PDDocument doc, InputStream colorProfile) throws IOException
+ {
+ ICC_Profile icc = ICC_Profile.getInstance(colorProfile);
+ PDStream stream = new PDStream(doc, new ByteArrayInputStream(icc.getData()), false);
+ stream.getStream().setFilters(COSName.FLATE_DECODE);
+ stream.getStream().setInt(COSName.LENGTH, stream.getByteArray().length);
+ stream.getStream().setInt(COSName.N, icc.getNumComponents());
+ stream.addCompression();
return stream;
}
}