You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "George Sexton (JIRA)" <ji...@apache.org> on 2013/04/10 22:27:17 UTC
[jira] [Commented] (PDFBOX-1562) Thumbnail of PDF is missing image
[ https://issues.apache.org/jira/browse/PDFBOX-1562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13628205#comment-13628205 ]
George Sexton commented on PDFBOX-1562:
---------------------------------------
The code I'm using is:
/**
* Return PDF Metadata and if necessary create a PDF thumbnail.
*
* @param prop
*/
private void getPDFMetaData(Properties prop) {
String pdfFile = getRepositoryFileName();
String outputPrefix = pdfFile.substring( 0, pdfFile.lastIndexOf( '.' ))+"_";
String imageFormat = "jpg";
int startPage = 1;
int endPage = 1;
int resolution=16; // 16 pixels per inch.
PDDocument document = null;
try {
document = PDDocument.load( pdfFile );
if ( document.isEncrypted() ) {
return;
}
//Make the call
PDFImageWriter imageWriter = new PDFImageWriter();
boolean success = imageWriter.writeImage(document,
imageFormat,
"",
startPage, endPage,
outputPrefix,
BufferedImage.TYPE_INT_RGB,
resolution);
if (success) {
prop.setProperty(THUMBNAIL_PROPERTY,Integer.toString(attachment_id)+"_"+startPage+"."+imageFormat);
} else {
WebApp.log("getPDFMetaData() Error writing jpg image.");
}
} catch (Exception e) {
WebApp.log("getPDFMetaData(this.attachment_id="+this.attachment_id+" File Name: "+this.file_name+")",e);
} finally {
if ( document != null ) {
try {
document.close();
} catch (IOException ioeIgnore) {
}
}
}
}
> Thumbnail of PDF is missing image
> ---------------------------------
>
> Key: PDFBOX-1562
> URL: https://issues.apache.org/jira/browse/PDFBOX-1562
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 1.8.0
> Environment: Running Oracle JDK 1.7 U17 on Linux with Fontbox 1.8.0, Jempbox 1.8.0, and PDFBox 1.8.0. The lib directory also contains levigo-jbig2-imageio-1.5.2.jar
> Reporter: George Sexton
> Attachments: Metro Parent May.pdf
>
>
> When rendering a thumbnail of the attached PDF, the image of the boy holding the drumsticks is missing.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira