Embedding PDF from file system in webpage

Tony Corless via Exist-open <[email protected]> Tue, 14 May 2024 16:43:13 +0000
Newsgroups gmane.text.xml.exist
Message-ID <DB9PR06MB8043F2015F869B72DBC614C7D1E32@DB9PR06MB8043.eurprd06.prod.outlook.com>
Apologies for bothering people, as the answer to this perhaps should be obvious to me.

For a while I have been using a query, as below, to display PDF documents with some header information that is stored as XML data in eXist.
To date, the PDFs have been small and stored in the eXist database or accessed from a remote server.

Now I have some much larger PDF documents that ideally I will keep in the local file system rather than in the database.
To achieve that I need to change the source in the <embed> below to access the document from the file system.

While I assumed that would be trivial my attempts to date have failed. Any pointer to the correct approach is welcome, as clearly I have misunderstood something.

(The file:exists function has confirmed that I have correct and accessible files in the file system, I can read these but have failed to render them as PDF.)


xquery version "3.1";
declare option exist:serialize "method=html media-type=text/html";
(: declare variable $documentName := request:get-parameter("documentName",()); :)

let $documentName :="1021-COP"

let $xmlCollection := collection("/db/apps/controlledDocuments/data/current")
let $document :=$xmlCollection[./document/documentName=$documentName]/document/documentLink

return
    <html>
        <body>
            <h1>Some info about {$documentName}</h1>
            <embed src='{$document}' style="width:100%;height:90%;"></embed>
        </body>
    </html>


Many thanks for any assistance.

Tony Corless

_______________________________________________
Exist-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/exist-open