title: Flutter: save a generated PDF from preview page with a custom function
body: <p>I'm using the <code>pdf</code> package (link to <a href="https://pub.dev/packages/pdf" rel="nofollow noreferrer">pub.dev</a> page) to create documents inside my app.</p>
  <p>How can I save the document from the preview page?
  I know about the built-in <code>print</code>  and <code>share</code> functions, but I need something else.</p>
  <p>I need a function that does the following:</p>
  <ol>
  <li>save the document to the device</li>
  <li>upload it to Firebase Storage</li>
  <li>delete the local file</li>
  </ol>
  <p>I know how to do all of these steps, but I'm unable to access the <code>Uint8List</code>  bytes of the pdf document that is being previewed... I've tried to add a <code>PdfPreviewAction</code>, but I still can't access the bytes of the document from it</p>
  <p><img src="https://user-images.githubusercontent.com/69045457/138837102-3c560b62-1c41-4834-a297-9c47410144fb.png" alt="Screenshot" /></p>