[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Kamil (JIRA)

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

Kamil commented on PDFBOX-4176:
---

that would be great! Thanks [~tilman]

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Fix For: 2.0.10, 3.0.0 PDFBox
>
> Attachments: cmyk.jpeg, tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4176:
-

I have to admit that yes, a user would expect that 
{{PDImageXObject.createFromByteArray}} can do all... what we could do is that 
if it is a TIF, then investigate the TIF tags (as done in 
{{CCITTFactory.extractFromTiff}}) to check whether the TIF factory can handle 
it. If not, then handle it like "other".

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Fix For: 2.0.10, 3.0.0 PDFBox
>
> Attachments: cmyk.jpeg, tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4176:
-

ImageIO can't read CMYK jpeg images directly. You can use the twelvemonkeys 
library instead. Or use {{PDImageXObject.createFromByteArray}} which works for 
that case (because PDFBox reads the raster).

https://github.com/haraldk/TwelveMonkeys

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Fix For: 2.0.10, 3.0.0 PDFBox
>
> Attachments: cmyk.jpeg, tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Updated] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Kamil (JIRA)

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

Kamil updated PDFBOX-4176:
--
Attachment: cmyk.jpeg

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Fix For: 2.0.10, 3.0.0 PDFBox
>
> Attachments: cmyk.jpeg, tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Kamil (JIRA)

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

Kamil commented on PDFBOX-4176:
---

Ok, this is even more tricky...
{code:java}
final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
{code}
fails on "tiff.tif", but works on "cmyk.jpeg" (in attachment)
while:
{code}
final PDImageXObject jpeg = LosslessFactory.createFromImage(doc, 
ImageIO.read(new File("cmyk.jpeg")));
{code}
works for "tiff.tif" but fails for "cmyk.jpeg" with:
{code}
javax.imageio.IIOException: Unsupported Image Type
at 
java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1182)
at 
java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1153)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1468)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1315)

{code}
 
If "LosslessFactory.createFromImage" works for "tiff.tif" then maybe there is 
possibility, to make "PDImageXObject.createFromByteArray" work as well?

 

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Fix For: 2.0.10, 3.0.0 PDFBox
>
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Comment Edited] (PDFBOX-4177) PDFBox seems to scale up image while it should not

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr edited comment on PDFBOX-4177 at 4/2/18 7:00 PM:
-

What happens is also a misunderstanding that is difficult to explain. 1 unit is 
1/72 inch. So your image would look good if the PDF would be displayed at 
72dpi, which is what PDFDebugger does but Adobe doesn't (and neither does the 
windows default viewer, but IrfanView does). If you want your image to be small 
at the display resolution of your screen, you'll have to transform the current 
transformation matrix or use the size paramaters before showing your image. See 
the source Code comment in ImageToPDF:
{code:java}
// draw the image at full size at (x=20, y=20)
contents.drawImage(pdImage, 20, 20);

// to draw the image at half size at (x=20, y=20) use
// contents.drawImage(pdImage, 20, 20, pdImage.getWidth() / 2, 
pdImage.getHeight() / 2); 
{code}


was (Author: tilman):
What happens is also a misunderstanding that is difficult to explain. 1 unit is 
1/72 inch. So your image would look good if the PDF would be displayed at 
72dpi, which is what PDFDebugger does but Adobe doesn't (and neither does the 
windows default viewer, but IrfanView does). If you want your image to be small 
at the display resolution of your screen, you'll have to transform the current 
tranaformation matrix before showing your image. See the source Code comment in 
ImageToPDF:
{code:java}
// draw the image at full size at (x=20, y=20)
contents.drawImage(pdImage, 20, 20);

// to draw the image at half size at (x=20, y=20) use
// contents.drawImage(pdImage, 20, 20, pdImage.getWidth() / 2, 
pdImage.getHeight() / 2); 
{code}

> PDFBox seems to scale up image while it should not
> --
>
> Key: PDFBOX-4177
> URL: https://issues.apache.org/jira/browse/PDFBOX-4177
> Project: PDFBox
>  Issue Type: Bug
>Reporter: Kamil
>Priority: Major
> Attachments: comparison-tilman.png, comparison.png, test.jpg, test.pdf
>
>
> I have a test image (in attachment) and the following code:
> {code:java}
>   public static void main(String[] args) {
> final String filename = "test.jpg";
> try (
> final PDDocument doc = new PDDocument();
> final FileInputStream input = new FileInputStream(new File(filename));
> final ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
> final FileOutputStream output = new FileOutputStream("test.pdf")
> ) {
>   final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(input), filename);
>   final PDPage page = new PDPage(new PDRectangle(jpeg.getWidth(), 
> jpeg.getHeight()));
>   doc.addPage(page);
>   try (final PDPageContentStream contents = new PDPageContentStream(doc, 
> page)) {
> contents.drawImage(jpeg, 0, 0);
>   }
>   doc.save(pdfOut);
>   pdfOut.flush();
>   IOUtils.write(pdfOut.toByteArray(), output);
> }catch (Exception e) {
>   e.printStackTrace();
> }
>   }
> {code}
> The image in test.pdf is double sized (and quality is worse) than in original 
> image



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



