Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 3.0
-
Fix Version/s: 4.0 - Beta
-
Component/s: None
-
Labels:None
-
Environment:Windows
-
Workaround Description:
Description
I am displaying a PDF document with following code (from the constructor of a class that extends JFrame):
SwingController controller = new SwingController();
controller.setPageViewMode(DocumentViewControllerImpl.ONE_PAGE_VIEW, true);
DocumentViewControllerImpl vc = (DocumentViewControllerImpl) controller.getDocumentViewController();
vc.setDocument(doc);
vc.setCurrentPageIndex(currentPageIndex);
vc.setZoom(0.5F);
JScrollPane scroll = (JScrollPane) vc.getViewContainer();
panel1.add(scroll, BorderLayout.CENTER);
pack();
setLocationRelativeTo(getOwner());
Then, I would like to ViewContainer to show any page I want, by using the following code inside a button listener:
vc.setCurrentPageIndex(currentPageIndex);
Problem: whan I change the page this way, the viewContainer shrinks down to a very tiny area.
Put it in a different way: what is the right way to change the PDF page shown in the ViewContainer?
SwingController controller = new SwingController();
controller.setPageViewMode(DocumentViewControllerImpl.ONE_PAGE_VIEW, true);
DocumentViewControllerImpl vc = (DocumentViewControllerImpl) controller.getDocumentViewController();
vc.setDocument(doc);
vc.setCurrentPageIndex(currentPageIndex);
vc.setZoom(0.5F);
JScrollPane scroll = (JScrollPane) vc.getViewContainer();
panel1.add(scroll, BorderLayout.CENTER);
pack();
setLocationRelativeTo(getOwner());
Then, I would like to ViewContainer to show any page I want, by using the following code inside a button listener:
vc.setCurrentPageIndex(currentPageIndex);
Problem: whan I change the page this way, the viewContainer shrinks down to a very tiny area.
Put it in a different way: what is the right way to change the PDF page shown in the ViewContainer?
Attached a test case while trying to reproduce this issue. Unable to see the behaviour the user described.
Perhaps compared the attached code to your own approach of initializing your UI, as there is a chance you missed an important step or are misusing the viewer component which is causing the area to "shrink".