osx - Creating a PDF in Swift -


this question has answer here:

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

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -