Creating pdf of smart doc to attach to email

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Creating pdf of smart doc to attach to email

Postby mark1625847674 » Fri Jul 09, 2021 6:31 pm

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!
mark1625847674
 
Posts: 2
Joined: Fri Jul 09, 2021 6:21 pm

Re: Creating pdf of smart doc to attach to email

Postby mark1625847674 » Tue Jul 13, 2021 6:20 pm

UPDATE: The pdf file that attaches to the email now and contains all the information from the merged tags, but the design of the form is missing important CSS elements (text, layout, table design, etc). Any info or suggestions for how I might remedy this would be great. Thanks!
mark1625847674
 
Posts: 2
Joined: Fri Jul 09, 2021 6:21 pm

Re: Creating pdf of smart doc to attach to email

Postby rvanveen » Tue Jul 27, 2021 3:20 pm

Hi,

Could you test it with the latest version that is on github https://github.com/Servoy/svyUtils/blob/master/svyUtils%24documentEditor/svyDocEditor.js?
I have added some fixes for the default style classes (without the component) and fixes for some error handling.

Currently i have this when doing an export to get the pdf byteArray.
Code: Select all
var content = scopes.svyDocEditor.mergeTags(htmlContent ,record);
var pdfBytes = scopes.svyDocEditor.getExporter()
      .addHeadTag('<meta charset="UTF-8">')
      .addCss(myCustomCSS)
      .setContent(content)
      .exportToPDF();
User avatar
rvanveen
 
Posts: 15
Joined: Fri Jul 01, 2016 10:51 am


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 2 guests