Last active
August 29, 2015 14:22
-
-
Save marcelofabri/9c3c710555a41ac192ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Quartz | |
extension Array { | |
func each(doThis: (element: T) -> Void) { | |
for e in self { | |
doThis(element: e) | |
} | |
} | |
} | |
let documents = DecksetApp()?.documents.first?.slides.map { PDFDocument(data: $0.pdfData) } | |
let output = PDFDocument() | |
var pageIndex = 0 | |
documents?.each { doc in | |
for var i = 0; i < doc.pageCount(); i++ { | |
let page = doc.pageAtIndex(i) | |
output.insertPage(page, atIndex: pageIndex) | |
pageIndex++ | |
} | |
} | |
output.writeToFile("/Users/marcelofabri/test.pdf") | |
println("Exported \(pageIndex) pages") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment