B4J Question B4J program (Non-UI) HTML to image

hzq200409

Member
Licensed User
That's because the website doesn't allow CORS. you have to download the img to local.
并不是这样的。因为这个简单的程序是要作为jserver程序的一部分的。因为jserver程序执行环境并不会登录到桌面。而通过很多次实践发现这个小程序在窗体没有实际渲染HTML的时候根本不会生成任何内容的jpg. 通过f.setVisible(false)即可看出端倪。
 

Attachments

  • nonuihtml.zip
    13.1 KB · Views: 129
Upvote 0

stevel05

Expert
Licensed User
Longtime User
It's not ideal. HTML like attachments cannot be displayed.
No, I'm not surprised. That's a big ask, I doubt it would be displayed properly in the Javafx web browser.
 
Upvote 0

hzq200409

Member
Licensed User
No, I'm not surprised. That's a big ask, I doubt it would be displayed properly in the Javafx web browser.
At least it displays in its entirety (except for a slight difference in font size and browser rendering). Acquaintance degree is relatively high).
And here's the problem: JEditorPane doesn't seem to render html properly without logging into the desktop environment. The effect can be seen in the annex on the 22nd floor.
 

Attachments

  • 微信图片_20231025090304.png
    微信图片_20231025090304.png
    109.7 KB · Views: 121
Last edited:
Upvote 0

stevel05

Expert
Licensed User
Longtime User
As you are looking for something that will run in non-ui, you may find an up to date library that can do what you want, but there would probably be a cost for that.
 
Upvote 0

hzq200409

Member
Licensed User
Finally, I chose the html2canvas library of JS to generate it from the front end and then send it back to the server. If anyone implements it in a jserver backend Non-UI environment, please let me know.?
 
Upvote 0
Top