[jira] [Commented] (PDFBOX-4177) PDFBox seems to scale up image while it should not

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4177:
-

What happens is also a misunderstanding that is difficult to explain. 1 unit is 
1/72 inch. So your image would look good if the PDF would be displayed at 
72dpi, which is what PDFDebugger does but Adobe doesn't (and neither does the 
windows default viewer, but IrfanView does). If you want your image to be small 
at the display resolution of your screen, you'll have to transform the current 
tranaformation matrix before showing your image. See the source Code comment in 
ImageToPDF:
{code:java}
// draw the image at full size at (x=20, y=20)
contents.drawImage(pdImage, 20, 20);

// to draw the image at half size at (x=20, y=20) use
// contents.drawImage(pdImage, 20, 20, pdImage.getWidth() / 2, 
pdImage.getHeight() / 2); 
{code}

> PDFBox seems to scale up image while it should not
> --
>
> Key: PDFBOX-4177
> URL: https://issues.apache.org/jira/browse/PDFBOX-4177
> Project: PDFBox
>  Issue Type: Bug
>Reporter: Kamil
>Priority: Major
> Attachments: comparison-tilman.png, comparison.png, test.jpg, test.pdf
>
>
> I have a test image (in attachment) and the following code:
> {code:java}
>   public static void main(String[] args) {
> final String filename = "test.jpg";
> try (
> final PDDocument doc = new PDDocument();
> final FileInputStream input = new FileInputStream(new File(filename));
> final ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
> final FileOutputStream output = new FileOutputStream("test.pdf")
> ) {
>   final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(input), filename);
>   final PDPage page = new PDPage(new PDRectangle(jpeg.getWidth(), 
> jpeg.getHeight()));
>   doc.addPage(page);
>   try (final PDPageContentStream contents = new PDPageContentStream(doc, 
> page)) {
> contents.drawImage(jpeg, 0, 0);
>   }
>   doc.save(pdfOut);
>   pdfOut.flush();
>   IOUtils.write(pdfOut.toByteArray(), output);
> }catch (Exception e) {
>   e.printStackTrace();
> }
>   }
> {code}
> The image in test.pdf is double sized (and quality is worse) than in original 
> image



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



[jira] [Closed] (PDFBOX-4178) Rendering PDFs for OCR with Tesseract uses different DPI than claimed

2018-04-02 Thread Ewan Mellor (JIRA)

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

Ewan Mellor closed PDFBOX-4178.
---
Resolution: Invalid

This was supposed to be reported against Tika. Ignore this ticket.  Apologies.

 

> Rendering PDFs for OCR with Tesseract uses different DPI than claimed
> -
>
> Key: PDFBOX-4178
> URL: https://issues.apache.org/jira/browse/PDFBOX-4178
> Project: PDFBox
>  Issue Type: Bug
>  Components: Parsing
>Affects Versions: 2.0.9
>Reporter: Ewan Mellor
>Priority: Major
>
> Tika has two properties in `PDFParser.properties` that control what happens 
> in AbstractPDF2XHTML when a PDF is rendered before being passed to Tesseract 
> for OCR.  These are `ocrDPI` (default 300) and `ocrImageScale` (default 2.0).
> `ocrDPI` is passed to `ImageIOUtil.writeImage`, which uses it as the metadata 
> in the image (i.e. it doesn't control scaling at all, it's just an advertised 
> metadata field).
> `ocrImageScale` is passed to PDFBox's `PDFRenderer.renderImage`, which uses 
> it to specify the scale for rendering.  This value is such that 1.0 == 72dpi, 
> and therefore Tika's default is to request 144dpi for rendering.
> This means that Tika is asking PDFBox to render at 144dpi, and then 
> advertising 300dpi in the image metadata.  This makes no sense to me, and is 
> surely going to confuse Tesseract.
> Instead of doing this, we should remove `ocrImageScale`, and use the same DPI 
> value for rendering as we advertise in the image metadata.
> We should keep the existing default DPI value, since Tesseract is trained at 
> 300dpi by default, so this will mean that all stages between PDFRenderer and 
> Tesseract are defaulting to 300dpi.
> This change will have the side-effect that the temporary images between the 
> PDF rendering and Tesseract will be 4x larger (144dpi to 300dpi).  This will 
> have a memory and temporary disk space impact, but I think that it's still 
> best to have the whole pipeline using 300dpi.  People who have memory 
> constraints will need to reduce ocrDPI and make the corresponding changes on 
> the Tesseract side.
>  



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



[jira] [Created] (PDFBOX-4178) Rendering PDFs for OCR with Tesseract uses different DPI than claimed

2018-04-02 Thread Ewan Mellor (JIRA)
Ewan Mellor created PDFBOX-4178:
---

 Summary: Rendering PDFs for OCR with Tesseract uses different DPI 
than claimed
 Key: PDFBOX-4178
 URL: https://issues.apache.org/jira/browse/PDFBOX-4178
 Project: PDFBox
  Issue Type: Bug
  Components: Parsing
