title: change path for exported pdf
body: <p>I have found this code over the internet for exporting the view to PDF. But the downloaded file stores in the library which will be hard to locate. How can I change the path, so that when I use the app on my iPhone, it gets stored in the download folder. Also, the pdf looks like it is a screenshot of the view, is there any way I can control the view to crop such as I don't want the navigation bar and other button to appear on the screen. Is there any way I can make it look like a document rather than a screenshot. Or may be resize the view to the point where I want. Or does anyone have a better code to export the file to PDF?</p>
  <pre><code>  func exportToPDF() {
          let outputFileURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent(&quot;SwiftUI.pdf&quot;)
          let pageSize = CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
          let rootVC = UIApplication.shared.windows.first?.rootViewController
  
          //Render the PDF
          let pdfRenderer = UIGraphicsPDFRenderer(bounds: CGRect(origin: .zero, size: pageSize))
          DispatchQueue.main.async {
              do {
                  try pdfRenderer.writePDF(to: outputFileURL, withActions: { (context) in
                      context.beginPage()
                      rootVC?.view.layer.render(in: context.cgContext)
                  })
                  print(&quot;wrote file to: \(outputFileURL.path)&quot;)
                  
              } catch {
                  print(&quot;Could not create PDF file: \(error.localizedDescription)&quot;)
              }
          }
      }
  </code></pre>