[ 
https://issues.apache.org/jira/browse/PDFBOX-5563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17683652#comment-17683652
 ] 

Tilman Hausherr edited comment on PDFBOX-5563 at 2/16/23 6:09 PM:
------------------------------------------------------------------

Submitted to Oracle, [JDK-8301837|https://bugs.openjdk.org/browse/JDK-8301837]

{code}
public class PDFBOX5563CMM
{
    public static void main(String[] args) throws IOException
    {
        System.out.println(System.getProperty("java.version"));
        InputStream is = new 
URL("https://issues.apache.org/jira/secure/attachment/13055078/PDFBOX-5563.icc";).openStream();
        ICC_Profile profile = ICC_Profile.getInstance(is);
        ICC_ColorSpace cs = new ICC_ColorSpace(profile);
        cs.toRGB(new float[cs.getNumComponents()]);
    }
}
{code}



was (Author: tilman):
Submitted to Oracle, internal review ID : 9074767

{code}
public class PDFBOX5563CMM
{
    public static void main(String[] args) throws IOException
    {
        System.out.println(System.getProperty("java.version"));
        InputStream is = new 
URL("https://issues.apache.org/jira/secure/attachment/13055078/PDFBOX-5563.icc";).openStream();
        ICC_Profile profile = ICC_Profile.getInstance(is);
        ICC_ColorSpace cs = new ICC_ColorSpace(profile);
        cs.toRGB(new float[cs.getNumComponents()]);
    }
}
{code}


> Can't open PDF with PDFBox: java.awt.color.CMMException: LCMS error 13: 
> Couldn't link the profiles
> --------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5563
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5563
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.24, 2.0.27, 3.0.0 PDFBox
>         Environment: Java: Amazon corretto windows x64 jdk
> OS: Windows 10
>            Reporter: Viktor Merkel
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.28, 3.0.0 PDFBox
>
>         Attachments: PDFBOX-5563.icc, problem-1.pdf
>
>
> If I try to open the attached PDF document face the following error message 
> and the document will not be displayed:
>  
> {noformat}
> java.lang.RuntimeException: java.util.concurrent.ExecutionException: 
> java.awt.color.CMMException: LCMS error 13: Couldn't link the profiles
>     
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:481)
>     
> java.desktop/sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
>     java.base/java.security.AccessController.doPrivileged(Native Method)
>     
> java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
> Caused by: java.util.concurrent.ExecutionException: 
> java.awt.color.CMMException: LCMS error 13: Couldn't link the profiles
>     
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:461)
>     
> java.desktop/sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
>     java.base/java.security.AccessController.doPrivileged(Native Method)
>     
> java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
> Caused by: java.awt.color.CMMException: LCMS error 13: Couldn't link the 
> profiles
>     java.desktop/sun.java2d.cmm.lcms.LCMS.createNativeTransform(Native Method)
>     java.desktop/sun.java2d.cmm.lcms.LCMS.createTransform(LCMS.java:156)
>     
> java.desktop/sun.java2d.cmm.lcms.LCMSTransform.doTransform(LCMSTransform.java:150)
>     
> java.desktop/sun.java2d.cmm.lcms.LCMSTransform.colorConvert(LCMSTransform.java:624)
>     
> org.apache.pdfbox.pdmodel.graphics.color.PDICCBased.toRGB(PDICCBased.java:351)
>     org.apache.pdfbox.rendering.PageDrawer.getPaint(PageDrawer.java:350)
>     
> org.apache.pdfbox.rendering.PageDrawer.getNonStrokingPaint(PageDrawer.java:746)
>     org.apache.pdfbox.rendering.PageDrawer.fillPath(PageDrawer.java:878)
>     
> org.apache.pdfbox.contentstream.operator.graphics.FillNonZeroRule.process(FillNonZeroRule.java:37)
>     
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:933)
>     
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:514)
>     
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:492)
>     
> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:155)
>     org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:277)
>     org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:347)
>     
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:449)
>     
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:1)
>     java.base/java.lang.Thread.run(Thread.java:829)
> {noformat}
> The same document can be successfully opened with Adobe's Acrobat Reader.
> If I add a try catch statement in the affected toRGB function of 
> org.apache.pdfbox.pdmodel.graphics.color.PDICCBased and return the value from 
> the input I'm able to display display the document but the upper and lower 
> bar is yellow instead blue (like in Acrobat Reader).
> {code:java}
> @Override
>     public float[] toRGB(float[] value) throws IOException
>     {
>         if (isRGB)
>         {
>             return value;
>         }
>         if (awtColorSpace != null)
>         {
>             // PDFBOX-2142: clamp bad values
>             // WARNING: toRGB is very slow when used with LUT-based ICC 
> profiles
>             try {
>                 return awtColorSpace.toRGB(clampColors(awtColorSpace, value));
>             } catch (Exception ex) {
>                 return value;
>             }
>         }
>         else
>         {
>             return alternateColorSpace.toRGB(value);
>         }
>     } {code}
> Unfortunately I'm not familiar with color profiles and color spaces.
> Any suggest how to overcome this problem?
> Thanks in advance.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to