This topic describes how to change PDF settings to open in Adobe using Python. It shares information to set the development environment for the application, a list of programming steps, and a sample code showing how to change PDF viewing preferences using Python. You will learn settings various properties to set different UI elements while opening the PDF file in Adobe.
Steps to Change PDF Opening Settings using Python
- Establish the environment to use Aspose.PDF for Python via .NET to change viewing preferences
- Load the source PDF file whose opening settings are to be changed
- Use the properties in the Document class to change the default opening settings
- Save the output PDF file after changing how PDF opens in Adobe
The above steps summarize how to change default for opening PDF files using Python. First, load the source PDF file into the Document object and set the properties related to PDF opening settings. Save the resultant PDF file with custom opening settings on the disk or to a stream according to the requirements.
Code to Change Settings to Open PDF in Adobe using Python
This code sample demonstrates how to change settings for opening PDF using Python. There are a few boolean flags that you may set to true or false, such as opening the PDF in the center, displaying the document name in the title, hiding the menubar, and hiding the toolbar to list a few. You may use enumerators to set other properties, such as Direction enumerator for setting the direction of pages when opened in parallel, PageMode for setting mode when exiting from the full-screen mode, and PageLayout for respective settings.
This article has taught us how to set the viewing preferences of the PDF file when you open it. If you want to flatten a PDF file, refer to the article on how to flatten PDF in Python.