You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2018/02/14 07:44:00 UTC

[jira] [Commented] (PDFBOX-4110) PDF to JPG conversion is returning distorted images

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

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

The current 1.8 version is 1.8.13. (And there is a 2.0.8 version too) Please retest and post the image you got. Also post any log messages (did you use the jbig2 plugin?). To get a higher resolution, use convertToImage with a parameter.

> 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: 347254-111788-437553AC1B68331C9B04E6D099E39CB5.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-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org