Affects Versions: 2.0.9
Reporter: Ewan Mellor


Tika has two properties in `PDFParser.properties` that control what happens in 
AbstractPDF2XHTML when a PDF is rendered before being passed to Tesseract for 
OCR.  These are `ocrDPI` (default 300) and `ocrImageScale` (default 2.0).

`ocrDPI` is passed to `ImageIOUtil.writeImage`, which uses it as the metadata 
in the image (i.e. it doesn't control scaling at all, it's just an advertised 
metadata field).

`ocrImageScale` is passed to PDFBox's `PDFRenderer.renderImage`, which uses it 
to specify the scale for rendering.  This value is such that 1.0 == 72dpi, and 
therefore Tika's default is to request 144dpi for rendering.

This means that Tika is asking PDFBox to render at 144dpi, and then advertising 
300dpi in the image metadata.  This makes no sense to me, and is surely going 
to confuse Tesseract.

Instead of doing this, we should remove `ocrImageScale`, and use the same DPI 
value for rendering as we advertise in the image metadata.

We should keep the existing default DPI value, since Tesseract is trained at 
300dpi by default, so this will mean that all stages between PDFRenderer and 
Tesseract are defaulting to 300dpi.

This change will have the side-effect that the temporary images between the PDF 
rendering and Tesseract will be 4x larger (144dpi to 300dpi).  This will have a 
memory and temporary disk space impact, but I think that it's still best to 
have the whole pipeline using 300dpi.  People who have memory constraints will 
need to reduce ocrDPI and make the corresponding changes on the Tesseract side.

 



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



[jira] [Commented] (PDFBOX-4177) PDFBox seems to scale up image while it should not

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4177:
-

It's like I wrote, Adobe claims 100% but it isn't. Even my 100% are not the 
same as your 100%. Try displaying the file with PDFDebugger.

> PDFBox seems to scale up image while it should not
> --
>
> Key: PDFBOX-4177
> URL: https://issues.apache.org/jira/browse/PDFBOX-4177
> Project: PDFBox
>  Issue Type: Bug
>Reporter: Kamil
>Priority: Major
> Attachments: comparison-tilman.png, comparison.png, test.jpg, test.pdf
>
>
> I have a test image (in attachment) and the following code:
> {code:java}
>   public static void main(String[] args) {
> final String filename = "test.jpg";
> try (
> final PDDocument doc = new PDDocument();
> final FileInputStream input = new FileInputStream(new File(filename));
> final ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
> final FileOutputStream output = new FileOutputStream("test.pdf")
> ) {
>   final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(input), filename);
>   final PDPage page = new PDPage(new PDRectangle(jpeg.getWidth(), 
> jpeg.getHeight()));
>   doc.addPage(page);
>   try (final PDPageContentStream contents = new PDPageContentStream(doc, 
> page)) {
> contents.drawImage(jpeg, 0, 0);
>   }
>   doc.save(pdfOut);
>   pdfOut.flush();
>   IOUtils.write(pdfOut.toByteArray(), output);
> }catch (Exception e) {
>   e.printStackTrace();
> }
>   }
> {code}
> The image in test.pdf is double sized (and quality is worse) than in original 
> image



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



[jira] [Updated] (PDFBOX-4177) PDFBox seems to scale up image while it should not

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr updated PDFBOX-4177:

Attachment: test.pdf

> PDFBox seems to scale up image while it should not
> --
>
> Key: PDFBOX-4177
> URL: https://issues.apache.org/jira/browse/PDFBOX-4177
> Project: PDFBox
>  Issue Type: Bug
>Reporter: Kamil
>Priority: Major
> Attachments: comparison-tilman.png, comparison.png, test.jpg, test.pdf
>
>
> I have a test image (in attachment) and the following code:
> {code:java}
>   public static void main(String[] args) {
> final String filename = "test.jpg";
> try (
> final PDDocument doc = new PDDocument();
> final FileInputStream input = new FileInputStream(new File(filename));
> final ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
> final FileOutputStream output = new FileOutputStream("test.pdf")
> ) {
>   final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(input), filename);
>   final PDPage page = new PDPage(new PDRectangle(jpeg.getWidth(), 
> jpeg.getHeight()));
>   doc.addPage(page);
>   try (final PDPageContentStream contents = new PDPageContentStream(doc, 
> page)) {
> contents.drawImage(jpeg, 0, 0);
>   }
>   doc.save(pdfOut);
>   pdfOut.flush();
>   IOUtils.write(pdfOut.toByteArray(), output);
> }catch (Exception e) {
>   e.printStackTrace();
> }
>   }
> {code}
> The image in test.pdf is double sized (and quality is worse) than in original 
> image



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



[jira] [Updated] (PDFBOX-4177) PDFBox seems to scale up image while it should not

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr updated PDFBOX-4177:

Attachment: comparison-tilman.png

