Template:PrintMultiplePagesForm

    Table of contents
    No headers
    /* Please adjust the Admin parameters according to your Installation (you can as well just delete the language parts
    to have a shorter template) */
    
    /* Input parameters */
    var defaulttext = 'Guide';                         // localized version of "Guide" or similar
    var linkText    = $text ?? $0 ?? $defaulttext;
    var static      = $stat ?? $1 ?? 0;                    // present a link ('1') or not ('0')
    
    /* Admin paramaters */
    var printpagepath = 'Developer_Contents/Sandbox/Printmerges';        // path to the Dummy page that joins multiple pages
    var language      = 'english';                          // default is english
    var imagepath     = 'http://developer.mindtouch.com/@api/deki/files/6019/=pdficon_small.gif'; // path to "pdf image"
    var printtext     = 'Path to print: '; // localized version of "path to print: "
    var buttonpdf     = 'Print PDF';                     // localized version of "Print PDF"
    var buttonhtml    = 'Print HTML';                    // localized version of "Print HTML"
    
    var pid      = wiki.getpage(printpagepath).id;
    <html><head>
        <script type="text/javascript">"
            $(document).ready(function(){
                $(\"#saveaspdf\").click(function(){
                    window.location = '/@api/deki/pages/'+"..pid.."+'/pdf?path=' + escape('"..page.path.."');
                    return false;
                });
                $(\"#submit_pdf\").click(function(){
                    var PrtParent   = $('#PrintParent').val();
                    window.location = '/@api/deki/pages/'+"..pid.."+'/pdf?path=' + escape(PrtParent);
                    return false;
                });
                $(\"#submit_html\").click(function(){
                    var PrtParent   = $('#PrintParent').val();
                    window.location = '"..printpagepath.."' + '?action=print&path=' + escape(PrtParent);
                    return false;
                });
            });
        "</script>
    </head></html>
    if (static == 1) {    
        var clinktxt;
        if (language == 'german') {
            let clinktxt = "Speichere "..linkText.." als .PDF";
        } else {
            let clinktxt = "Save "..linkText.." to .PDF";
        }
        <p>
            <a href="#" id="saveaspdf" title=(clinktxt)>
                <img src=(imagepath) style="width: 16px; height: 16px; margin-right: 5px;" alt=(clinktxt) class="internal default" />
                (clinktxt);
            </a>
        </p>
    } else {
        <div style="padding:15px; background-color:#eee; border:2px solid gray;">
            if (language == 'german') {
                <p>'Diese Seite generiert eine .pdf Datei der angegebenen Seite inklusive aller Unterseiten.'</p>;
                <p>'(';<span style="font-weight:bold;">'Beispiel:';</span>' /Pfad/zur/Seite)'</p>;
                <p>'Um einen Link zu dieser Funktion im Wiki hinzuzufügen, fügen Sie bitte die folgende Zeile hinzu:'</p>;
                <p><span style="font-family:'Courier New';" class="plain">'{{PrintMultiplePagesForm()}}'</span></p>;
                <p class="caution">
                    "Aus Seiten, die funktionale Inhalte (z.B. kollabierende Elemente, Tabs, dynamische Inhalte, etc.) enthalten, können möglicherweise keine korrekten .pdf Dateien erzeugt werden. Falls Sie die folgende Fehlermeldung erhalten, enthalten die Seiten, aus denen das .pdf Dokument erzeugt werden soll, möglichweise inkompatible Inhalte.";
                    <br />;
                    <span style="font-style:italic;">;'Internal Error (500) Unable to create PDF for page id: '..(pid)..'. Please verify that Prince is installed and princexml-path is configured.';</span>;
                </p>;
            } else {
                <p>'This page creates a .pdf file of the page (and all sub-pages) at the entered path.'</p>;
                <p>'(';<span style="font-weight:bold;">'Example:';</span>' /Path/To/Page)'</p>;
                <p>'To add a link to a page that will create a .pdf file of that page and all sub-pages, at the top of the root page you wish to print, add the following line:'</p>;
                <p><span style="font-family:'Courier New';" class="plain">'{{PrintMultiplePagesForm()}}'</span></p>;
                <p class="caution">
                    "Pages that include funtional content (collapsing divs, dynamically generated content, etc.) may not work with this tool or the associated GuideToPDF template. If you receive the following error, the pages you are trying to convert to .pdf contain incompatible material.";
                    <br />;
                    <span style="font-style:italic;">;'Internal Error (500) Unable to create PDF for page id: '..(pid)..'.  Please verify that Prince is installed and princexml-path is configured.';</span>;
                </p>;
            }
        </div>;
        <p>&nbsp;</p>
        <form>
            <div class="coloured">(printtext);
                <input size="45" name="PrintParent" id="PrintParent" style="margin-right: 10px;"> </input>
                <input type="submit" id="submit_pdf" value=(buttonpdf) style="margin-right: 10px; width: 120px;"> </input>
                <input type="submit" id="submit_html" value=(buttonhtml) style="width: 120px;"> </input>
            </div>
        </form>
    }
    Tag page (Edit tags)
    • No tags
    You must login to post a comment.
    Powered by MindTouch Core