Skip to content

Commit

Permalink
logging. issue #2433
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed May 6, 2024
1 parent 5e9f359 commit e481953
Showing 1 changed file with 4 additions and 34 deletions.
Expand Up @@ -690,7 +690,7 @@ public class PdfImageScrollingPanel extends javax.swing.JPanel implements Previe

private static final Logger log = Logger.getLogger(PdfImageScrollingPanel.class.getName());
private static final int MAX_RENDER_PAGES = 20;
private Object zoomSemaphore = "";
private transient Object zoomSemaphore = "";

HashMap<Integer, BufferedImage> orgImage = new HashMap<>();

Expand Down Expand Up @@ -993,7 +993,7 @@ private void sliderZoomStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI
i++;
}
} catch (Throwable t) {
log.error(t);
log.error("Error adjust PDF zoom factor in separate thread", t);
}
}).start();

Expand Down Expand Up @@ -1080,7 +1080,7 @@ private void renderContent(byte[] content, int zoomFactor) {

renderedPages = i + 1;
} catch (Throwable t) {
log.error(t);
log.error("Error rendering PDF page " + i, t);
this.sliderZoom.setEnabled(true);
this.cmdFitToScreen.setEnabled(true);
}
Expand All @@ -1091,39 +1091,9 @@ private void renderContent(byte[] content, int zoomFactor) {
lblCurrentPage.setText("1" + "/" + renderedPages);
inputPDF.close();
} catch (Throwable t) {
log.error(t);
log.error("Error rendering PDF in separate thread", t);
}
}).start();

// for (int i = 0; i < Math.min(inputPDF.getNumberOfPages(), MAX_RENDER_PAGES); i++) {
// BufferedImage buffImg = pdfRenderer.renderImageWithDPI(i, 200, ImageType.RGB);
// this.orgImage.put(i, buffImg);
//
// // need to subtract the height of the page navigation buttons, but
// // the panel has not been layed out yet, so there is no height we could query
// int height = Math.max(this.getHeight() - 55, 400);
//
// float scaleFactor = (float) height / (float) this.orgImage.get(i).getHeight();
// int width = (int) ((float) this.orgImage.get(i).getWidth() * scaleFactor);
//
// height = (int) ((float) height * ((float) ((float) zoomFactor / 100f)));
// width = (int) ((float) width * ((float) ((float) zoomFactor / 100f)));
//
// Image bi2 = this.orgImage.get(i).getScaledInstance(width, height, Image.SCALE_SMOOTH);
//
// JLabel lblPage = new JLabel();
// lblPage.setBorder(new EmptyBorder(0, 0, 10, 0));
// lblPage.setHorizontalAlignment(SwingConstants.CENTER);
// this.pnlPages.add(lblPage);
//
// ThreadUtils.updateLabelIcon(lblPage, new ImageIcon(bi2), "");
//
// this.renderedPages = i + 1;
//
// }
// this.lblCurrentPage.setText("1" + "/" + this.renderedPages);
//
// inputPDF.close();
}

} catch (Throwable t) {
Expand Down

0 comments on commit e481953

Please sign in to comment.