Create PDF Documents via Python
Native and high performance PDF (Portable Document Format) creation programmatically using Python library.
Generating PDF file dynamically within running application is easy. In order to create PDF documents from scratch without requiring MS Office, we’ll use
API which is a feature-rich, powerful and easy to use conversion API for Python platform. You can download its latest version directly from
How to Create PDF via Python
It is easy for the developers to create, load, modify and convert PDF (Portable Document Format) within running different reporting applications for data processing in just a few lines of code.
- Include the namespace in your class file
- Create Diagram class instance.
- Access the first page of the diagram.
- Add text in the page.
- Use save method to save the diagram as PDF file.
System Requirements
Aspose.Diagram for Python is platform-independent API and can be used on any platform (Windows, Linux and MacOS), just make sure that system have Python 3.6 or higher.
- Install Aspose.Diagram for Python from pypi, use command as:
$ pip install aspose-diagram-python
.
Create Html Python Conversion Source Code
from aspose.diagram import *
// Create Diagram class instance.
diagram = Diagram();
// Access the first page of the diagram.
page = diagram.Pages[0];
// Add Text shape.
shape = page.addText(1, 1, 1, 1, "Test text", "Calibri", "#a5a5a5", 0.25);
// Save the Diagram as .pdf file.
diagram.save("out.pdf",SaveFileFormat.PDF);
PDF What is PDF File Format?
Portable Document Format (PDF) is a type of document created by Adobe back in 1990s. The purpose of this file format was to introduce a standard for representation of documents and other reference material in a format that is independent of application software, hardware as well as Operating System. PDF files can be opened in Adobe Acrobat Reader/Writer as well in most modern browsers like Chrome, Safari, Firefox via extensions/plug-ins. Most of the commercially available software suites also offer conversion of their documents to PDF file format without the requirement of any additional software component. Thus, PDF file format has full capability to contain information like text, images, hyperlinks, form-fields, rich media, digital signatures, attachments, metadata, Geospatial features and 3D objects in it that can become as part of source document.
Read MoreOther Supported Visio Generation
You can also create other Microsoft Visio formats including few listed below.