[
https://issues.apache.org/jira/browse/PDFBOX-4110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364396#comment-16364396
]
Avinash commented on PDFBOX-4110:
---------------------------------
Hi,
I tried to using version 1.8.13 and convertToImage with a parameter and
re-tested but haven't noticed any change. I also tried using latest 2.0.8
version but there was some XML parsing related error and seems it is related to
java version. We are using Java 1.6, hence I switched back to 1.8.x.
Please find the original PDF [flight_receipt.pdf] and corresponding converted
images [1000-test-1.jpg and 1000-test-2.jpg] for your reference.
No, I am not using jbig2 plugin and below is the code snippet.
{color:#FF0000}_PDDocument doc=PDDocument.load(new FileInputStream(source));
List<PDPage> pages=doc.getDocumentCatalog().getAllPages();
Iterator<PDPage> i= pages.iterator();
int count=1;
while(i.hasNext()){
PDPage page=i.next();
BufferedImage bi=page.convertToImage( BufferedImage.TYPE_INT_RGB, 300);
String saveFilePath = filepath1+filePath2;
if (!new File(saveFilePath).exists()) {
new File(saveFilePath).mkdirs();
}
newFile = saveFilePath + arInvoiceEventSourceVO.getSeq()+"-" +"test" +"-"+
count +".jpg" ;
ImageIO.write(bi, "jpg", new File(newFile));_{color}
Thanks,
Avinash
> 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: [email protected]
For additional commands, e-mail: [email protected]