Skip to content

ComPDFKit/compdfkit-pdf-sdk-apple-package

Repository files navigation

ComPDF SDK for Apple (Swift Package Manager)

As part of the KDAN ecosystem, ComPDF SDK for Apple helps you integrate the Swift-based ComPDF PDF Library into iOS applications through Swift Package Manager.

It provides a straightforward package-based distribution path for teams that want native iOS PDF capabilities without maintaining manual framework integration steps.

If you find ComPDF SDK useful, please consider giving us a ⭐ Star on GitHub — it helps us grow and improve! Got questions or ideas? Join the conversation in our Discussions.

Why ComPDF SDK Apple Package?

  • Easy to Integrate: Integrate PDF functionalities easily with our powerful SDK and clear documentation and guides with few lines of code.

  • Fully Customizable UI: Design a unique interface for your products with fully customizable UI source code by a high-performing SDK.

  • Comprehensive PDF Features: Supports generation, viewing, annotation, page editing, content editing, conversion, OCR, redaction, signing, forms, parsing, measurement, compression, comparison, color separation, batch processing, and more.

  • Faster Time-to-Market: Comprehensive SDK libraries save your time and expenses and roll out your applications and projects.

  • High-quality Service: We provide 24/7 professional one-to-one technical support, including onsite service and remote assistance via phone and email.

Table of Contents

Supported Features

Viewer: Fast and smooth PDF rendering and viewing

  • Display Modes - single/double page, vertical & horizontal scrolling, cover mode, crop mode
  • Text Search & Selection
  • PDF Navigation - outlines, bookmarks

Annotations:

  • Notes - add longer comments with adjustable icon shape and color

  • Ink - freehand drawing with customizable color, opacity, line thickness

  • Text - add, move, resize text directly on page

  • Inspector - adjust annotation looks (line styles, borders, colors, opacity, font)

  • Comment on Annotations and Update Status

  • Import & Export & Flatten Annotations (XFDF, FDF, JSON)

  • Highlight, Underline, Strikeout, Squiggly

  • Shapes - Rectangle, Oval, Line, Arrow, Polygon, Polyline, Cloud

  • Stamps, Sound, Movie, File Attachment, Link, Distance, Perimeter, Area

Forms:

  • Process fillable and static PDF forms

  • Form filling, form creation, form flattening

Document Editor:

  • Page manipulation - insert, delete, rotate, reorder, extract, crop

  • Split PDF, Merge PDF

Content Editor: Edit PDF text and images directly like in Word

Security:

  • Encryption - set open password, permission password

  • Restrict printing, copying, editing

Signatures:

  • Electronic Signatures - draw, type, image signatures

  • Digital Signatures - certificate-based signature validation

Watermark:

  • Add Text or Image Watermarks

  • Delete Watermarks

  • Customize Watermarks

OCR:

  • AI OCR

  • Recognize Tables, Graphics, Images

  • Support recognition in 80+ Languages

Compare Documents: Side-by-side document comparison to highlight differences

Redaction: Permanently remove sensitive content from PDFs

Measurement: Distance, area, perimeter measurement tools

Compress: Optimize and reduce PDF file size

PDF/A, PDF/X, PDF/E, PDF/UA: Standards compliance for archiving, printing, engineering, and accessibility

Convert Files:

  • Convert PDF to Word, Excel, PPT, HTML, CSV, images (PNG,JPEG, JPEG, JPEG2000, BMP, TIFF, TGA, GIF), RTF, TXT, JSON, XML, markdown, searchable PDF, searchable OFD.

  • Convert images (PNG,JPEG, JPEG, JPEG2000, BMP, TIFF, TGA, GIF) to Word, Excel, PPT, HTML, CSV, RTF, TXT, JSON, XML.

  • Convert Word, Excel, PPT, HTML, CSV, PNG, RTF, TXT to PDF

UI Customization:

  • Toolbar Customization

  • UI Personalization

  • Ready-Made UI Options

  • Out-of-the-box Source Code

Requirements

ComPDF SDK for Swift requires the latest stable version of Xcode available at the time the release was made. This is a hard requirement, as each version of Xcode is bundled with a specific version of the iOS Base SDK, which often defines how UIKit and various other frameworks behave.

  • The iOS 10.0 or higher.
  • The Xcode 13.0 or newer for Objective-C or Swift.

Apply the License Key

