cesarvr / pdf-generator

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

Problem saving 20 page html #50

Closed sengmow closed 6 years ago

sengmow commented 6 years ago

I have a screen that is around 20 pages long that contains many images. On calling htmlToPDF the normal pdf "preparing preview" screen would come on. After more than 5 minutes, the pdf preview is displayed or the "preparing preview" window could close without showing the preview. Is there a limit to the number or pages or number of images that can be in the html? I tried and successfully save a 4 page long html with images to pdf.

I have been testing on Galaxy S7.

cesarvr commented 6 years ago

No, there is no such limitation, I have tried the example app with nytimes.com and I was able to render 22 pages in (Android 7.1 & Android 6.1). That example is not the best scenario as I can get better result by caching the assets manually in the phone first or by having the assets in a dedicated server .

are your page assets in the network or local. ? what is the volume ?

sengmow commented 6 years ago

Thanks for your quick response.

The assets are local on the mobile. However, I have about 30 high resolution images in the html (e.g. img src="file:///storage/emulated/0/Download/sample.jpg") and the list is growing.

On Fri, Oct 20, 2017 at 5:43 PM, Cesar Valdez notifications@github.com wrote:

No, there is no such limitation, I have tried the example app https://github.com/cesarvr/pdf-generator-example with nytimes.com and I was able to render 22 pages in (Android 7.1 & Android 6.1). That example is not the best scenario as I can get better result by caching the assets manually in the phone first or by having the assets in a dedicated server .

are your page assets in the network or local. ? what is the volume ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cesarvr/pdf-generator/issues/50#issuecomment-338159003, or mute the thread https://github.com/notifications/unsubscribe-auth/AQko8H4Bi0KHm5BpumSmUJMMP8qWNhMhks5suGs-gaJpZM4QAYdw .

-- Chants Keeper for Android https://play.google.com/store/apps/details?id=sa.chants.keeper

cesarvr commented 6 years ago

I have added in the example app, 33 tags of a 4k image , and everything is going fine. One suggestion, you can use the example app and point your image to a static server and see what happens.

sengmow commented 6 years ago

Thanks I will test it.

My images are photos of 4 to 8Mb. Also, depending on the pic orientation some needed transformation to turn 90 or 180 etc. I think the combination of image size and orientation is creating the problem. I will do some experiment to confirm.

To display the same html on the Android app takes 2 to 3 seconds.

On 20 Oct 2017 10:54 pm, "Cesar Valdez" notifications@github.com wrote:

I have added in the example app https://github.com/cesarvr/pdf-generator-example, 33 tags of a 4k image https://i.ytimg.com/vi/xcJtL7QggTI/maxresdefault.jpg , and everything is going fine. you can test it. Also you can use the example app https://github.com/cesarvr/pdf-generator-example and point your image to a static server and see what happens.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cesarvr/pdf-generator/issues/50#issuecomment-338230064, or mute the thread https://github.com/notifications/unsubscribe-auth/AQko8AGHWXN8LkAWr-NOuk5ceIfANd6iks5suLQXgaJpZM4QAYdw .

sengmow commented 6 years ago

It appears to be transformations of large pics (to orientate them correctly) in the html is causing significant delay during the processing to pdf. I will have to figure out alternative perhaps transform the pictures first prior to saving to pdf.

BTW, is there a way to bypass the "preview" and go straight to saving the pdf?

Thanks.

On Fri, Oct 20, 2017 at 11:15 PM, sengmow sengmow@gmail.com wrote:

Thanks I will test it.

My images are photos of 4 to 8Mb. Also, depending on the pic orientation some needed transformation to turn 90 or 180 etc. I think the combination of image size and orientation is creating the problem. I will do some experiment to confirm.

To display the same html on the Android app takes 2 to 3 seconds.

On 20 Oct 2017 10:54 pm, "Cesar Valdez" notifications@github.com wrote:

I have added in the example app https://github.com/cesarvr/pdf-generator-example, 33 tags of a 4k image https://i.ytimg.com/vi/xcJtL7QggTI/maxresdefault.jpg , and everything is going fine. you can test it. Also you can use the example app https://github.com/cesarvr/pdf-generator-example and point your image to a static server and see what happens.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cesarvr/pdf-generator/issues/50#issuecomment-338230064, or mute the thread https://github.com/notifications/unsubscribe-auth/AQko8AGHWXN8LkAWr-NOuk5ceIfANd6iks5suLQXgaJpZM4QAYdw .

-- Chants Keeper for Android https://play.google.com/store/apps/details?id=sa.chants.keeper