# There has got to be a way to display an already existing pdf file in web

**URL:** <https://forum.xojo.com/t/there-has-got-to-be-a-way-to-display-an-already-existing-pdf-file-in-web/88971>\
**Category:** General\
**Created:** [October 7, 2026, 5:11am UTC](https://forum.xojo.com/t/there-has-got-to-be-a-way-to-display-an-already-existing-pdf-file-in-web/88971 "2026-10-07T05:11:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Scanlan](https://forum.xojo.com/user_avatar/forum.xojo.com/john_scanlan/32/472_2.png) [@John\_Scanlan](https://forum.xojo.com/u/John_Scanlan)\
**Post date:** [October 7, 2026, 5:11am UTC](https://forum.xojo.com/t/there-has-got-to-be-a-way-to-display-an-already-existing-pdf-file-in-web/88971/1 "2026-10-07T05:11:57Z")

</div>

Come on guys . . . . This can’t be impossible.

I can create a pdf and display it, but I can’t seem to display one that already exists

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [October 7, 2026, 5:30am UTC](https://forum.xojo.com/t/there-has-got-to-be-a-way-to-display-an-already-existing-pdf-file-in-web/88971/2 "2026-10-07T05:30:02Z")

</div>

I have [GraffitiPDFViewer](https://demo.graffitisuite.com/#pdfviewer) as part of GraffitiSuite Web Edition.

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [October 7, 2026, 6:18am UTC](https://forum.xojo.com/t/there-has-got-to-be-a-way-to-display-an-already-existing-pdf-file-in-web/88971/3 "2026-10-07T06:18:01Z")

</div>

in my vns fpdf project, you display a pdf in a preview window (in desktop but should be easy to port on other platforms)

> **[GitHub - JYPochez/Xojo-VNS-fpdf-Library: A Xojo port of the popular FPDF library...](https://github.com/JYPochez/Xojo-VNS-fpdf-Library/tree/main)**
>
> main

 ![image](https://forum.xojo.com/uploads/default/original/3X/2/6/266500b79f911974d04f01b0d7f4844850a1f7ba.jpeg)

---

<div class="post-metadata">

**Author:** ![Christian\_Wheel](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_wheel/32/20536_2.png) [@Christian\_Wheel](https://forum.xojo.com/u/Christian_Wheel)\
**Post date:** [October 7, 2026, 7:01am UTC](https://forum.xojo.com/t/there-has-got-to-be-a-way-to-display-an-already-existing-pdf-file-in-web/88971/4 "2026-10-07T07:01:37Z")

</div>

I haven’t tested this so I’m only speculating, but can you not open it in a WebHTMLViewer (or target a \_blank window), and use HandleURL to send it with mime type “application/pdf”?

---

<div class="post-metadata">

**Author:** ![Andrew\_Paul\_Dickey](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@Andrew\_Paul\_Dickey](https://forum.xojo.com/u/Andrew_Paul_Dickey)\
**Post date:** [October 7, 2026, 7:41am UTC](https://forum.xojo.com/t/there-has-got-to-be-a-way-to-display-an-already-existing-pdf-file-in-web/88971/5 "2026-10-07T07:41:35Z")

</div>

@John_Scanlan,

You can display an existing PDF file in the HTMLViewer using HTMLViewer.LoadURL.

It works a bit differently depending on where your file lives.

If your PDF lives on a CDN (for those with 1,000s of PDFs), you would simply call (after authenticating for private CDNs).

```auto
HTMLViewer1.LoadURL("https://somedomain.somecdn.net/sample.pdf")

```

If you have a finite number of files you likely use the file system on your deployment platform, be that Xojo Cloud or other web server. The files are stored in SpecialFolders see [SpecialFolder — Xojo documentation](https://documentation.xojo.com/api/files/specialfolder.html).

If you have had some issues to date loading existing PDF files, I expect the files are going out of scope before you can load them.

On the web page containing your HTMLViewer, create a Property (to maintain scope):

Name = PDFFile  
Type = WebFile  
Scope = Private

Say your Debug Build is on Mac:

- place a PDF (sample.pdf) into your Documents folder
- in the Opening event of your HTMLViewer add the following (or similar code):

```auto
Var documentsFolder As FolderItem = SpecialFolder.Documents

If documentsFolder = Nil Then
  MessageBox("The Documents folder is unavailable.")
  Return
End If

Var pdf As FolderItem = documentsFolder.Child("sample.pdf")

If Not pdf.Exists Then
  MessageBox("sample.pdf was not found in the Documents folder.")
  Return
End If

Try
  PDFFile = WebFile.Open(pdf)
  PDFFile.MIMEType = "application/pdf"
  PDFFile.FileName = "sample.pdf"
  PDFFile.ForceDownload = False
  
  HTMLViewer1.LoadURL(PDFFile.URL)
  
Catch e As IOException
  MessageBox("Unable to open the PDF: " + e.Message)
End Try

```

- run and check if the PDF loads

I tested CDN, local (debug), and Xojo Cloud implementations.

All that said, we use/recommend GraffitiSuite and generally use GraffitiPDFViewer as it has a nicer PDF implementation (and is more feature rich), than the HTMLViewer in respect of PDF functionality.

However in answer to your original question - there is a way.

I hope that helps.

Kind regards, Andrew

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [October 7, 2026, 7:44am UTC](https://forum.xojo.com/t/there-has-got-to-be-a-way-to-display-an-already-existing-pdf-file-in-web/88971/6 "2026-10-07T07:44:00Z")

</div>

sorry for my post above it is for desktop, and I did not see you asked for web.  
but in your other post, I answered with my new web project for using mozilla pdf.js  
it works fine with web projects, and can display url, local, pdf.

> [@Getting started with PDF documents in web project](https://forum.xojo.com/t/getting-started-with-pdf-documents-in-web-project/80990/6):
>
> this should answer your question…

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [October 7, 2026, 8:16am UTC](https://forum.xojo.com/t/there-has-got-to-be-a-way-to-display-an-already-existing-pdf-file-in-web/88971/7 "2026-10-07T08:16:59Z")

</div>

if you have the [MBS Xojo DynaPDF Plugin](https://www.monkeybreadsoftware.de/xojo/plugin-dynapdf.shtml) with a Pro license, you can render the PDF pages as pictures and show them.

This way users can see them, but not get the PDF saved in the browser unless you explicitly code that.

---

<div class="post-metadata">

**Author:** ![John\_Scanlan](https://forum.xojo.com/user_avatar/forum.xojo.com/john_scanlan/32/472_2.png) [@John\_Scanlan](https://forum.xojo.com/u/John_Scanlan)\
**Post date:** [October 8, 2026, 10:25pm UTC](https://forum.xojo.com/t/there-has-got-to-be-a-way-to-display-an-already-existing-pdf-file-in-web/88971/8 "2026-10-08T22:25:05Z")

</div>

This code matches, but it’s not showing (in debug mode):

var f as folderItem = app.helpFiles.child(“Notes - Login.pdf”)

If f \<\> nil And f.exists Then  
try  
var pdfFile as webFile = webfile.open(f)  
pdfFile.mimeType = “application/pdf”  
pdfFile.fileName = “Notes - Login.pdf”  
pdfFile.forceDownload = false  
w.d.notes.pdf.loadURL(pdfFile.URL)  
w.d.notes.pdf.visible = true
