jsPDF problem with the URI

0

I'm trying to generate a PDF with jsPDF

Part of the code is as follows:

    var doc = new jsPDF();
    var imgData =' data:...........
    doc.setFontSize(22);
    doc.text(20, 20, wps()[1][1]);
    doc.setFontSize(16);
    doc.text(20, 30, 'texto');
    doc.addImage(imgData,'JPEG',15,40,180,160);
    doc.save(arhivo_prueba()+'.pdf');

If I assign to the variable the value of the jsPDF web example, I get the "flying kitten" correctly

link

However I want a JPEG image that I have in a directory on the server where the web is hosted.

the fact is that using the online URI creation service

link

I get the URI of the image. But with it the code does not work.

I think I understand that the URI is unique for the location of the file, because if I enter it in a browser I see the image. But, if I work the script locally, when I upload it to the server, the URI that is in the code will not be valid. I understand that I will have to generate another URI in the remote location and modify the code. Is there any way to generate the URI dynamically, where is the image file located? Keeping in mind that it will always be in a directory of the website, that is always the same relative route.

    
asked by kamome 29.02.2016 в 11:32
source

0 answers