> PDFBox seems to scale up image while it should not
> --
>
> Key: PDFBOX-4177
> URL: https://issues.apache.org/jira/browse/PDFBOX-4177
> Project: PDFBox
>  Issue Type: Bug
>Reporter: Kamil
>Priority: Major
> Attachments: comparison-tilman.png, comparison.png, test.jpg, test.pdf
>
>
> I have a test image (in attachment) and the following code:
> {code:java}
>   public static void main(String[] args) {
> final String filename = "test.jpg";
> try (
> final PDDocument doc = new PDDocument();
> final FileInputStream input = new FileInputStream(new File(filename));
> final ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
> final FileOutputStream output = new FileOutputStream("test.pdf")
> ) {
>   final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(input), filename);
>   final PDPage page = new PDPage(new PDRectangle(jpeg.getWidth(), 
> jpeg.getHeight()));
>   doc.addPage(page);
>   try (final PDPageContentStream contents = new PDPageContentStream(doc, 
> page)) {
> contents.drawImage(jpeg, 0, 0);
>   }
>   doc.save(pdfOut);
>   pdfOut.flush();
>   IOUtils.write(pdfOut.toByteArray(), output);
> }catch (Exception e) {
>   e.printStackTrace();
> }
>   }
> {code}
> The image in test.pdf is double sized (and quality is worse) than in original 
> image



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



[jira] [Commented] (PDFBOX-4177) PDFBox seems to scale up image while it should not

2018-04-02 Thread Kamil (JIRA)

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

Kamil commented on PDFBOX-4177:
---

I uploaded a screenshot showing how it looks on my machine.

I think, that both should be equal...

> PDFBox seems to scale up image while it should not
> --
>
> Key: PDFBOX-4177
> URL: https://issues.apache.org/jira/browse/PDFBOX-4177
> Project: PDFBox
>  Issue Type: Bug
>Reporter: Kamil
>Priority: Major
> Attachments: comparison.png, test.jpg
>
>
> I have a test image (in attachment) and the following code:
> {code:java}
>   public static void main(String[] args) {
> final String filename = "test.jpg";
> try (
> final PDDocument doc = new PDDocument();
> final FileInputStream input = new FileInputStream(new File(filename));
> final ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
> final FileOutputStream output = new FileOutputStream("test.pdf")
> ) {
>   final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(input), filename);
>   final PDPage page = new PDPage(new PDRectangle(jpeg.getWidth(), 
> jpeg.getHeight()));
>   doc.addPage(page);
>   try (final PDPageContentStream contents = new PDPageContentStream(doc, 
> page)) {
> contents.drawImage(jpeg, 0, 0);
>   }
>   doc.save(pdfOut);
>   pdfOut.flush();
>   IOUtils.write(pdfOut.toByteArray(), output);
> }catch (Exception e) {
>   e.printStackTrace();
> }
>   }
> {code}
> The image in test.pdf is double sized (and quality is worse) than in original 
> image



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



[jira] [Updated] (PDFBOX-4177) PDFBox seems to scale up image while it should not

2018-04-02 Thread Kamil (JIRA)

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

Kamil updated PDFBOX-4177:
--
Attachment: comparison.png

> PDFBox seems to scale up image while it should not
> --
>
> Key: PDFBOX-4177
> URL: https://issues.apache.org/jira/browse/PDFBOX-4177
> Project: PDFBox
>  Issue Type: Bug
>Reporter: Kamil
>Priority: Major
> Attachments: comparison.png, test.jpg
>
>
> I have a test image (in attachment) and the following code:
> {code:java}
>   public static void main(String[] args) {
> final String filename = "test.jpg";
> try (
> final PDDocument doc = new PDDocument();
> final FileInputStream input = new FileInputStream(new File(filename));
> final ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
> final FileOutputStream output = new FileOutputStream("test.pdf")
> ) {
>   final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(input), filename);
>   final PDPage page = new PDPage(new PDRectangle(jpeg.getWidth(), 
> jpeg.getHeight()));
>   doc.addPage(page);
>   try (final PDPageContentStream contents = new PDPageContentStream(doc, 
> page)) {
> contents.drawImage(jpeg, 0, 0);
>   }
>   doc.save(pdfOut);
>   pdfOut.flush();
>   IOUtils.write(pdfOut.toByteArray(), output);
> }catch (Exception e) {
>   e.printStackTrace();
> }
>   }
> {code}
> The image in test.pdf is double sized (and quality is worse) than in original 
> image



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4176:
-

The part that it is recognized as ARW can be fixed either by the person who 
wrote that part, or by me (by removing the ARW file type from the list). The 
part "First image in tiff is not CCITT T4 or T6 compressed" cannot because PDF 
doesn't support color in the CCITT filter. What it means is that even if I fix 
the part that it isn't detected as a TIF, you still can't use the method 
(unless your production images are G3 or G4 compressed b/w images.

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Fix For: 2.0.10, 3.0.0 PDFBox
>
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Kamil (JIRA)

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

Kamil commented on PDFBOX-4176:
---

{quote}Because there's a bug in the file type detector.
{quote}
Can bug in file type detector be fixed?
{quote}There's an issue on github... if it hasn't been fixed by 2.0.10 release 
time, then I'll just remove a few file types from our code copy.
{quote}
I didn't understand that. Does it mean that there is possibility to fix my 
issue?

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Fix For: 2.0.10, 3.0.0 PDFBox
>
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-3809) PDAcroForm.flatten(PDField list, refreshAppearances boolean) flattens all form fields instead of specified ones.

