PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: Is JavaScript supported?
   PostPosted: 09 Apr 2010, 17:27 
HTML:
Code:
<script>
window.attachEvent("onload", function(){
  // replace id='Text1' innerHTML to "AAA"
})
</script>
...
<span id="Text1" >&nbsp;</span>


IE6 is workable, include print,
I tested Acrobat in the IE's toolbar to transfer page, Text1 printed "AAA" in the PDF, but PDF printed nothing in the Text1 with PD4ML.


  Subject: Re: Is JavaScript supported?
   PostPosted: 09 Apr 2010, 21:36 
PD4ML does not support JavaScript


  Subject: Re: Is JavaScript supported?
   PostPosted: 02 Jul 2013, 01:44 
Is this still true? No javascript support?


  Subject: Re: Is JavaScript supported?
   PostPosted: 02 Jul 2013, 12:29 
We do not plan to natively support JavaScript in PD4ML. Originally PD4ML is not intended for web sites capture; it is to allow you to define PDF layouts with simple well-known languages - HTML/CSS.

In PD4ML use cases JavaScript could be only used to generate some portions of HTML content, as the most of JavaScript "power" (interactivity, animation etc) is not applicable or direct convertible to its target PDF format.

As a drawback JavaScript support would turn PD4ML into a bulky construct (adding JavaScript runtime, DOM structures) and requires quite a serious refactoring of the existing code.

There is a tricky workaround JavaScript-enabled pages. It work only in web scenarios to implement "convert to PDF" button for current page. After JavaScript is evaluated in a web browser and the layout is rendered, the actual dynamic HTML can be captured from the browser and passed to PD4ML.

I've attached a draft, which illustrates it. The form "action" attribute should point to a Java servlet, which takes "source" parameter value (HTML code) and converts it to PDF.


Attachments:
js.htm.zip [1.09 KiB]
Downloaded 799 times

[Reply]     [ 4 posts ] 

cron
Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share