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

Tilman Hausherr commented on PDFBOX-4110:
-----------------------------------------

You MUST use a jbig2 plugin because the page contains JBIG2 encoded images. And 
you should also find out why you don't get the log messages, which tell to use 
the jbig2 plugin. I get this when not using the jbig2 plugin:
{code:java}
Feb. 14, 2018 5:58:04 NACHM. org.apache.pdfbox.filter.JBIG2Filter decode
SCHWERWIEGEND: Can't find an ImageIO plugin to decode the JBIG2 encoded 
datastream.{code}
Get the jbig2 plugin here:
https://github.com/levigo/jbig2-imageio/releases Use 1.6.5 or earlier.
(the url will change within a few weeks, because the plugin has been donated to 
us, but the new version isn't released yet)

Then put the jar file in your classpath.
See also 
https://pdfbox.apache.org/1.8/dependencies.html

2.0 does work with jdk 1.6. Maybe ask that separately at a later time (on the 
user mailing list).

> PDF to JPG conversion is returning distorted images
> ---------------------------------------------------
>
>                 Key: PDFBOX-4110
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4110
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.8.11
>            Reporter: Avinash
>            Priority: Blocker
>         Attachments: 1000-test-1.jpg, 1000-test-2.jpg, 
> 347254-111788-437553AC1B68331C9B04E6D099E39CB5.pdf, flight_receipt.pdf
>
>
> Hello,
> We are using PDFBox-1.8.11 to convert PDFs to JPG images in our project.
> The conversion is working fine for some PDFs but for some of the PDFs, the 
> converted images in JPG format seems to be distorted (esp, flight itenary 
> PDFs).  An example of PDF is attached to this ticket for your reference 
> [347254-111788-437553AC1B68331C9B04E6D099E39CB5.pdf].
> When this PDF is converted to JPG using PDFbox API, the image returned seems 
> to be corrupted with weird characters.
>  
> Below is the code we are using for PDF to JPG conversion.
> Kindly help us to find out how this issue can be resolved. Thank you !
>  
> public String convertPDFtoJPG(String source , String filepath1, String 
> filePath2, IqiArInvoiceEventSourceVO arInvoiceEventSourceVO ) throws 
> BaseECapException{
>  
>  String newFile="";
>  
>  //IPM-5181
>  String filePathDelimiter = ";";
>  ArrayList<String> filepaths = new ArrayList<String>();
>  
>  {color:#FF0000}_try{_{color}
> {color:#FF0000} _PDDocument doc=PDDocument.load(new 
> FileInputStream(source));_{color}
> {color:#FF0000} _List<PDPage> 
> pages=doc.getDocumentCatalog().getAllPages();_{color}
> {color:#FF0000} _Iterator<PDPage> i= pages.iterator();_{color}
>  
> {color:#FF0000} _int count=1;_{color}
> {color:#FF0000} _while(i.hasNext()){_{color}
> {color:#FF0000} _PDPage page=i.next();_ {color}
> {color:#FF0000} _BufferedImage bi=page.convertToImage();_{color}
>  String saveFilePath = filepath1+filePath2;
>  
>  if (!new File(saveFilePath).exists()) {
>  new File(saveFilePath).mkdirs();
>  }
>  
> Thanks,
> Avinash



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to