0

I would like to create a pdf with dynamic content for that i am using JsPDF and Html2Canvas libraries.

Every thing is working fine except the script is unable to convert image tag between svg.

<div id="img1Masked">
    <svg width="100%" height="100%" viewbox="0 0 1150 550" version="1.1"
     xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
      <image xlink:href="<?php echo base_url(); ?>addons/shared_addons/modules/fj/img/Base.png" x="0" y="0" width="100%" height="100%" />
    </svg>
  </div>

  <div id="img2Masked">
    <svg width="100%" height="100%" viewbox="0 0 1150 550" version="1.1"
     xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
      <image xlink:href="<?php echo base_url(); ?>addons/shared_addons/modules/fj/img/Base2.png" x="0" y="0" width="100%" height="100%" />
    </svg>
  </div>
      .
      .
      .
      .

Is there any solution which can be used to convert the above HTML into PDF

Thanks

Abdul Qadir R.
  • 1,059
  • 3
  • 9
  • 26
  • does not work either :( infact the view has also been disappeared – Abdul Qadir R. Jul 09 '18 at 11:50
  • you should be able to get the SVGs into your pdf with the help of html2canvas library. However, adding an image like jpg or png can be tricky unless the image you are trying to include is not hosted in the same server as your (here PHP) app is running. The best solution for me especially, when there is only 1 image, would be to convert this into a base64 string & add it in your markup (html). That way you will solve it with ease. – Hamzeen Hameem Jul 09 '18 at 16:00
  • Well there is multiple parts of a single image by joining them one shape is generated. SVG can be converted into pdf but html2canvas is not allowing to convert image tag used between SVG into pdf. – Abdul Qadir R. Jul 10 '18 at 05:24

0 Answers0