PDF generator using UIViews or UIViews with an associated XIB

Last update: Aug 28, 2020

Description

Create UIView objects using any method you like, including interface builder with Auto-layout and size classes enabled. Then generate a PDF directly from those views!

Requirements

XCode 6.4+, iOS 7.0+

Installation

In XCode, select 'Add Files To Project', and select RP_UIView_2_PDF.h

Usage

  1. Make a xib file. Your xib file should only consist of UILabels and/or UIImageViews and/or other UIView subviews. Use views that are 1 pixel high or wide to create lines. Set the tag of a UIView to 1 to have it draw filled or zero to draw as just a 1 pixel bordered box.
  2. Load your xib like so
UIView *pageOne = [[NSBundle mainBundle] loadNibNamed:@"NibNameOne" owner:self options:nil].lastObject;
UIView *pageTwo = [[NSBundle mainBundle] loadNibNamed:@"NibNameTwo" owner:self options:nil].lastObject;
  1. Then generate your PDF like this
NSString *tempFilepath = [RP_UIView_2_PDF generatePDFWithPages:@[pageOne, pageTwo];

See demo project for details.

License

UIView_2_PDF is released under the MIT license. See 'LICENCE.md' for details.

GitHub

https://github.com/RobertAPhillips/UIView_2_PDF
You might also like...

Mephisto - A command line tool to convert Comic Book Zip archives to PDF and share them over AirDrop

Mephisto - A command line tool to convert Comic Book Zip archives to PDF and share them over AirDrop

mephisto A command line tool written in Swift to convert Comic Book Zip archives

Feb 7, 2022

Small utility to import PDF slides as vector images into Keynote for iOS.

Small utility to import PDF slides as vector images into Keynote for iOS.

Small utility to import PDF files into Keynote for iOS. This utility is especially helpful when presenting slideshows created by LaTeX

Jun 14, 2022

Swift package that uses WebKit to render PDF files from URLs

Swift package for generating a PDF file from a URL (rendered by WebKit)

Feb 25, 2022

Generate beautiful .pdf Files from xib

Description The Library generates a PDF directly from interface builder with Auto-layouted views! Swift Version of UIView_2_PDF. Installation Download

Sep 23, 2021

A Static Library to be embedded on iOS applications to display pdf documents derived from Fast PDF

FastPdfKit This repository contains the FastPdfKit iOS library with some sample projects. FastPdfKit is a library that let you show pdf documents in i

Jun 29, 2022

A simple generator of PDF written in Swift.

Features | Requirements | Installation | Usage | Communication | LICENSE PDFGenerator PDFGenerator is a simple PDF generator that generates with UIVie

Jul 18, 2022

RetroVisor helps you with inspecting UIViews in your unit tests.

RetroVisor RetroVisor helps you with inspecting UIViews in your unit tests. You do test views in unit tests, right? Right? Usually, I mark subview pro

Mar 29, 2022

A Swift mixin for reusing views easily and in a type-safe way (UITableViewCells, UICollectionViewCells, custom UIViews, ViewControllers, Storyboards…)

A Swift mixin for reusing views easily and in a type-safe way (UITableViewCells, UICollectionViewCells, custom UIViews, ViewControllers, Storyboards…)

Reusable A Swift mixin to use UITableViewCells, UICollectionViewCells and UIViewControllers in a type-safe way, without the need to manipulate their S

Aug 2, 2022

Type-Safe Associated Objects in Swift

Type-Safe Associated Objects in Swift TSAO is an implementation of type-safe associated objects in Swift. Objective-C associated objects are useful, b

Jun 29, 2022

This UI attempts to capture the Quibi Card Stack and the associated User Interaction.

This UI attempts to capture the Quibi Card Stack and the associated User Interaction.

RGStack This UI attempts to capture the Quibi Card Stack and the associated User Interaction. Required A View that conforms to the ConfigurableCard pr

Jul 21, 2022

URLScheme router than supports auto creation of UIViewControllers for associated url parameters to allow creation of navigation stacks

IKRouter What does it do? Once you have made your UIViewControllers conform to Routable you can register them with the parameters that they represent

Feb 28, 2022

JSONExport is a desktop application for Mac OS X which enables you to export JSON objects as model classes with their associated constructors, utility methods, setters and getters in your favorite language.

JSONExport is a desktop application for Mac OS X which enables you to export JSON objects as model classes with their associated constructors, utility methods, setters and getters in your favorite language.

JSONExport JSONExport is a desktop application for Mac OS X written in Swift. Using JSONExport you will be able to: Convert any valid JSON object to a

Aug 5, 2022

Creates a DatePickerTextField which shows a TextField associated with a DatePicker

Creates a DatePickerTextField which shows a TextField associated with a DatePicker

SwiftUI.DatePickerTextField This app creates a DatePickerTextField which shows a TextField associated with a DatePicker. When the TextField gets focus

Jun 21, 2022

Protocol-oriented UITableView management, powered by generics and associated types.

DTTableViewManager Features Powerful mapping system between data models and cells, headers and footers Automatic datasource and interface synchronizat

Jul 25, 2022

Fineride - An iOS application for managing one's vehicles and their associated maintenance

FineRide An iOS application for managing one's vehicles and their associated mai

Feb 13, 2022

Protocol-oriented UICollectionView management, powered by generics and associated types.

DTCollectionViewManager Features Powerful mapping system between data models and cells, headers and footers Automatic datasource and interface synchro

Jul 25, 2022

Merges a given number of PDF files into one file using the PDFKit framework

Titanium iOS PDF Merge Merges a given number of PDF files into one file using the PDFKit framework Requirements iOS 11+ Titanium SDK 9+ API's Methods

Jan 26, 2022

Draw Week Time Table on PDF using PDFKit in iOS Swift

Draw Week Time Table on PDF using PDFKit in iOS Swift

DrawPDFTimeTable Draw Week Time Table on PDF using PDFKit in iOS Swift. Image Info This is the pdf of time table drawn using PDFKit in iOS Swift with

May 31, 2022

Localization/I18n: Incrementally update/translate your Strings files from .swift, .h, .m(m), .storyboard or .xib files.

Localization/I18n: Incrementally update/translate your Strings files from .swift, .h, .m(m), .storyboard or .xib files.

Installation • Configuration • Usage • Build Script • Donation • Migration Guides • Issues • Contributing • License BartyCrouch BartyCrouch incrementa

Aug 11, 2022
Comments
  • 1. Minor Refactoring. Simple Modernisation and more concise/direct ReadMe.

    Hi Rob!

    A client is asking me for some PDF related tasks and I remembered a while back that you submitted this code to the public domain. It's still impressive today and I figured I should make some sort of contribution to the effort.

    Granted, all I have done is clean it up a bit. The logic is still sound. One thing I did notice, is that the preview controller wasn't working properly in modern devices, so just using web view for now. It's only a demo project anyway. The real meat, is in your class that does the drawing.

    Other changes include simple modernisation of the build settings, courtesy of Xcode 7 wizard. Also enabled size classes.

    I cut down the read me file so that it's easier on the eye and straight to the point. Hope that's ok. Also removed the debugging feature because it seemed to only be necessary during development i.e. the code is stable now.

    If your happy with all this then please merge into your master branch. I look forward to any updates you do to this code. I'm 'watching' this repo so I will be notified!

    Reviewed by ghost at 2015-09-30 00:05
Related tags
A Static Library to be embedded on iOS applications to display pdf documents derived from Fast PDF

FastPdfKit This repository contains the FastPdfKit iOS library with some sample projects. FastPdfKit is a library that let you show pdf documents in i

Jun 29, 2022
A simple generator of PDF written in Swift.

Features | Requirements | Installation | Usage | Communication | LICENSE PDFGenerator PDFGenerator is a simple PDF generator that generates with UIVie

Jul 18, 2022
Draw Week Time Table on PDF using PDFKit in iOS Swift
Draw Week Time Table on PDF using PDFKit in iOS Swift

DrawPDFTimeTable Draw Week Time Table on PDF using PDFKit in iOS Swift. Image Info This is the pdf of time table drawn using PDFKit in iOS Swift with

May 31, 2022
SimplePDF is a wrapper of UIGraphics PDF context written in Swift.
SimplePDF is a wrapper of UIGraphics PDF context written in Swift.

SimplePDF is a wrapper of UIGraphics PDF context written in Swift. You can: add texts, images, spaces and lines, table set up page layout, adjust cont

Jul 31, 2022
An iOS PDF viewer and annotator written in Swift that can be embedded into any application.

Requirements iOS 9 or above Xcode 8 or above Swift 3.0 Note This project is still in early stages. Right now the PDF reader works both programmaticall

Jul 4, 2022
PDF Reader Core for iOS
PDF Reader Core for iOS

PDF Reader Core for iOS This project is no longer supported or maintained. It is only here for historical reasons. Please see the UXReader PDF Framewo

Aug 6, 2022
TPPDF is a simple-to-use PDF builder for iOS
TPPDF is a simple-to-use PDF builder for iOS

TPPDF is a fast PDF builder for iOS & macOS using simple commands to create advanced documents! Created and maintained by Philip Niedertscheider and a

Jul 25, 2022
UIImage PDF extensions.

UIImagePlusPDF UIImage extensions to use PDF files. Using UIImagePlusPDF you can avoid a lot png images files (1x, 2x, 3x sizes) and simply replace ea

Jan 25, 2022
Estrutura Simples para Navegacao Web e Download PDF

Download-PDF-WebView Projeto desenvolvido em Swift com a função de criar uma estrutura simples para navegação Web em seu Aplicativo, permitindo a visu

Nov 30, 2021
PdfBuilder: a swift library made to make creation of the Pdf file from code simpler
PdfBuilder: a swift library made to make creation of the Pdf file from code simpler

PdfBuilder PdfBuilder is a swift library made to make creation of the Pdf file f

Jul 22, 2022