N K
N K

Reputation: 3327

Use javascript in PDF using flyingsaucer

Is there any way to use javascript in (to show a immediate Print Dialog on opening document) PDF generated using flying saucer?

Upvotes: 1

Views: 3225

Answers (1)

Jericho
Jericho

Reputation: 10953

Please check this link,(Page 14 of 27) which states that you can't and this is one of the Limitations of Flying Saucer.

Where the Saucer Does not Fly (what it can't do)

Being honorable people, we must admit what Flying Saucer cannot do for you. This list applies to the current release when this document was written, R8.

Limitations:

Resource loading is single-threaded and occurs inline with layout. There are extension points where you may insert background loading.

Support for XHTML is weaker than XML+CSS (for example, not all XHTML presentational attributes are supported nor are X/HTML features like the element).

No support for legacy or "street" HTML, although there are several open source Java HTML cleaners of varying quality available. We render well-formed XML; XHTML is a well-formed XML document which uses a special set of tags. We can't render most HTML "in the wild". At best, you can "clean up" old HTML with TagSoup or JTidy or similar library and hope for the best. But without a bunch of work, you won't be able to use Flying Saucer for a real web browser component. However, note that's not a technical limitation, just a lack of time and resources. Swing printing is supported, but quality is lacking. Ask on the mailing list for details.

No support for incremental layout (applies to screen media only).

It cannot be used for user-editable content; output is read-only.

HTML plugins, like applets, Flash programs, etc. are not supported. However, these could potentially be addressed using replaced element content (such as we use for HTML forms), at least for Java applets.

Scripting (e.g. JavaScript) is not supported. We ignore script tags. This could probably be added, at least for simple cases (e.g. JS that doesn't modify the DOM) by hooking in calls to the Rhino JS implementation.

Dynamic changes to the content requires a reload of the document (quick, but noticeable), that is, you can't dynamically change the DOM and see results live.

Most DOM callbacks used in JavaScript are not yet implemented (@onLoad@, onClick, onBlur, etc.).

Upvotes: 3

Related Questions