Reputation: 126
I am working on a Mac OS X PDF splitter program.
A PDF is loaded by the user, then some pages are selected to create a new PDF file, only with those pages.
I am using pdfThumbnailView.selectedPages()
to select the pages, which return an array of PDF pages that correspond to the thumbnails selected in the thumbnail view.
Now I want to turn this into a NSData object, in order to build a new PDF with PDFDocument(data *data*: NSData!)
I tried to use NSKeyedArchiver
, but my array is not compliant to NSCoding
, making the program crash.
Does anyone have a good alternative to this ?
Thank you for your help.
Upvotes: 0
Views: 509
Reputation: 126
For those who are going to see this, here is the solution I found: I used the func insertPage(page: PDFPage!, atIndex index: Int)
method of PDFDocument
to build a brand new PDF doc, in a for-in loop.
No need to use serialization, which was a bit overkill for what I wanted to do.
Upvotes: 4