Skip to content
Advertisement

How to send pdf via gmail api

I have implemented gapi/ 0Auth2 elsewhere in my code and everything works, except the attached PDF is broken. The PDF can not be previewed and is empty when downloaded.

´´´

JavaScript

´´´

I have tried premade PDF, rather than jsPDF.

I have followed the documentation on google and looked at different post, but there seem to be no documentation for this specifik problem.

Advertisement

Answer

From your script, I thought that the returned value from pdfCon("ny brab verder") is the data URL. So, how about the following modification?

From:

JavaScript

To:

JavaScript
  • In this modification, the header is removed from the data URL. By this, only the base64 data is retrieved.
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement