How to Create a Picture Slider or Rollover in an Interactive PDF
Question details
The user wants to build an interactive PDF slideshow featuring left and right navigation arrows to scroll through an image gallery where only five images are visible at a time.

- Product
- Device & OS
- not provided
- Scenario
- Creating an interactive document presentation or portfolio with a built-in, dynamic image gallery on a single page.
- Observed behavior
- The user needs a method to dynamically hide and show specific images within the PDF using interactive elements like buttons and scripts.
Ensure you have a professional PDF editor that supports form fields and document-level JavaScript execution, as basic PDF readers cannot process the scripts required for dynamic sliders.
Create a Picture Slider Using Button Fields and JavaScript
Use interactive button fields to hold images and control their visibility dynamically with custom JavaScript triggered by navigation arrows.
Implementing a dynamic picture slider in a PDF requires using button fields to act as image containers. By leveraging JavaScript, you can control which buttons are visible based on user interaction with navigation arrows.
Note that this method relies on Acrobat JavaScript. The interactive slider may not function correctly in all third-party PDF viewers, mobile browsers, or built-in web PDF readers.
Create a separate button field for each image you want in the slider. Open the properties for each button, set the layout to icon only, and assign the respective image as the button's icon.
Create two additional button fields on the page to serve as the left and right navigation arrows for the user.
Add a document-level JavaScript function that stores the image button references in an array, tracks the current starting index, displays five consecutive buttons, and hides the rest.
Open the properties for the left and right arrow buttons. Go to the Actions tab and add a 'Run a JavaScript' action on the 'Mouse Up' trigger to increment or decrement the index and call your display function.

Edit and Manage Interactive PDFs with WPS Office
WPS Office provides a comprehensive PDF editor that allows you to insert images, manage pages, and handle interactive PDF forms and buttons seamlessly.
- 1. Open your PDF: Launch WPS Office and open your PDF document in the WPS PDF editor.
- 2. Access the Form tools: Navigate to the 'Form' tab to add interactive push buttons to your document layout.
- 3. Insert images: Use the properties menu of the buttons or the 'Edit' tab to insert and arrange your slider images on the page.
- 4. Save and test: Save your interactive PDF document and test the button functionalities to ensure smooth navigation.

Frequently Asked Questions
Why is my interactive PDF slider not working in a web browser?
Most built-in web browser PDF viewers (like Chrome or Edge) do not support the advanced Acrobat JavaScript required for dynamic image sliders. Users must download the file and open it in a dedicated desktop PDF reader for the interactive elements to work.
Can I create a PDF slideshow without using JavaScript?
Without JavaScript, you cannot create a dynamic slider that changes images on a single page. A simpler alternative is to place each slide on a separate page and use basic hyperlink buttons to navigate between the pages.
How do I add an image to a button field in a PDF?
In your PDF editor's form preparation mode, open the button's properties, navigate to the Options tab, set the layout to 'Icon only', and click 'Choose Icon' to upload your image.
Is there a limit to how many images I can add to the interactive slider?
While there is no strict technical limit, embedding too many high-resolution images into button fields will significantly increase the overall PDF file size and may cause performance lagging when the document is loading or scrolling.




