简体   繁体   中英

Does Antenna House 6.6 support HTML DOM classList toggling?

I have recently begun reading through the DITA 1.3 specification pdf (around 1300 pages). To save on eye strain I've set Adobe Reader to a dark theme. It seems simple, but some of the people I write documentation for aren't as knowledgeable with computers.

So I was curious - is there a way to toggle a dark theme using JavaScript (or similar) just by clicking a button in a PDF? By my company's rules I have to supply a document with white pages and black text - a dark theme only output would not be allowed. But a toggle-able output might be acceptable.

The JavaScript below works fine in HTML, but I am struggling to get it working in PDF when publishing through Antenna House (V6.6 CSS).

<script>
    function myFunction() {
        var element = document.body;
        element.classList.toggle("dark-mode");
    }
</script> 

I have tried using buttons and anchors with onclick functions as well as the Antenna House 'set action':

<meta name="openaction" content="#JavaScript=            
    var f = this.getField('backButton');      

    f.setAction(
    'MouseUp', 
    'myFunction();'
    );">

Neither have worked; is it even possible?

In your PDF, JavaScript execution is determined by what the PDF spec defines and/or what your PDF reader supports. I don't know how to do what you want to do, but it's passed beyond the control of AH Formatter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM