cesarvr / pdf-generator

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

generating pdf with list of images #42

Closed Yewhenii closed 6 years ago

Yewhenii commented 6 years ago

Is it possible to create such number of pdf pages as amount of images? My generated pdf looks like that

ezgif-1-227e20d892

I want to show one item per page

cesarvr commented 6 years ago

Sure, you just need to style your html with some centre div and predefined margins (top, bottom) and then tune it up using the print preview in Chrome (window.print()), that would give you an idea of the final result.

Yewhenii commented 6 years ago

Thanks for quick answer. Im trying to tune this right now but I hoped there is some tool or feature to make each page separately or make some html template for the one and duplicate for another with different images (something like foreach)

cesarvr commented 6 years ago

Sorry, the plugin is using a offscreen Webkit so basically is a WYSIWYG. :)

mj6uc commented 6 years ago

Hello,

On iOS I am using this as the data: Hello <img src="file:///var/mobile/Containers/Data/Application/6DF0F18C-7063-4993-9194-6949A1F76BE6/Library/NoCloud/C3tuFcdv_photo_004.jpg" width="100%" />Hello <img src="file:///var/mobile/Containers/Data/Application/6DF0F18C-7063-4993-9194-6949A1F76BE6/Library/NoCloud/e62xLcdv_photo_005.jpg" width="100%" />

The image exists at that path. However the PDF comes up with only two "Hello" -- no images. What am I doing wrong?

cesarvr commented 6 years ago

@mj6uc did you try to load the image in Cordova's web browser, like in your index.html ?

mj6uc commented 6 years ago

Yes I can display the image in my template. It displays fine. On Thu, Aug 10, 2017 at 2:15 PM Cesar Valdez notifications@github.com wrote:

@mj6uc https://github.com/mj6uc did you try to load the image in Cordova's web browser, like in your index.html ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cesarvr/pdf-generator/issues/42#issuecomment-321490294, or mute the thread https://github.com/notifications/unsubscribe-auth/AADWXUHYpzVY8RAaAWsARYc-NQNIJvs7ks5sWsMMgaJpZM4OrMsr .

bmagne-bobbies commented 6 years ago

Did you find a solution for your problem @mj6uc ? Facing the same issue right now...

cesarvr commented 6 years ago

@bmagne-bobbies this demo includes an example loading local files