2018-04-02 Thread Ricky Baker (JIRA)

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

Ricky Baker commented on PDFBOX-3809:
-

@[~msahyoun]

i attached the pdf (this is a pdf from 
[https://www.gsa.gov/forms-library/request-advance-or-reimbursement)] 
accessible by anyone. The other attachment a screen shot of some of the fields 
we are trying to automate. The yellow highlighted are to be entered and the 
green highlight is calculated from those values.

 

Ricky

> PDAcroForm.flatten(PDField list, refreshAppearances boolean) flattens all 
> form fields instead of specified ones.
> 
>
> Key: PDFBOX-3809
> URL: https://issues.apache.org/jira/browse/PDFBOX-3809
> Project: PDFBox
>  Issue Type: Improvement
>  Components: AcroForm
>Affects Versions: 2.0.5, 2.0.6, 2.0.7
>Reporter: Cristin Donaher
>Priority: Minor
> Attachments: Example of fields that need to enter and the calculated 
> field from those values.docx, sf270.pdf
>
>
> Thanks for the excellent PDF library.   For my use case I need to flatten a 
> subset of the AcroForm fields.  I was attempting to use the 
> PDAcroForm.flatten call, passing in my field list.  However, after the method 
> is called, all the fields are gone.  
> The method itself appears to remove all PDFAnnotationWidgets from each page 
> and at the end clears the acroform's field set.
> Is the javadoc description (This will flatten the specified form fields.) 
> just misleading?   Could a flatten call for a subset of fields be added?
> Thanks



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



[jira] [Updated] (PDFBOX-3809) PDAcroForm.flatten(PDField list, refreshAppearances boolean) flattens all form fields instead of specified ones.

2018-04-02 Thread Ricky Baker (JIRA)

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

Ricky Baker updated PDFBOX-3809:

Attachment: Example of fields that need to enter and the calculated field 
from those values.docx

> PDAcroForm.flatten(PDField list, refreshAppearances boolean) flattens all 
> form fields instead of specified ones.
> 
>
> Key: PDFBOX-3809
> URL: https://issues.apache.org/jira/browse/PDFBOX-3809
> Project: PDFBox
>  Issue Type: Improvement
>  Components: AcroForm
>Affects Versions: 2.0.5, 2.0.6, 2.0.7
>Reporter: Cristin Donaher
>Priority: Minor
> Attachments: Example of fields that need to enter and the calculated 
> field from those values.docx, sf270.pdf
>
>
> Thanks for the excellent PDF library.   For my use case I need to flatten a 
> subset of the AcroForm fields.  I was attempting to use the 
> PDAcroForm.flatten call, passing in my field list.  However, after the method 
> is called, all the fields are gone.  
> The method itself appears to remove all PDFAnnotationWidgets from each page 
> and at the end clears the acroform's field set.
> Is the javadoc description (This will flatten the specified form fields.) 
> just misleading?   Could a flatten call for a subset of fields be added?
> Thanks



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



[jira] [Updated] (PDFBOX-3809) PDAcroForm.flatten(PDField list, refreshAppearances boolean) flattens all form fields instead of specified ones.

2018-04-02 Thread Ricky Baker (JIRA)

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

Ricky Baker updated PDFBOX-3809:

Attachment: sf270.pdf

> PDAcroForm.flatten(PDField list, refreshAppearances boolean) flattens all 
> form fields instead of specified ones.
> 
>
> Key: PDFBOX-3809
> URL: https://issues.apache.org/jira/browse/PDFBOX-3809
> Project: PDFBox
>  Issue Type: Improvement
>  Components: AcroForm
>Affects Versions: 2.0.5, 2.0.6, 2.0.7
>Reporter: Cristin Donaher
>Priority: Minor
> Attachments: Example of fields that need to enter and the calculated 
> field from those values.docx, sf270.pdf
>
>
> Thanks for the excellent PDF library.   For my use case I need to flatten a 
> subset of the AcroForm fields.  I was attempting to use the 
> PDAcroForm.flatten call, passing in my field list.  However, after the method 
> is called, all the fields are gone.  
> The method itself appears to remove all PDFAnnotationWidgets from each page 
> and at the end clears the acroform's field set.
> Is the javadoc description (This will flatten the specified form fields.) 
> just misleading?   Could a flatten call for a subset of fields be added?
> Thanks



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



[jira] [Closed] (PDFBOX-4174) Reopen - java.io.IOException: Missing root object specification in trailer

2018-04-02 Thread Aleksandr Vasilenko (JIRA)

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

Aleksandr Vasilenko closed PDFBOX-4174.
---
Resolution: Not A Bug

> Reopen - java.io.IOException: Missing root object specification in trailer
> --
>
> Key: PDFBOX-4174
> URL: https://issues.apache.org/jira/browse/PDFBOX-4174
> Project: PDFBox
>  Issue Type: Bug
>  Components: Parsing
>Affects Versions: 2.0.6
>Reporter: Aleksandr Vasilenko
>Assignee: Andreas Lehmkühler
>Priority: Major
>  Labels: regression
> Attachments: 069020.pdf
>
>
> We recently started getting this error in some of our production error logs. 
> We are using PDFBOX 2.0.6 and are getting the same error after passing in the 
> attached PDF into our application/
>  
> {code}
> java.io.IOException: Missing root object specification in trailer.
> 16:28:17,502 ERROR [OOS_ImageManagerImpl] (http-localhost/127.0.0.1:8080-1) 
> [ERROR] Unable to convert PDF document to image. : java.io.IOException: 
> Missing root object specification in trailer. at 
> org.apache.pdfbox.pdfparser.COSParser.parseTrailerValuesDynamically(COSParser.java:2169)
>  [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdfparser.PDFParser.initialParse(PDFParser.java:222) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:271) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1197) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1174) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1155) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1138) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> com.vsp.oos.common.impl.ImageManagerImpl.validateAndConvertPDFToImage(ImageManagerImpl.java:630)
>  [oos-common-3.54.0-SNAPSHOT.jar:]
> {code}
> A snipet of our code
> {code:java}
> private byte[] validateAndConvertPDFToImage(byte[] imageArray) {
> PDDocument pdfDocument = null;
> try {
> // Error happens here
> pdfDocument = PDDocument.load(imageArray);
> PDFRenderer pdfRenderer = new PDFRenderer(pdfDocument);
> // ..
>} catch() { ...  }
> }
> {code}



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



