Re: Embedding PDF from file system in webpage

Claudius Teodorescu <[email protected]> Tue, 14 May 2024 23:45:59 +0300
Newsgroups gmane.text.xml.exist
Message-ID <CAPTZ0VwSRMb1jaUGV5hehuuae0CE8d1MonAPQap7nghXrmhZyQ@mail.gmail.com>
Separate fileserver (see https://caddyserver.com/) for those big PDFs.



On Tue, 14 May 2024, 23:18 Tony Corless via Exist-open, <
[email protected]> wrote:

> 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
>

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