2

I am currently using xepOnline to generate a pdf of my page.

This is working perfectly , but i now want a button next the download button which opens the mail program on your pc and attaches the generated pdf file.

My code so far: (not much)

function emailCurrentPage(){
            window.location.href="mailto:?subject="+document.title+"&body="+escape(window.location.href);
        }

<button onClick="javascript:emailCurrentPage()">Doormailen</button>
<button href="#" onclick="return xepOnline.Formatter.Format('content',{render:'download'},{pageWidth:'216mm', pageHeight:'279mm'}, {filename:'Test'});">Opslaan als PDF</button>
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Arjan Knol
  • 942
  • 5
  • 20
  • Duplicate of http://stackoverflow.com/questions/1415205/how-to-send-email-by-using-javascript-or-jquery . You could likely open the mail client but I do not think with the attachment. You have the PDF available to you in the xeponline Javascript, you could send back to a server application to send an email. – Kevin Brown Jun 02 '16 at 17:39
  • Thanks for the comment! I don't think this is a Duplicate question though. – Arjan Knol Jun 03 '16 at 06:53
  • OK, what about this one as duplicate? http://stackoverflow.com/questions/1415205/how-to-send-email-by-using-javascript-or-jquery and see answer below. – Kevin Brown Jun 04 '16 at 18:01
  • I get what you are saying but u specifcly wanted to know if it was posible with xeponline. – Arjan Knol Jun 05 '16 at 07:41

1 Answers1

0

The syntax of mailto does not accept attachments. See the following as one description.

https://yoast.com/dev-blog/guide-mailto-links/

You would only be able to open the email itself with the TO, CC, BCC, Subject and Body filled out and the user would have to manually attach the PDF downloaded.

In @cloudformatter, the PDF is returned and is stored in the response. You could override the response handler to resend that PDF to a server-side application that sends the email for you.

As one of the authors of the xepOnline script and the server-side application that is handling the requests and formatting the PDFs, we already developed and have such functionality in the server itself. It is not available in the free-to-use version as we cannot support tens of thousands of emails sent daily by the users.

Kevin Brown
  • 8,805
  • 2
  • 20
  • 38