Creating pdf of smart doc to attach to email

Hello,
I am currently trying to find a way to create a pdf version of a smart document from the new editor in version 2021.06 and attach it to an email. The code is triggered by an email button on our Quote page, but the pdf comes out blank. I can get the pdf to export properly if I select the print button in our Quote form which creates a popup/preview of the smart doc quote before confirming the print process, then click the email button, which fails at first but works the second time it is selected. I am not getting any helpful error messages to help me here. I tried making a popup similar to the print popup appear when the email button is selected but it is not working and I am unsure what is causing the pdf export to work when I go through the weird process I outlined. Any suggestions as to how I can get this to work with a single button click would be greatly appreciated. Thanks!
I am currently trying to find a way to create a pdf version of a smart document from the new editor in version 2021.06 and attach it to an email. The code is triggered by an email button on our Quote page, but the pdf comes out blank. I can get the pdf to export properly if I select the print button in our Quote form which creates a popup/preview of the smart doc quote before confirming the print process, then click the email button, which fails at first but works the second time it is selected. I am not getting any helpful error messages to help me here. I tried making a popup similar to the print popup appear when the email button is selected but it is not working and I am unsure what is causing the pdf export to work when I go through the weird process I outlined. Any suggestions as to how I can get this to work with a single button click would be greatly appreciated. Thanks!