Skip to content

Commit

Permalink
Better handling of empty images.
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed Dec 11, 2024
1 parent b576864 commit 71c1c48
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/qz/printer/action/PrintRaw.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ private ImageWrapper getHtmlWrapper(String data, JSONObject opt, PrintingUtiliti
return getWrapper(bi, opt, pxlOpts);
}

private ImageWrapper getWrapper(BufferedImage img, JSONObject opt, PrintOptions.Pixel pxlOpts) {
private ImageWrapper getWrapper(BufferedImage img, JSONObject opt, PrintOptions.Pixel pxlOpts) throws IOException {
if(img == null) {
throw new IOException("Image provided is empty or null and cannot be converted.");
}
// Rotate image using orientation or rotation before sending to ImageWrapper
if (pxlOpts.getOrientation() != null && pxlOpts.getOrientation() != PrintOptions.Orientation.PORTRAIT) {
img = PrintImage.rotate(img, pxlOpts.getOrientation().getDegreesRot(), pxlOpts.getDithering(), pxlOpts.getInterpolation());
Expand Down

0 comments on commit 71c1c48

Please sign in to comment.