1. Products
  2.   PDF
  3.   Swift
  4.   TPPDF
 
  

Free PDF Creation, Editing & Conversion via Swift Library.

Open Source Swift PDF Generation, Editing & Conversion Library that enables software developers Generate, Read, Manipulate, & Convert PDF Documents Without using Adobe Acrobat in iOS applications.

What is One TPPDF?

In today's digital landscape, PDF documents play a crucial role in business and communication—whether it's for generating invoices, creating reports, or sharing formatted content across platforms. For developers looking to generate PDF documents within iOS or macOS applications, TPPDF stands out as a powerful and reliable Swift PDF library. Designed specifically for Swift, TPPDF simplifies the process of creating professional, print-ready PDFs by providing developers with a high-level API that supports text, images, tables, and more. As an open source PDF library, it empowers developers to customize layouts, apply styling, and manage document structures efficiently while maintaining consistent visual quality.

TPPDF offers a wide range of features to manipulate PDF files programmatically, including support for headers, footers, custom spacing, image compression, metadata management, table formatting, and alignment. Its architecture is flexible and developer-friendly, making it ideal for building dynamic documents on the fly. While its core strength lies in PDF creation, it can also complement tools used to convert PDF files or enhance document interactivity. With an active development community and clean documentation, TPPDF is an indispensable tool for developers aiming to add robust PDF functionality to their Swift-based apps. Whether you're a beginner or an expert, TPPDF helps streamline and elevate your PDF document generation workflow.

Previous Next

Getting Started with TPPDF

The recommend way to install TPPDF is using CocoaPods. Please use the following command for a smooth installation.

Install TPPDF via CocoaPods

$ gem install cocoapods

$ pod install

You can download it directly from GitHub.

Dynamic PDF Documents Creation via Swift API

The open source TPPDF library makes it easy for software developers to create and modify PDF documents inside Swift applications. Moreover, the library makes it easy for software developers to dynamically generate PDFs with content that can change based on user input or data from an API. This is particularly useful for generating personalized documents such as sinvoices, receipts, or certificates. The following example shows how to generate a PDF document using Swift commands.

How to Generate PDF Document using Swift API?

import TPPDF

// Create a new PDF document
let pdf = PDFDocument(format: .a4)

// Add a title to the document
let title = PDFSimpleText(text: "Sample PDF Generated with TPPDF")
pdf.add(text: title)

// Add an image to the document
if let image = UIImage(named: "sampleImage") {
    let pdfImage = PDFImage(image: image)
    pdf.add(image: pdfImage)
}

// Save the PDF document to a file
let pdfURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("sample.pdf")
try? pdf.generatePDF(to: pdfURL)

Customizable Layouts & Multi-language Support

The open source TPPDF library, has provided complete support for handling tasks related to PDF layout management. The library gives users complete control over the layout and styling of your PDF documents. You can customize fonts, colors, margins, headers, footers, and other visual aspects to match your app's design. Moreover, the library supports multi-language content, allowing software developers to create PDFs in different languages and character sets, making it suitable for apps with a global user base.

Rich Text Formatting via Swift API

TPPDF supports rich text formatting, enabling you to apply styles such as bold, italic, and underline to your text content. This is particularly useful when you need to highlight specific information in your PDFs. It is also very easy to seamlessly include images in your PDF documents, whether they are company logos, product images, or user avatars. TPPDF ensures proper scaling and positioning of images. Moreover, creating tabular data is made easy with TPPDF. You can generate tables with customizable column widths, row heights, borders, and cell content alignment.