Closed nnylip closed 6 years ago
Thats very strange is this happening in iOS or Android? , can I you paste some of the template code you are using ? Look this example I'm embedding two images.
Thanks for your response. On Android at this point. Attached is the main snippet. The for loops insert the data into the tables. I will check out your example (also)
Do you have further thoughts on this? Using the attached ping, the attached pdf results. It is nearly 626MB. 7 pngs need to be included which would make for a huge file. A pdf created by pdfmake, a javascript library (which is very slow), results in a pdf less than 1MB. Really appreciate your help.
webview.pdf
can you previsualize the html in the browser ? I suspect that could be nested/overlapped images. A good way to debug is to try opening your payload/page in the browser with document.write() or make it a proper HTML document and check the DOM structure looking for overlapps or errors and check network traffic via chrome-tools to measure the page weight. Maybe is a good chance for you to move all that string concatenation to an HTML file an require it using AJAX call.
This was tried with the single png file and it is pretty plain vanilla. Can you try it and see if you get a smaller pdf?
On 07/27/2017 10:24 AM, Cesar Valdez wrote:
can you previsualize the html in the browser ? I suspect that could be nested/overlapped images. A good way to debug to try opening your payload/page in the browser with document.write() https://developer.mozilla.org/en-US/docs/Web/API/Document/write and check the DOM structure looking for overlapps or errors and check network traffic via chrome-tools to measure the page weight. Maybe is a good chance for you to move all that string concatenation to an HTML file an require it using AJAX call.
— 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/40#issuecomment-318377830, or mute the thread https://github.com/notifications/unsubscribe-auth/APNHCg-wAO0Rr9gkvlZ5rRUbdBuzT1KTks5sSJ23gaJpZM4OiuD1.
I have made an example embedding a random number of images and the size is stable, as I mention beforeI think there should be a problem with the DOM structure or compression also the plugin is using behind the scene a webkit to load/render the page so the principle wysiwyg should apply here.
Several tests were used to generate the pdf all of which yielding the large file, one test case was:
...
(pdf.htmlToPDF({
data:'',
documentSize: 'A4',
landscape: 'portrait',
type: 'share'
...
where pdfArray[0] is a base 64 string. I'm, not sure how the DOM comes into play with this example. Can you share the code used to create your example?
On 07/28/2017 07:46 AM, Cesar Valdez wrote:
I have made an example embedding a random number of images and the size is stable, as I mention beforeI think there should be a problem with the DOM structure or compression also the plugin is using behind the scene a webkit to load/render the page so the principle wysiwyg should apply here.
test_default.pdf https://github.com/cesarvr/pdf-generator/files/1182877/test_default.pdf
— 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/40#issuecomment-318631601, or mute the thread https://github.com/notifications/unsubscribe-auth/APNHChMCIMajvnBkotVRkoKTq4xZFq7mks5sScn5gaJpZM4OiuD1.
It appears it is my issue in that I was getting these results with the android emulator. On the actual phone much smaller sizes are being obtained (which might substantiate your DOM comments). Thanks for you help and apologizes for your time. It is shaping up to be a great plugin!
On 07/28/2017 07:46 AM, Cesar Valdez wrote:
I have made an example embedding a random number of images and the size is stable, as I mention beforeI think there should be a problem with the DOM structure or compression also the plugin is using behind the scene a webkit to load/render the page so the principle wysiwyg should apply here.
test_default.pdf https://github.com/cesarvr/pdf-generator/files/1182877/test_default.pdf
— 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/40#issuecomment-318631601, or mute the thread https://github.com/notifications/unsubscribe-auth/APNHChMCIMajvnBkotVRkoKTq4xZFq7mks5sScn5gaJpZM4OiuD1.
Thanks, I'm glad that it work.
I'm creating a pdf that includes two jpgs (~120KB each) and 3 small text tables and the resulting pdf (attached) is 10.8MB (which is quite large as additional jpgs and tables need to be added). Is there an optimization feature available? webview.pdf