title: Insert an Image into PDF file Swift
body: <p>I have searched a lot of pages but haven't seen any good explanation for making image to pdf. Also there are many never answered question. So it's looks helpful to ask here. The app has 'Camera', 'Photo Library' and 'Create PDF' buttons. After taken/choosing picture I want to attach this image into pdf file by 'Create PDF' button</p>
  
  <p>Main Storyboard:</p>
  
  <p><a href="https://i.stack.imgur.com/ARSGX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ARSGX.png" alt="my scrreen"></a></p>
  
  <p>ViewController:</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
  
  @IBOutlet weak var PhotoLibrary: UIButton!
  @IBOutlet weak var Camera: UIButton!
  @IBOutlet weak var ImageDisplay: UIImageView!
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
  }
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  
  //MARK: Photo Library Button Action
  @IBAction func PhotoLibraryAction(sender: UIButton) {
      let picker = UIImagePickerController()
      picker.delegate = self
      picker.sourceType = .PhotoLibrary
  
      presentViewController(picker, animated: true, completion: nil)
  }
  
  
  
  
  //MARK: Camera Button Action
  @IBAction func CameraAction(sender: UIButton) {
      let picker = UIImagePickerController()
      picker.delegate = self
      picker.sourceType = .Camera
  
      presentViewController(picker, animated: true, completion: nil)
  }
  
  
  
  
  //MARK: Adding Texts on Selected/Taken Image
  func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
  
      if var image = info[UIImagePickerControllerOriginalImage] as? UIImage {
          ImageDisplay.image = image
  
      }
      dismissViewControllerAnimated(true, completion: nil)
  }
  
  
  
  
  }
  </code></pre>