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

Tilman Hausherr commented on PDFBOX-1442:
-----------------------------------------

That file has several problems, one of them are lines like this one:
{code}
<</Coords[0 240 0 240]/ColorSpace/DeviceRGB/ShadingType 2/Extend[true 
true]/Function 3 0 R>>
{code}
The coords entry has identical coordinates. See p. 310 of the 1.7 spec, it will 
result in a divide by zero. As a first step, I added this before "new 
AxialShadingPaint" at two places:
{code}
  float [] coords = ((PDShadingType2) shading).getCoords().toFloatArray();
  if (coords[0] == coords[2] && coords[1] == coords[3])
  {
      LOG.error("ShadingType2: coordinates are identical");
      return null;
  }                
{code}
After this change, the image is less bad (but still useless :-) )

> bar chart converted from PDF is totally a black area.
> -----------------------------------------------------
>
>                 Key: PDFBOX-1442
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1442
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDFReader
>    Affects Versions: 1.7.1
>            Reporter: James Zhou
>              Labels: shadingpattern
>         Attachments: clientfocus.PNG, clientfocus.pdf
>
>
> The bar charts converted from PDF is totally a black area. The code is as 
> following:
>                  
> PDFImageWriter imageWriter = new PDFImageWriter();
>                  boolean success = imageWriter.writeImage(document, 
> imageFormat, password,
>                          startPage, endPage, outputPrefix, imageType, 
> resolution);
>                  if (!success)
>                  {
>                        logger.error( "Error: no writer found for image format 
> '"
>                              + imageFormat + "'" );
>                      System.exit(1);
>    
>                  }
> I will attach the ppt and PNG files later



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to