ComPDF SDK for Apple supports flexible licensing options, including online and offline licenses. You can apply for a free trial license on our website or contact our sales team to get the offline license. Each license is only valid for a root domain name and any of its subdomains. However, any documents, sample code, or source code distribution from the released package of ComPDF SDK to any third party is prohibited.

To learn how to copy and apply the license key and more details about our license, please visit our comprehensive documentation.

How to Make an iOS PDF Editor with Swift Package Manager

It's easy to embed ComPDF into an iOS application with a few lines of Swift or Objective-C code. Take a few minutes to get started.

The following sections explain how to run integration with Swift Package into your project

Creating a New Xcode Project

  1. Open Xcode and select File > New > Project… to create a new project for your application:

  2. Choose the App template for your project:

  3. When prompted, enter your app name (ComPDFKit-Demo) and your organization identifier (com.example) and choose Storyboard for the interface:

  4. Click Next and select the location to save the project.

  5. Click Create to finish.

Integrate ComPDFKit Apple Package into SPM

  1. Open your application in Xcode and select your project’s Package Dependencies tab.

  2. Copy the ComPDFKit Apple package repository URL into the search field:

    https://github.com/ComPDFKit/compdfkit-pdf-sdk-apple-package
  3. In the Dependency Rule fields, select Branch > master, and then click Add Package.

  1. After the package download completes, select Add Package.

  2. ComPDFKit should now be listed under Swift Package Dependencies in the Xcode Project navigator.

Display a PDF Document

So far, we have added "ComPDFKit.xcframework" to the "PDFViewer" project, and finished the initialization of the ComPDFKit PDF SDK. Now, let’s start building a simple PDF viewer with just a few lines of code.

  1. Prepare a test PDF file, drag and drop it into the newly created PDFView project. By this way, you can load and preview the local PDF document using NSBundle. The following image shows an example of importing a PDF document named Online5 into the project.

  2. Create a CPDFDocument object through NSURL, and create a CPDFView to display it. The following code shows how to load PDF data using a local PDF path and display it by CPDFView.

    guard let filePath = Bundle.main.path(forResource: "Online5", ofType: "pdf") else { return  }
    let url = URL(fileURLWithPath: filePath)
    let document = CPDFDocument(url: url)
    
    let rect = self.view.bounds
    let pdfView = CPDFView(frame: self.view.bounds)
    pdfView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
    pdfView.document = document
  3. Add the created CPDFView to the view of the current controller. The sample code shows below.

    self.view.addSubview(pdfView)

    The code shown here is a collection of the steps mentioned above:

    override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
            
         guard let filePath = Bundle.main.path(forResource: "Online5", ofType: "pdf") else { return  }
         let url = URL(fileURLWithPath: filePath)
         let document = CPDFDocument(url: url)
    
         let rect = self.view.bounds
         let pdfView = CPDFView(frame: self.view.bounds)
         pdfView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
         pdfView.document = document
         self.view.addSubview(pdfView)
    }
  4. Connect your device or simulator, and use shortcut Command_R to run the App. The PDF file will be opened and displayed.

Add Required Permissions

To protect user privacy, before accessing the sensitive privacy data, you need to find the "Info" configuration in your iOS 10.0 or higher iOS project and configure the relevant privacy terms as shown in the following picture.

<key>NSCameraUsageDescription</key>
<string>Your consent is required before you could access the function.</string>

<key>NSMicrophoneUsageDescription</key>
<string>Your consent is required before you could access the function.</string>

<key>NSPhotoLibraryAddUsageDescription</key>
<string>Your consent is required before you could access the function.</string>

<key>NSPhotoLibraryUsageDescription</key>
<string>Your consent is required before you could access the function.</string>

Free Trial and License

ComPDF SDK offers a 30-day free trial so you can evaluate core PDF capabilities in your own application.

To get started:

  1. Apply for a free trial
  2. Review supported trial features and licensing details
  3. Follow the integration and license steps to activate the SDK in your project

For custom deployments, advanced features, or volume licensing, please contact our sales team

Support

ComPDF has a professional R&D team that produces comprehensive technical documentation and guides to help developers. Also, you can get an immediate response when reporting your problems to our support team.

Changelog

Keep up with the latest updates, improvements, and bug fixes for ComPDF SDK for iOS: View iOS Changelog.

Related

About

Swift Package Manager integration for ComPDF SDK on iOS and macOS. Add production-grade PDF viewing, editing, annotations, form filling, and document management to your Swift projects with a single SPM dependency.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages