Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 2 additions & 26 deletions Shared/Examples/ExperimentFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,13 @@

import Foundation
import TPPDF
import UIKit

class ExperimentFactory: ExampleFactory {
func generateDocument() -> [PDFDocument] {
let document = PDFDocument(format: .b5)
document.add(.contentCenter, text: "Some Test Name")
let images = [
"file:///Users/Philip/Downloads/test_images/0000.jpg",
"file:///Users/Philip/Downloads/test_images/0001.jpg",
"file:///Users/Philip/Downloads/test_images/0002.jpg",
"file:///Users/Philip/Downloads/test_images/0003.jpg",
"file:///Users/Philip/Downloads/test_images/0004.jpg",
"file:///Users/Philip/Downloads/test_images/0005.jpg",
"file:///Users/Philip/Downloads/test_images/0006.jpg",
"file:///Users/Philip/Downloads/test_images/0007.jpg",
"file:///Users/Philip/Downloads/test_images/0008.jpg",
"file:///Users/Philip/Downloads/test_images/0009.jpg",
]
images[0..<images.count].compactMap({ imageFileUrl -> PDFImage? in
guard let imageURL = URL(string: imageFileUrl),
let image = UIImage(contentsOfFile: imageURL.path(percentEncoded: false)),
image.size != .zero
else {
return nil
}

let pdfImage = PDFImage(image: image)
return pdfImage
}).forEach({ pdfImage in
document.add(image: pdfImage)
})
// Create custom documents to experiment with the framework

return [document]
}
}