Work with Images in PDF using Python
Manipulate images in PDF document. Use Aspose.PDF for Python for .NET to modify PDF documents programmatically
Most popular action with Images in Python
Add Image to PDF Document Using Python Library
To add an Image to PDF page, use Aspose.PDF for Python via .NET, a powerful and easy-to-use API. Open PyPI, search for aspose-pdf, and install it. Alternatively, run the command:
Add Image to PDF using Python
You need Aspose.PDF for Python via .NET to try the code in your environment.
- Create a Document object and open the input PDF document.
- Get the page you want to add an image.
- Add the image into the page’s Resources collection.
- Use the GSave operator to save the current graphical state.
- Use ConcatenateMatrix operator to specify where the image is to be placed.
- Use the Do operator to draw the image on the page.
- Use GRestore operator to save the updated graphical state.
- Save the PDF file.