Aaron
Aaron

Reputation: 105

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?

Upvotes: 0

Views: 75

Answers (1)

Tony Graham
Tony Graham

Reputation: 8068

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.

Upvotes: 1

Related Questions