Domo Everywhere

Domo Everywhere

Exporting custom bricks visual as pdf

Hi,

I've created a carbon offset infographic using the blank custom brick which is embedded into our customer portal. I wish to allow our customer select the desired month and download the infographic as PDF in proper format (i.e., without month picker).

I used html2pdf module from cdnjs.cloudflare.com but encountered the following error upon clicking the export button: [Report Only] Refused to frame <censored> because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' *.domo.com sensorflow-org.domo.com".

Anyone knows how do I resolve this issue?

image.png
Tagged:

Welcome!

It looks like you're new here. Members get access to exclusive content, events, rewards, and more. Sign in or register to get started.
Sign In

Best Answers

  • Coach
    Answer ✓

    Perhaps this might help..

    1. <!DOCTYPE html>
    2. <html>
    3. <head>
    4. <title>PDF Generation Example</title>
    5. <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.4.0/jspdf.umd.min.js"></script>
    6. </head>
    7. <body>
    8. <!-- Your infographic content here -->
    9. <div id="infographic">
    10. <h1>My Carbon Offset Infographic</h1>
    11. <p>This is where your infographic content goes.</p>
    12. </div>
    13. <!-- Button to trigger PDF generation -->
    14. <button id="downloadPDF">Download PDF</button>
    15. <script>
    16. document.getElementById('downloadPDF').addEventListener('click', function() {
    17. // Create a new jsPDF instance
    18. var doc = new jsPDF();

    19. // Add your infographic content to the PDF
    20. var infographicContent = document.getElementById('infographic').innerHTML;
    21. doc.text(infographicContent, 10, 10);

    22. // Save the PDF
    23. doc.save('carbon_offset_infographic.pdf');
    24. });
    25. </script>
    26. </body>
    27. </html>

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

  • Contributor
    Answer ✓

    Also add the cloudflare url to your Custom Apps authorized domains. If you want it to be approved outside of the Domo domain.

    Screenshot 2024-06-14 at 10.29.13 AM.png

    ** Was this post helpful? Click 💡/💖/👍/😊 below. **
    ** If it solved your problem. Accept it as a solution! ✔️ **

    Or do you need more help? https://calendly.com/matthew-kastner/15-minute-chat
    Did I help you out? Feedback is priceless and will help me more than you know.Write a review!

Answers

  • That appears to be a Content Security Policy issue….restricts the resources a web page can load based on domain policy. As if your frame (Domo portal) violates the security by attempting to frame another domain.

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

  • Coach
    Answer ✓

    Perhaps this might help..

    1. <!DOCTYPE html>
    2. <html>
    3. <head>
    4. <title>PDF Generation Example</title>
    5. <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.4.0/jspdf.umd.min.js"></script>
    6. </head>
    7. <body>
    8. <!-- Your infographic content here -->
    9. <div id="infographic">
    10. <h1>My Carbon Offset Infographic</h1>
    11. <p>This is where your infographic content goes.</p>
    12. </div>
    13. <!-- Button to trigger PDF generation -->
    14. <button id="downloadPDF">Download PDF</button>
    15. <script>
    16. document.getElementById('downloadPDF').addEventListener('click', function() {
    17. // Create a new jsPDF instance
    18. var doc = new jsPDF();

    19. // Add your infographic content to the PDF
    20. var infographicContent = document.getElementById('infographic').innerHTML;
    21. doc.text(infographicContent, 10, 10);

    22. // Save the PDF
    23. doc.save('carbon_offset_infographic.pdf');
    24. });
    25. </script>
    26. </body>
    27. </html>

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

  • Contributor
    Answer ✓

    Also add the cloudflare url to your Custom Apps authorized domains. If you want it to be approved outside of the Domo domain.

    Screenshot 2024-06-14 at 10.29.13 AM.png

    ** Was this post helpful? Click 💡/💖/👍/😊 below. **
    ** If it solved your problem. Accept it as a solution! ✔️ **

    Or do you need more help? https://calendly.com/matthew-kastner/15-minute-chat
    Did I help you out? Feedback is priceless and will help me more than you know.Write a review!

Welcome!

It looks like you're new here. Members get access to exclusive content, events, rewards, and more. Sign in or register to get started.
Sign In