Search code examples
htmlpdfantenna-house

Add 'back'/'previous view' button to HTML that will be converted to PDF


I have been asked to add 'TOC' and 'Back' buttons to HTML files which output as PDF using Antenna-House formatter.

The 'TOC' button navigates to the table of contents-this is simple enough to do. The 'Back' button should navigate to the view prior to clicking the 'TOC' button and it is this I am struggling with.

I can get the back button to work using JavaScript with the HTML file prior to conversion. But JavaScript does not work in the output PDF.

Anything else I use I get an error message 'file not found' or 'unexpected end of line feed'.

The PDF viewer my company has does have back buttons but they are not as easily accessible as a button on the PDF would be.

Is it possible to do this?


Solution

  • You can specify some JavaScript to run when the document opens (see "openaction" in https://www.antenna.co.jp/AHF/help/en/ahf-ext.html#axf.document-info) and you can specify JavaScript for a form field event (see https://www.antenna.co.jp/AHF/help/en/ahf-ext.html#form-action).

    What the JavaScript can do will depend on the JavaScript capability of the PDF viewer, not on AH Formatter. You may be able to make a one-button form that runs JavaScript that instructs the PDF viewer to return to the previous view, but I've never tried it.