cesarvr / pdf-generator

Cordova plugin to generate pdf in the client-side
MIT License
107 stars 61 forks source link

cannot display image from firebase storage #32

Closed musfandi closed 7 years ago

musfandi commented 7 years ago

Hiii, please help me... cannot display image from firebase storage using pdf generator

sample image from firebase storage

image from https://image.ibb.co work like charm

musfandi commented 7 years ago

`

  var hContent = "<html> <h1>  Firebase hosting  </h1> " + 

             "<h1>  ibb hosting (working) </h1> " + 
             "<img height='200' width='200' src='https://image.ibb.co/nzEnqk/vdraw.jpg'>" +
            "</html>";
         console.log(hContent);

        document.addEventListener('deviceready', () => {             
            cordova.plugins.pdf.htmlToPDF({
                    data: hContent,
                    documentSize: "A4",
                    landscape: "portrait",
                    type: "base64"
                },
                (sucess) => console.log('sucess: ', sucess),
                (error) => console.log('error:', error));
        });

ionic 2 code any idea ?

musfandi commented 7 years ago

from debug https://firebasestorage.googleapis.com/v0/b/firebase-musshop.appspot.com/o/…a4Gmnb82/pE6sEk7Q.jpg?alt=media&token=5c286dd6-b938-462b-8ca9-79a4713b7156 Failed to load resource: the server responded with a status of 400 (Bad Request)

82%2FpE6sEk7Q.jpg change to 82/pE6sEk7Q.jpg

how to prevent this process process ? So, "/" is actually a seperator, but "%2f" becomes an ordinary character that simply represents "/" character in element of your url.

cesarvr commented 7 years ago

I have found the problem is because of the way I load assets in the webview, I have pushed a new version (1.5.1) an I have tested against your image url and now it should work.

musfandi commented 7 years ago

thanks ... just use encodeURIComponent to firebase image

also work :) but need lot of code change


From: Cesar Valdez notifications@github.com Sent: Tuesday, June 20, 2017 1:02 AM To: cesarvr/pdf-generator Cc: musfandi; Author Subject: Re: [cesarvr/pdf-generator] cannot display image from firebase storage (#32)

I have found the problem is because of the way I use to load assets in the webview, I have pushed a new version (1.5.1) https://www.npmjs.com/package/cordova-pdf-generator an I have tested against your image url and now should work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/cesarvr/pdf-generator/issues/32#issuecomment-309503044, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AD2K3k__EmizBexwxMc9drBlfvt6Ysogks5sFqmggaJpZM4N2S0K.