# PDF Viewer Page Numbers Accessible?

**URL:** <https://forum.inductiveautomation.com/t/pdf-viewer-page-numbers-accessible/18662>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [June 28, 2018, 7:47pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-page-numbers-accessible/18662 "2018-06-28T19:47:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rrowe](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@rrowe](https://forum.inductiveautomation.com/u/rrowe)\
**Post date:** [June 28, 2018, 7:47pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-page-numbers-accessible/18662/1 "2018-06-28T19:47:54Z")

</div>

I need to be able to change the current page number of a PDF in the PDF Viewer component. How can I do this with Ignition or with some Java?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 28, 2018, 8:06pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-page-numbers-accessible/18662/2 "2018-06-28T20:06:26Z")

</div>

To directly go forward a page:

```auto
target = event.source.parent.getComponent('PDF Viewer')
swingController = target.getController()
documentController = swingController.getDocumentViewController()
swingController.goToDeltaPage(documentController.getDocumentView().getNextPageIncrement())

```

To choose a specific page, pass a page index to `swingController.showPage()`. To get the total number of pages, use `swingController.getPageTree().getNumberOfPages()`. Full documentation is available here:  
[http://res.icesoft.org/docs/icepdf/v4\_3\_2/viewer/javadocs/org/icepdf/ri/common/SwingController.html](http://res.icesoft.org/docs/icepdf/v4_3_2/viewer/javadocs/org/icepdf/ri/common/SwingController.html)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 26, 2018, 7:54pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-page-numbers-accessible/18662/4 "2018-07-26T19:54:37Z")

</div>

You should be able to suffix a page argument, like so:  
`http://www.pdf995.com/samples/pdf.pdf#page=5`

---

<div class="post-metadata">

**Author:** ![Inken\_Kestler](https://avatars.discourse-cdn.com/v4/letter/i/bcef8e/32.png) [@Inken\_Kestler](https://forum.inductiveautomation.com/u/Inken_Kestler)\
**Post date:** [June 22, 2022, 2:59pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-page-numbers-accessible/18662/5 "2022-06-22T14:59:44Z")

</div>

Your forum post was very helpful. Additionally I need to implement a button that shows the previous page in the PDF. I suspect that the “getNextPageIncrement()” needs to be replaced. Does anyone know the correct code for the previous page?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 22, 2022, 3:01pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-page-numbers-accessible/18662/6 "2022-06-22T15:01:57Z")

</div>

There’s a corresponding `getPreviousPageIncrement` function.

---

<div class="post-metadata">

**Author:** ![Inken\_Kestler](https://avatars.discourse-cdn.com/v4/letter/i/bcef8e/32.png) [@Inken\_Kestler](https://forum.inductiveautomation.com/u/Inken_Kestler)\
**Post date:** [June 22, 2022, 3:06pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-page-numbers-accessible/18662/7 "2022-06-22T15:06:15Z")

</div>

I suspected that, but it doesn’t work.  
It does the same thing as nextpage

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 22, 2022, 3:09pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-page-numbers-accessible/18662/8 "2022-06-22T15:09:01Z")

</div>

[http://res.icesoft.org/docs/icepdf/v4\_3\_2/viewer/javadocs/org/icepdf/ri/common/SwingController.html#goToDeltaPage(int)](http://res.icesoft.org/docs/icepdf/v4_3_2/viewer/javadocs/org/icepdf/ri/common/SwingController.html#goToDeltaPage(int))

> A positive delta indicates moving to later pages, and a negative delta would move to a previous page

The "increment" functions both return a positive integer value.  
If you want to go backwards, make it a negative number:  
`swingController.goToDeltaPage(-documentController.getDocumentView().getPreviousPageIncrement())`

---

<div class="post-metadata">

**Author:** ![Inken\_Kestler](https://avatars.discourse-cdn.com/v4/letter/i/bcef8e/32.png) [@Inken\_Kestler](https://forum.inductiveautomation.com/u/Inken_Kestler)\
**Post date:** [June 22, 2022, 3:10pm UTC](https://forum.inductiveautomation.com/t/pdf-viewer-page-numbers-accessible/18662/9 "2022-06-22T15:10:36Z")

</div>

thank you very much. This works perfect. Exactly what I needed.
