Avinash created PDFBOX-4110:
-------------------------------

             Summary: 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
         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-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to