Re: Embedding PDF from file system in webpage

Jean-Paul Rehr <[email protected]> Tue, 14 May 2024 23:21:37 +0200
Newsgroups gmane.text.xml.exist
Message-ID <CALcdGbzsPCy7aRkSnC0wb7RyO+wBekXHz0xtnAHCAY9E=u2z9A@mail.gmail.com>
Dear Tony,

The fact that your file on your file server is accessible to eXist is not
really material, and is a distraction from the root cause of the problem.

Is your  variable $document a URL where the PDF can be accessed via the
web?  If so, that link should work in a browser...so if you copy and paste
it, the file shoud be available? If it is not, then the link is not
correct, or your file server is not configured (with a proxy server) to
serve files to the internet...

eXist is only transmitting a link to the browser via the attribute src;
it's the browser that acts upon the link that is in the attribute.

Cheers,
JPR



On Tue, May 14, 2024 at 10:18 PM 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