UIImage PDF extensions.

Last update: Jan 25, 2022

UIImagePlusPDF

Swift 4.2 CocoaPods compatible Packagist

UIImage extensions to use PDF files. Using UIImagePlusPDF you can avoid a lot png images files (1x, 2x, 3x sizes) and simply replace each of them with only one pdf file.

Installation

CocoaPods:

pod 'UIImagePlusPDF'
import UIImagePlusPDF

Usage

Simple example:

let imageView = UIImageView()
let image = UIImage.pdfImage(with: "imageName")
imageView.image = image

Other options

//with custom width 
UIImage.pdfImage(with: "imageName", width: 350)

//with custom height
UIImage.pdfImage(with: "imageName", height: 350)

//with custom size
UIImage.pdfImage(with: "imageName", size: CGSize(width: 300, height:  400))

//with page number
UIImage.pdfImage(with: "multipage pdf file", width: 300, pageNumber: 2)

//same options with resource url
UIImage.pdfImage(with: URL(string: "path"))

Cache

Memory cache:

//using NSCache
//default is true
UIImage.pdfCacheInMemory = true

Disk cache:

//default is false
UIImage.pdfCacheOnDisk = true

Cache deleting:

//all cache
UIImage.removeAllPDFCache()

//all memory cache
UIImage.removeAllPDFMemoryCache()

//all disk cache
UIImage.removeAllPDFDiskCache()

//memory cached pdf with name
UIImage.removeMemoryCachedPDFImage(
    with: "pdf name", 
    size: imageSize, 
    pageNumber: 1 /*optional, default is 1*/
)

//memory cached pdf with url
UIImage.removeMemoryCachedPDFImage(
    with: URL(string: "path"), 
    size: imageSize, 
    pageNumber: 1 /*optional, default is 1*/
)

//disk cached pdf with name
UIImage.removeDiskCachedPDFImage(
    with: "pdf name", 
    size: imageSize, 
    pageNumber: 1 /*optional, default is 1*/
)

//disk cached pdf with url
UIImage.removeDiskCachedPDFImage(
    with: URL(string: "path"), 
    size: imageSize, 
    pageNumber: 1 /*optional, default is 1*/
)

License

UIImagePlusPDF is under MIT license. See the LICENSE file for more info.

GitHub

https://github.com/DimaMishchenko/UIImagePlusPDF
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

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

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

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 17, 2022

SwiftGif - A small UIImage extension with gif support.

 SwiftGif - A small UIImage extension with gif support.

SwiftGif - A small UIImage extension with gif support.

Jun 21, 2022

High performance and lightweight UIView, UIImage, UIImageView, UIlabel, UIButton, Promise and more.

SwiftyUI High performance and lightweight UIView, UIImage, UIImageView, UIlabel, UIButton and more. Features SwiftyView GPU rendering Image and Color

May 31, 2022

A tool to calculate the color ratio of UIImage in iOS.

A tool to calculate the color ratio of UIImage in iOS.

UIImageColorRatio A tool to calculate the color ratio of UIImage in iOS. How to use UIImageColorRatio Get the color ratio of UIImage. let image = ...

Feb 24, 2022

TextDrawer, is a UIView allows you to add text, with gesture, on UIView, or UIImage

TextDrawer, is a UIView allows you to add text, with gesture, on UIView, or UIImage

TextDrawer TextDrawer, is a UIView allows you to add text, with gesture, on UIView, or UIImage. About Annotating Images TextDrawer is the easiest way

Mar 5, 2022

A Simple way help you drop or drag your source (like UIImage) between different App.

A Simple way help you drop or drag your source (like UIImage) between different App.

Mar 23, 2022

A convenient class usable from UIKit view controller or SwiftUI to scan document & get UIImage or PDFDocument as result - Replacement of IRLDocumentScanner

Super easy SwiftUI & UKKit pakcage to scan: Images or PDF. It is also a replacement for IRLScannerViewController

Jun 21, 2022

Complete Animated GIF Support for iOS, with Functions, NSJSONSerialization-style Class, and (Optional) UIImage Swizzling

Complete Animated GIF Support for iOS, with Functions, NSJSONSerialization-style Class, and (Optional) UIImage Swizzling

AnimatedGIFImageSerialization This library is no longer maintained. In iOS 13+ and macOS 10.15+, use CGAnimateImageAtURLWithBlock instead. AnimatedGIF

May 16, 2022

🌠 A small UIImage extension with gif support

🌠 A small UIImage extension with gif support

🌠 A small UIImage extension with gif support

Jun 21, 2022

A view controller for iOS that allows users to crop portions of UIImage objects

A view controller for iOS that allows users to crop portions of UIImage objects

TOCropViewController TOCropViewController is an open-source UIViewController subclass to crop out sections of UIImage objects, as well as perform basi

Jun 28, 2022

Convert UIImage to ASCII art

Convert UIImage to ASCII art

BKAsciiImage As seen on Cmd.fm iOS App https://itunes.apple.com/app/cmd.fm-radio-for-geeks-hackers/id935765356 Installation BKAsciiImage is available

May 29, 2022

IOS UIImage processing functions using the vDSP/Accellerate framework for speed.

UIImage Image Processing extensions using the vDSP/Accelerate framework.

Apr 15, 2022

An NSFW image detector for Swift built as an extension on UIImage.

Swift_NSFW_Detector An NSFW image detector for Swift built as an extension on UIImage. If you've ever allowed users to share images you are probably w

Mar 26, 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

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

Jun 7, 2022
Related tags
A convenient class usable from UIKit view controller or SwiftUI to scan document & get UIImage or PDFDocument as result - Replacement of IRLDocumentScanner

Super easy SwiftUI & UKKit pakcage to scan: Images or PDF. It is also a replacement for IRLScannerViewController

Jun 21, 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

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

Jun 7, 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

Jun 27, 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

Jun 17, 2022
PDF generator using UIViews or UIViews with an associated XIB

Description Create UIView objects using any method you like, including interface builder with Auto-layout and size classes enabled. Then generate a PD

Aug 28, 2020
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
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

Jun 10, 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

Mar 7, 2022