[jira] [Commented] (PDFBOX-4174) Reopen - java.io.IOException: Missing root object specification in trailer

2018-04-02 Thread Aleksandr Vasilenko (JIRA)

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

Aleksandr Vasilenko commented on PDFBOX-4174:
-

[~tilman]
Actually this is not an issue, it was something on our side. Despite what what 
exception log is saying we were apparently still using pdfbox 2.0.5. Sorry to 
use up your time. I will close this issue.

> Reopen - java.io.IOException: Missing root object specification in trailer
> --
>
> Key: PDFBOX-4174
> URL: https://issues.apache.org/jira/browse/PDFBOX-4174
> Project: PDFBox
>  Issue Type: Bug
>  Components: Parsing
>Affects Versions: 2.0.6
>Reporter: Aleksandr Vasilenko
>Assignee: Andreas Lehmkühler
>Priority: Major
>  Labels: regression
> Attachments: 069020.pdf
>
>
> We recently started getting this error in some of our production error logs. 
> We are using PDFBOX 2.0.6 and are getting the same error after passing in the 
> attached PDF into our application/
>  
> {code}
> java.io.IOException: Missing root object specification in trailer.
> 16:28:17,502 ERROR [OOS_ImageManagerImpl] (http-localhost/127.0.0.1:8080-1) 
> [ERROR] Unable to convert PDF document to image. : java.io.IOException: 
> Missing root object specification in trailer. at 
> org.apache.pdfbox.pdfparser.COSParser.parseTrailerValuesDynamically(COSParser.java:2169)
>  [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdfparser.PDFParser.initialParse(PDFParser.java:222) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:271) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1197) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1174) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1155) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1138) 
> [pdfbox-2.0.6.jar:2.0.6] at 
> com.vsp.oos.common.impl.ImageManagerImpl.validateAndConvertPDFToImage(ImageManagerImpl.java:630)
>  [oos-common-3.54.0-SNAPSHOT.jar:]
> {code}
> A snipet of our code
> {code:java}
> private byte[] validateAndConvertPDFToImage(byte[] imageArray) {
> PDDocument pdfDocument = null;
> try {
> // Error happens here
> pdfDocument = PDDocument.load(imageArray);
> PDFRenderer pdfRenderer = new PDFRenderer(pdfDocument);
> // ..
>} catch() { ...  }
> }
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4176:
-

There's an issue on github... if it hasn't been fixed by 2.0.10 release time, 
then I'll just remove a few file types from our code copy.

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Fix For: 2.0.10, 3.0.0 PDFBox
>
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Updated] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr updated PDFBOX-4176:

Fix Version/s: 3.0.0 PDFBox
   2.0.10

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Fix For: 2.0.10, 3.0.0 PDFBox
>
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4177) PDFBox seems to scale up image while it should not

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4177:
-

I tried it and the image looks the same if it is displayed at the same size as 
the original. I think that Adobe Reader is misleading, when it claims "100%" on 
an enlarged image.

