allcolor / YaHP-Converter

YaHP is a Java library that allows you to convert an HTML document into a PDF document.
GNU Lesser General Public License v2.1
56 stars 23 forks source link

Gettin Index Out Of Bounds Exception while converting an HTML to PDF #48

Open AakashK03 opened 7 years ago

AakashK03 commented 7 years ago

Hi ,

I am getting following exception while trying to convert an html to PDF. Initializing... Installing new URLStreamHandlerFactory... Installing new URLStreamHandlerFactory DONE. init time: 47 0 [main] ERROR org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer - java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 ERROR: An unhandled exception occured: Index: 0, Size: 0 Destroying YAHP ClassLoader Tree

allcolor commented 7 years ago

Hi,

what is the html ?

Please note, YahpConverter is not developed anymore, so no patch will ever be made.

Please ensure your html is correct.

Regards.

2016-11-15 8:21 GMT+01:00 AakashK03 notifications@github.com:

Hi ,

I am getting following exception while trying to convert an html to PDF. Initializing... Installing new URLStreamHandlerFactory... Installing new URLStreamHandlerFactory DONE. init time: 47 0 [main] ERROR org.allcolor.yahp.cl.converter. CHtmlToPdfFlyingSaucerTransformer - java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 ERROR: An unhandled exception occured: Index: 0, Size: 0 Destroying YAHP ClassLoader Tree

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/48, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJ5B-hgMJ0aIU6TqIppZF8D2h63hKS3ks5q-V1vgaJpZM4KyNFK .

All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)

AakashK03 commented 7 years ago

Hi , Thanks for prompt response.

The HTML snapshot is attached herewith. Please let me know if this can work OR any modifications are required to make this work.

image

image

image

allcolor commented 7 years ago

Hi, could you copy/paste the html text, instead of sending me screenshots, I won't type it to test...

Please note no script is ever executed, your page seems to be tied with jquery, that won't be executed.

At the same time you could also post the exception with full stacktrace.

Regards

2016-11-15 10:28 GMT+01:00 AakashK03 notifications@github.com:

Hi , Thanks for prompt response.

The HTML snapshot is attached herewith. Please let me know if this can work OR the modifications required to make this work.

[image: image] https://cloud.githubusercontent.com/assets/23471511/20300167/da9b211e-ab43-11e6-9086-3dc073940b34.png

[image: image] https://cloud.githubusercontent.com/assets/23471511/20300174/e5b2985c-ab43-11e6-95a6-8bb9a70d2fcd.png

[image: image] https://cloud.githubusercontent.com/assets/23471511/20300176/ec512c82-ab43-11e6-96c5-a95ab97b4755.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/48#issuecomment-260590658, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJ5B28DM03Vt-A1gV_uYXw-X8bO1DHUks5q-XszgaJpZM4KyNFK .

All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)

AakashK03 commented 7 years ago

Hi,

I have attached the zip. In this what I am trying to do is , convert : "osm-print.html" . You may open it in Mozilla to see how the file opens. 04AB.zip

Also the console is showing only this much as in console. image

As per your statement, JavaScript code is not executed, could there be a workaround you can suggest for this.

Thanks in advance .

allcolor commented 7 years ago

Could you put the logging to debug ?

2016-11-15 11:19 GMT+01:00 AakashK03 notifications@github.com:

Hi,

I have attached the zip. In this what I am trying to do is , convert : "osm-print.html" . You may open it in Mozilla to see how the file opens. 04AB.zip https://github.com/allcolor/YaHP-Converter/files/591623/04AB.zip

Also the console is showing only this much as in console. [image: image] https://cloud.githubusercontent.com/assets/23471511/20301817/eda20258-ab4a-11e6-967c-8014726c99b5.png

As per your statement, JavaScript code is not executed, could there be a workaround you can suggest for this.

Thanks in advance .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/48#issuecomment-260602881, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJ5By0T91UMripQ_W9ZVMBMqc5Az1xRks5q-YcugaJpZM4KyNFK .

All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)

allcolor commented 7 years ago

For javascript, there is no workaround... the converter convert static html only.

Regards.

2016-11-15 11:54 GMT+01:00 Quentin Anciaux allcolor@gmail.com:

Could you put the logging to debug ?

2016-11-15 11:19 GMT+01:00 AakashK03 notifications@github.com:

Hi,

I have attached the zip. In this what I am trying to do is , convert : "osm-print.html" . You may open it in Mozilla to see how the file opens. 04AB.zip https://github.com/allcolor/YaHP-Converter/files/591623/04AB.zip

Also the console is showing only this much as in console. [image: image] https://cloud.githubusercontent.com/assets/23471511/20301817/eda20258-ab4a-11e6-967c-8014726c99b5.png

As per your statement, JavaScript code is not executed, could there be a workaround you can suggest for this.

Thanks in advance .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/48#issuecomment-260602881, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJ5By0T91UMripQ_W9ZVMBMqc5Az1xRks5q-YcugaJpZM4KyNFK .

All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)

All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)

allcolor commented 7 years ago

Try also removing everything in the header section except style and link to stylesheet elements.

2016-11-15 11:54 GMT+01:00 Quentin Anciaux allcolor@gmail.com:

For javascript, there is no workaround... the converter convert static html only.

Regards.

2016-11-15 11:54 GMT+01:00 Quentin Anciaux allcolor@gmail.com:

Could you put the logging to debug ?

2016-11-15 11:19 GMT+01:00 AakashK03 notifications@github.com:

Hi,

I have attached the zip. In this what I am trying to do is , convert : "osm-print.html" . You may open it in Mozilla to see how the file opens. 04AB.zip https://github.com/allcolor/YaHP-Converter/files/591623/04AB.zip

Also the console is showing only this much as in console. [image: image] https://cloud.githubusercontent.com/assets/23471511/20301817/eda20258-ab4a-11e6-967c-8014726c99b5.png

As per your statement, JavaScript code is not executed, could there be a workaround you can suggest for this.

Thanks in advance .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/allcolor/YaHP-Converter/issues/48#issuecomment-260602881, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJ5By0T91UMripQ_W9ZVMBMqc5Az1xRks5q-YcugaJpZM4KyNFK .

All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)

All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)

All those moments will be lost in time, like tears in rain. (Roy Batty/Rutger Hauer)

AakashK03 commented 7 years ago

Hi Quentin,

Thanks your for your replies. I have managed to get rid of all Java Script and now the error mentioned in the title of this thread is also gone. How ever I am facing following issues -

1) I have attached the non-js version HTML, which is getting converted to pdf (also attached). The Input and Output is having some css issues, at the end of the HTML/PDF. Please let me know how to resolve them.

2) My Page has some annotation , images which are super imposed , which still are not being rendered in the PDF. (Refer at the last of HTML and Page 23 of the pdf)

3) The program converts the PDF successfully , but after following loggers, the program is not getting terminated- _

Initializing...

Installing new URLStreamHandlerFactory... Installing new URLStreamHandlerFactory DONE. init time: 1 Destroying YAHP ClassLoader Tree

After this nothing is getting printed and the program is not getting terminated.

-Thanks & Regards, Aakash Khandelwal.

New_test_1.zip _