0

I am currently working with a group on a map viewer using Java Swing, this is the first time we are using Swing for all of us. All maps are single page .pdf files.

I have created a window using JFrame but unable to figure out how to create a box, and have just the pdf page display in that box and make it able to be zoomed in and out as well as dragging the pdf file with in the box after zooming in. Is there a way to achieve this?

I know we are suppose to provide some code, but we don't know how to even start this.

Pengibaby
  • 373
  • 2
  • 11
  • Maybe post some screen captures to demonstrate desired behavior of the GUI. – Abra Oct 28 '19 at 19:32
  • [Java PDF Viewer](https://stackoverflow.com/questions/4437910/java-pdf-viewer) – Abra Oct 28 '19 at 19:34
  • @Abra Thank you for the link! I will read it and try some code out :) – Pengibaby Oct 28 '19 at 19:52
  • Does each PDF have any vector content, or is it just a container for a raster image? You might find it easier to convert each map to an image, so you won’t need to depend on an external library. – VGR Oct 28 '19 at 21:02
  • @VGR Thank you for the suggestion! I converted one of them to an image and added it to JScrollPane using Icon and JLabel. I am still not sure how to achieve the zoom in or out though. – Pengibaby Oct 28 '19 at 21:17
  • See https://stackoverflow.com/questions/9342233/zoom-in-and-out-of-images-in-java. But remember, zooming in may not look as good with a raster (pixel) image as it would with a vector-based image. – VGR Oct 28 '19 at 21:59

0 Answers0