> PDFBox seems to scale up image while it should not
> --
>
> Key: PDFBOX-4177
> URL: https://issues.apache.org/jira/browse/PDFBOX-4177
> Project: PDFBox
>  Issue Type: Bug
>Reporter: Kamil
>Priority: Major
> Attachments: test.jpg
>
>
> I have a test image (in attachment) and the following code:
> {code:java}
>   public static void main(String[] args) {
> final String filename = "test.jpg";
> try (
> final PDDocument doc = new PDDocument();
> final FileInputStream input = new FileInputStream(new File(filename));
> final ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
> final FileOutputStream output = new FileOutputStream("test.pdf")
> ) {
>   final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(input), filename);
>   final PDPage page = new PDPage(new PDRectangle(jpeg.getWidth(), 
> jpeg.getHeight()));
>   doc.addPage(page);
>   try (final PDPageContentStream contents = new PDPageContentStream(doc, 
> page)) {
> contents.drawImage(jpeg, 0, 0);
>   }
>   doc.save(pdfOut);
>   pdfOut.flush();
>   IOUtils.write(pdfOut.toByteArray(), output);
> }catch (Exception e) {
>   e.printStackTrace();
> }
>   }
> {code}
> The image in test.pdf is double sized (and quality is worse) than in original 
> image



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4176:
-

("CCITT T4 or T6" is the same as "G3 or G4 compression", just in case it is 
getting confusing)

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Comment Edited] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr edited comment on PDFBOX-4176 at 4/2/18 10:46 AM:
--

Because there's a bug in the file type detector. The easiest way for you would 
either be to use {{PDImageXObject createFromFile()}} or to use 
{{LosslessFactory.createFromImage(ImageIO.read(file))}}. You'll have to use one 
of these anyway if your production TIFF files are not G3 or G4 encoded.


was (Author: tilman):
Because there's a bug in the file type detector. The easiest way for you would 
either be to use {{PDImageXObject createFromFile()}} or to use 
{{LosslessFactory.createFromImage(ImageIO.read(file))}}. You'll have to use one 
of These anyway if your production TIFF files are not G3 or G4 encoded.

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4176:
-

Ooops, I think you're asking about "First image in tiff is not CCITT T4 or T6 
compressed". That is because PDFBox can use the existing compression for TIFF 
files with these compressions, i.e. doesn't have to decompress first.

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4176:
-

Because there's a bug in the file type detector. The easiest way for you would 
either be to use {{PDImageXObject createFromFile()}} or to use 
{{LosslessFactory.createFromImage(ImageIO.read(file))}}. You'll have to use one 
of These anyway if your production TIFF files are not G3 or G4 encoded.

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Kamil (JIRA)

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

Kamil commented on PDFBOX-4176:
---

So how
ImageIO.read(file)
can read it correctly?

 

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Comment Edited] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Kamil (JIRA)

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

Kamil edited comment on PDFBOX-4176 at 4/2/18 10:30 AM:


So how
{code}
ImageIO.read(file)
{code}
can read it correctly?


was (Author: eximius):
So how
ImageIO.read(file)
can read it correctly?

 

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4176:
-

The file is misidentified as ARW. Even if this bug would be fixed, it would 
still fail, because it is a color image 
 {code}
Exception in thread "main" java.io.IOException: First image in tiff is not 
CCITT T4 or T6 compressed
at 
org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory.extractFromTiff(CCITTFactory.java:433)
at 
org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory.createFromRandomAccessImpl(CCITTFactory.java:214)
at 
org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory.createFromByteArray(CCITTFactory.java:132)
at 
org.apache.pdfbox.pdmodel.graphics.image.CCITTFactory.createFromByteArray(CCITTFactory.java:109)
at 
org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:319)
 {code}


> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Comment Edited] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Kamil (JIRA)

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

Kamil edited comment on PDFBOX-4176 at 4/2/18 10:08 AM:


To check it, you can use the code from this issue:

https://issues.apache.org/jira/browse/PDFBOX-4177 

and file from the attachment


was (Author: eximius):
To check it, you can use the code from this issue: 
https://issues.apache.org/jira/browse/PDFBOX-4176

and file from the attachment

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Kamil (JIRA)

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

Kamil commented on PDFBOX-4176:
---

By the way - if I use this workaround, it works fine:

{code}
private BufferedImage workaround(final File file) throws IOException {
BufferedImage imgIn = ImageIO.read(file);
if(imgIn.getType() != BufferedImage.TYPE_INT_RGB){
final BufferedImage newImage = new BufferedImage(imgIn.getWidth(), 
imgIn.getHeight(), BufferedImage.TYPE_INT_RGB);
newImage.createGraphics().drawImage(imgIn, 0, 0, Color.WHITE, null);
imgIn = newImage;
}
return imgIn;
  }
{code}

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Updated] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Kamil (JIRA)

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

Kamil updated PDFBOX-4176:
--
Attachment: tiff.tif

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Kamil (JIRA)

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

Kamil commented on PDFBOX-4176:
---

To check it, you can use the code from this issue: 
https://issues.apache.org/jira/browse/PDFBOX-4176

and file from the attachment

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
> Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Created] (PDFBOX-4177) PDFBox seems to scale up image while it should not

2018-04-02 Thread Kamil (JIRA)
Kamil created PDFBOX-4177:
-

 Summary: PDFBox seems to scale up image while it should not
 Key: PDFBOX-4177
 URL: https://issues.apache.org/jira/browse/PDFBOX-4177
 Project: PDFBox
  Issue Type: Bug
