osx - Creating a PDF in Swift -
this question has answer here:
- create pdf in swift 1 answer
- how export view pdf in os x? 1 answer
i want able able create pdf of view controller. essentially, need screenshot of view controller exported pdf. apple don't seem have documentation on (for os x development) in swift, got ideas?
thanks
just in case wondering.. solution problem follows (apologies not posting sooner - assumed 'duplicate' question answer lie elsewhere..
// define bounds of view let rect: nsrect = self.view.bounds // create pdf version , save desktop self.view.datawithpdfinsiderect(rect).writetofile("/users/jay/desktop/test.pdf", atomically: false) // automatically open newly generated file nsworkspace.sharedworkspace().openfile("/users/jay/desktop/test.pdf")
Comments
Post a Comment