We have started usingto convert html page to images - from the web application , and we are encountering these issues -
1. We want to run thecommand synchronously as we have to process the image by another tool after it is generated by htmltools. We are noticing that the htmltools returns immediately and does not wait till the conversion is complete.
2. the conversion runs successfully from the command line, but always fails from the web application with exit code of 1. Our web app is tomcat/java based.
3. We want to retain the aspect ratio of the generated image by keeping the larger side to 1000 pixels and adjusting other side accordingly. In image-magick it does that automatically, but I am not sure how to do that in veryPDF.
>>1. We want to run the htmltools command synchronously as we have to process
>>the image by another tool after it is generated by htmltools. We are noticing
>>that the htmltools returns immediately and does not wait till the conversion
htmltools.exe doesn't return until conversion be done completely. You can run htmltools.exe and monitor it in Task Manager, you will notice that htmltools.exe will keep running until conversion be done completely.
>>2. the conversion runs successfully from the command line, but always fails
>>from the web application with exit code of 1. Our web app is tomcat/java
This is caused by permission settings of the tomcat/java account, please run htmltools.exe from Administrator user account instead of default SYSTEM user account, then you will get it work properly.
>>3. We want to retain the aspect ratio of the generated image by keeping the >>larger side to 1000 pixels and adjusting other side accordingly. In
>>image-magick it does that automatically, but I am not sure how to do that
You can use htmltools.exe to convert web page to image file first, and then use ImageMagick to resize the image again, if so, you can control the page width and height easily.
After your response, we spent some time, and here is the issue and other observations -
The command for website to image conversion such as:
htmltools http://www.verypdf.com/ G:/Temp/VP_6333885864943827995.jpg
does not work from the java web app (that runs under tomcat). The execution keeps spinning for ever, as if it is waiting for some input or something. We also tried passing registration key as parameter.
Following things work on the same server -
- Above command (htmltools http://www.verypdf.com/ G:/Temp/VP_6333885864943827995.jpg) works fine from command prompt
- This command also works fine from a standalone java program
- Within java web app, we tried other commands such as just 'htmltools' or 'htmltools xxx yyy' or trying with -java params etc, and they all work fine by going to completion.
To summarize, the htmltools command that converts a website URL to image does not work from java web app.
Is it waiting for some input?
Is it looking for some proxies or something that it does not find?
We put a watchdog to kill the java execution after waiting for 5 minutes, and tried to dump stdout and stderr streams, but there is nothing out there.
This is an important part of our product, and without this we cannot proceed further, so please let us know what we should try or any pointers from you.
Sorry, this issue is resolved. It worked with proper 'Administrator' permissions to the tomcat service.
Thank you for your message, if we can be of any other assistance, please feel free to let us know.
Thank you and have a nice day!