@Test public void test_CMYK_jpeg() throws TaskIOException, IOException { PDImageXObject result = PageImageWriter.toPDXImageObject(customNonPdfInput("image/cmyk.jpg")); assertThat(result.getColorSpace(), is(PDDeviceRGB.INSTANCE)); assertThat(result.getHeight(), is(560)); assertThat(result.getWidth(), is(1400)); assertFalse("Original bytes should not be used; the image should be converted from CMYK to RGB", IOUtils.contentEquals(result.getCOSObject().getFilteredStream(), customNonPdfInput("image/cmyk.jpg").getSource())); }
public static PDImageXObject toPDXImageObject(Source<?> source) throws TaskIOException { try { return createFromSeekableSource(source.getSeekableSource(), source.getName()); } catch (Exception e) { throw new TaskIOException("An error occurred creating PDImageXObject from file source: " + source.getName(), e); } }
PageImageWriter { public static PDImageXObject toPDXImageObject(Source<?> source) throws TaskIOException { try { return createFromSeekableSource(source.getSeekableSource(), source.getName()); } catch (Exception e) { throw new TaskIOException("An error occurred creating PDImageXObject from file source: " + source.getName(), e); } } }
PageImageWriter { public static PDImageXObject toPDXImageObject(Source<?> source) throws TaskIOException { try { return createFromSeekableSource(source.getSeekableSource(), source.getName()); } catch (Exception e) { throw new TaskIOException("An error occurred creating PDImageXObject from file source: " + source.getName(), e); } } PageImageWriter(PDDocument document); }
PageImageWriter { public static PDImageXObject toPDXImageObject(Source<?> source) throws TaskIOException { try { return createFromSeekableSource(source.getSeekableSource(), source.getName()); } catch (Exception e) { throw new TaskIOException("An error occurred creating PDImageXObject from file source: " + source.getName(), e); } } PageImageWriter(PDDocument document); void append(PDPage page, PDImageXObject image, Point2D position, float width, float height,
            PDExtendedGraphicsState gs, int rotation); void append(PDPage page, PDFormXObject image, Point2D position, float width, float height,
            PDExtendedGraphicsState gs, int rotation); void prepend(PDPage page, PDImageXObject image, Point2D position, float width, float height,
            PDExtendedGraphicsState gs, int rotation); void prepend(PDPage page, PDFormXObject image, Point2D position, float width, float height,
            PDExtendedGraphicsState gs, int rotation); static PDImageXObject toPDXImageObject(Source<?> source); static PDImageXObject createFromSeekableSource(SeekableSource original, String name); static SeekableSource convertTiffToJpg(SeekableSource source); static SeekableSource convertTiffToPng(SeekableSource source); static SeekableSource convertImageTo(SeekableSource source, String format); }
PageImageWriter { public static PDImageXObject toPDXImageObject(Source<?> source) throws TaskIOException { try { return createFromSeekableSource(source.getSeekableSource(), source.getName()); } catch (Exception e) { throw new TaskIOException("An error occurred creating PDImageXObject from file source: " + source.getName(), e); } } PageImageWriter(PDDocument document); void append(PDPage page, PDImageXObject image, Point2D position, float width, float height,
            PDExtendedGraphicsState gs, int rotation); void append(PDPage page, PDFormXObject image, Point2D position, float width, float height,
            PDExtendedGraphicsState gs, int rotation); void prepend(PDPage page, PDImageXObject image, Point2D position, float width, float height,
            PDExtendedGraphicsState gs, int rotation); void prepend(PDPage page, PDFormXObject image, Point2D position, float width, float height,
            PDExtendedGraphicsState gs, int rotation); static PDImageXObject toPDXImageObject(Source<?> source); static PDImageXObject createFromSeekableSource(SeekableSource original, String name); static SeekableSource convertTiffToJpg(SeekableSource source); static SeekableSource convertTiffToPng(SeekableSource source); static SeekableSource convertImageTo(SeekableSource source, String format);  }