Reporter: Kamil
 Attachments: test.jpg

I have a test image (in attachment) and the following code:
{code:java}
  public static void main(String[] args) {
final String filename = "test.jpg";
try (
final PDDocument doc = new PDDocument();
final FileInputStream input = new FileInputStream(new File(filename));
final ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
final FileOutputStream output = new FileOutputStream("test.pdf")
) {
  final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
IOUtils.toByteArray(input), filename);

  final PDPage page = new PDPage(new PDRectangle(jpeg.getWidth(), 
jpeg.getHeight()));
  doc.addPage(page);
  try (final PDPageContentStream contents = new PDPageContentStream(doc, 
page)) {
contents.drawImage(jpeg, 0, 0);
  }
  doc.save(pdfOut);
  pdfOut.flush();
  IOUtils.write(pdfOut.toByteArray(), output);
}catch (Exception e) {
  e.printStackTrace();
}
  }
{code}
The image in test.pdf is double sized (and quality is worse) than in original 
image



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4176:
-

Alternatively, use {{PDImageXObject.createFromFileByExtension()}} and see what 
happens.

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Maruan Sahyoun (JIRA)

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

Maruan Sahyoun commented on PDFBOX-4176:


Could you test with {{PDImageXObject.createFromFileByContent}}. 

The message is generated because the content of the {{byte[]}} is not detected 
to be a TIFF image by the {{FileTypeDetector}}.  Are you sure that you are 
passing a TIFF image?

If that doesn't help please attach the TIFF in question.

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Commented] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4176:
-

Could you please attach the file? The exception message only tells the name, 
and not the file type that is detected by content. Alternatively, call 
{{FileTypeDetector.detectFileType(byteArray)}} and tell the result.

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -
>
> Key: PDFBOX-4176
> URL: https://issues.apache.org/jira/browse/PDFBOX-4176
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.9
>Reporter: Kamil
>Priority: Major
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
> at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



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



[jira] [Created] (PDFBOX-4176) PDImageXObject doesn't support TIFF although JavaDoc says it does

2018-04-02 Thread Kamil (JIRA)
Kamil created PDFBOX-4176:
-

 Summary: PDImageXObject doesn't support TIFF although JavaDoc says 
it does
 Key: PDFBOX-4176
 URL: https://issues.apache.org/jira/browse/PDFBOX-4176
 Project: PDFBox
  Issue Type: Bug
Affects Versions: 2.0.9
Reporter: Kamil


This code:

{code}
final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
{code}

throws:
{code}
java.lang.IllegalArgumentException: Image type not supported: tiff.tif
at 
org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)

{code}



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



[jira] [Resolved] (PDFBOX-4157) Flatten ne positonne pas bien le 1er champs si Image avant

2018-04-02 Thread Maruan Sahyoun (JIRA)

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

Maruan Sahyoun resolved PDFBOX-4157.

Resolution: Fixed

resolved per reporters feedback

> Flatten ne positonne pas bien le 1er champs si Image avant
> --
>
> Key: PDFBOX-4157
> URL: https://issues.apache.org/jira/browse/PDFBOX-4157
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.8
>Reporter: Chdeul
>Assignee: Maruan Sahyoun
>Priority: Minor
>  Labels: flatten
> Fix For: 2.0.10, 3.0.0 PDFBox
>
> Attachments: MyTest.java, flatten.pdf, pom.xml, sample.pdf
>
>
> Sur formulaire, avec une image et plusieurs champs textes, la méthode flatten 
> ne positionne pas bien le 1er champs de texte, car need translation est faux, 
>  parce que la méthode RevolveNeedsTranslation    trouve un Xobject, mais qui 
> est une Image, et pas un Xform.
> Il faut donc modifier cette méthode pour prendre en compte aussi le cas des 
> images
>  



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



[jira] [Commented] (PDFBOX-4157) Flatten ne positonne pas bien le 1er champs si Image avant

2018-04-02 Thread Chdeul (JIRA)

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

Chdeul commented on PDFBOX-4157:


I have test the trunk version : it's *Ok* on my little test.

Thank for your quick resolution. 

> Flatten ne positonne pas bien le 1er champs si Image avant
> --
>
> Key: PDFBOX-4157
> URL: https://issues.apache.org/jira/browse/PDFBOX-4157
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.8
>Reporter: Chdeul
>Assignee: Maruan Sahyoun
>Priority: Minor
>  Labels: flatten
> Fix For: 2.0.10, 3.0.0 PDFBox
>
> Attachments: MyTest.java, flatten.pdf, pom.xml, sample.pdf
>
>
> Sur formulaire, avec une image et plusieurs champs textes, la méthode flatten 
> ne positionne pas bien le 1er champs de texte, car need translation est faux, 
>  parce que la méthode RevolveNeedsTranslation    trouve un Xobject, mais qui 
> est une Image, et pas un Xform.
> Il faut donc modifier cette méthode pour prendre en compte aussi le cas des 
> images
>  



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