[ 
https://issues.apache.org/jira/browse/PDFBOX-1526?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Lehmkühler closed PDFBOX-1526.
--------------------------------------

    
> Problem with multiple images on a page
> --------------------------------------
>
>                 Key: PDFBOX-1526
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1526
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: corny worm
>
> I'm having trouble adding multiple images on a PDPage
> This is the method that adds images:
> [...]
>  private void addImage(PDDocument document, PDPage page, String
> imageName, int x, int y) throws IOException {
>         System.out.println("Image Name: " + imageName);
>         PDXObjectImage image = new PDJpeg(document, new
> FileInputStream(imageName));
>         PDPageContentStream contentStream = new
> PDPageContentStream(document, page, true, false);
>         int oldWidth = 200;
>         int oldHeight = 300;
>         int newWidth = 150;
>         int newHeight = (newWidth * oldHeight) / oldWidth;
>         image.setHeight(newHeight);
>         image.setWidth(newWidth);
>         contentStream.drawImage(image, x, y);
>         contentStream.close();
>     }
> [...]t
> even if the image name changes only the first image is repeatedly drawn on 
> page.
> and If I move the line:
>        PDXObjectImage image = new PDJpeg(document, new
> FileInputStream(imageName));
> after
>        PDPageContentStream contentStream = new
> PDPageContentStream(document, page, true, false);
> the resulting page is blank.

--
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

Reply via email to