Jump to content
TNG Community

display pdf document


DaveP

Recommended Posts

My site uses Template 4 but I have a custom pages which I call from the feature articles on the home page.

I have got used to creating a small image and using a click on it to display a full size image in a new tab, but in this case I want to click the image and display a .pdf document instead.

I can see that the pdf is in the correct directory but when I click the image it creates a new tab with error 404 file not found.
Is this because the TNG can't display a .pdf or is there some special code to enable it.

Any help or workaround appreciated

Link to comment
Share on other sites

ajnsmits

If you type the path from your link into the browser, will the PDF be displayed?

Link to comment
Share on other sites

Rob Severijns

TNG supports the use and display of PDF files.

I can advise you to use the PDFjs Viewer Mod - TNG_Wiki
It opens the PDF file in a separate viewer on the same page and allows scrolling through multiple pages of the PDF document.
I would also encourage you to use the "PDFjs Viewer Mod Hide Buttons" which is incorporated in the downloaded file for it hides selected buttons from view so visitors can't copy, print save or download PDF files from your site.

If you install it you should not forget to set the option to create PDF files for visitors to "No" in Admin >> Trees and the users option for each user to disallow the downloading of PDF files if that's what you want.
Also set the view PDF files to Always in Setup >> Configuration >> General Settings after installation of the mod.

image.png

Link to comment
Share on other sites

Leif Sweden
On 6/9/2026 at 5:18 PM, Rob Severijns said:

TNG supports the use and display of PDF files.

I can advise you to use the PDFjs Viewer Mod - TNG_Wiki
It opens the PDF file in a separate viewer on the same page and allows scrolling through multiple pages of the PDF document.
I would also encourage you to use the "PDFjs Viewer Mod Hide Buttons" which is incorporated in the downloaded file for it hides selected buttons from view so visitors can't copy, print save or download PDF files from your site.

If you install it you should not forget to set the option to create PDF files for visitors to "No" in Admin >> Trees and the users option for each user to disallow the downloading of PDF files if that's what you want.
Also set the view PDF files to Always in Setup >> Configuration >> General Settings after installation of the mod.

image.png

I have tried PDFjs Viewer Mod before and installed it now again but I haven´t been able to figure out how it should work. I have some pdf documents on my pc which I tried to show via the mod on the person page but how do I save the document on the person´s page? Next time I want to show the document I have to pick it up again.

Rob, can you explain how i shall work with that mod.

Leif

Link to comment
Share on other sites

Rob Severijns

Hello Leif,

  1. Upload the pdfjs folder from the extracted Pdfjs_viewer_mod to the TNG root directory.
  2. Put the cfg files in the mod directory and install like any other mod.
  3. If you want to hide the print, save copy buttons ect of the viewer, install pdfjs_viewer_mod_hide_buttons too.
  4. Upload your pdf files to the desicnated folder. Most likely the documents folder.
  5. Link your pdf document to a person and possibly an event linked to the person.
  6. The pdf file should be visible on the person page.
  7. Clicking the pdf file will open the pdf viewer and show the complete pdf file.

See my other remarks above too.

Hope this helps

 

Link to comment
Share on other sites

I'm interested in this too Leif and Rob.

Is it correct that when you install the mod then there is an extra option Under Administration >> Setup >> Configuration >> General Settings >> Media >> Enable pdfjs viewer

Does the mod pdfjs_viewer_mod_hide_buttons hides all the buttons or are there options?

Staf

 

Link to comment
Share on other sites

Leif Sweden
14 hours ago, Rob Severijns said:

Hello Leif,

  1. Upload the pdfjs folder from the extracted Pdfjs_viewer_mod to the TNG root directory.
  2. Put the cfg files in the mod directory and install like any other mod.
  3. If you want to hide the print, save copy buttons ect of the viewer, install pdfjs_viewer_mod_hide_buttons too.
  4. Upload your pdf files to the desicnated folder. Most likely the documents folder.
  5. Link your pdf document to a person and possibly an event linked to the person.
  6. The pdf file should be visible on the person page.
  7. Clicking the pdf file will open the pdf viewer and show the complete pdf file.

See my other remarks above too.

Hope this helps

 

Hello Rob,

I have pdf documents in both Document and Folkräkningar folder but when I click on the pdf documents I get: 

PDF.js v2.4.456 (build: 228a591c)
Meddelande: Missing PDF "https://lein.se/documents/Folkr%C3%A4kning%20Alings%C3%A5s%201880,%20Gerda%20Holmgren%20med%20familj.pdf".

I don´t understand why this happens, I remember that this was why I deleted the mod some years ago.

I also have to say that I have the pdfjs folder in both root directory and mods section (I see now). Do you think I shall delete it from mods?
The cfg file is in mod section. 

When I uninstalled the mod I could see the documents direct in TNG, then everything is dispalayed correctly. So I think I will delete the mod completely.

Link to comment
Share on other sites

Leif Sweden
4 hours ago, Adri1 said:

I'm interested in this too Leif and Rob.

Is it correct that when you install the mod then there is an extra option Under Administration >> Setup >> Configuration >> General Settings >> Media >> Enable pdfjs viewer

Does the mod pdfjs_viewer_mod_hide_buttons hides all the buttons or are there options?

Staf

 

I did set Always when I had installed the mod (not Enable pdfjs viewer). This is only possible when the mod is installed.

The other question I can´t answer.

Leif

 

Link to comment
Share on other sites

Rob Severijns
On 6/13/2026 at 9:36 AM, Adri1 said:

Does the mod pdfjs_viewer_mod_hide_buttons hides all the buttons or are there options?

Yes, you can choose which buttons to show/hide. For that to work you need to edit the pdfjs_viewer_mod_hide_buttons cfg file.
You can show/hide the following buttens: Open, Print, Download, and Bookmark.
Usualy you don't need to edit this file and I would leave it untouched unless you have a specific reason not to.
The settings apply to all users including Admins but Admins have other options to Open, Print, Download, and Bookmark items.

Link to comment
Share on other sites

Rob Severijns
On 6/13/2026 at 10:03 AM, Leif Sweden said:

Do you think I shall delete it from mods?

It doesnt hurt. It hasn't any use there.
When the mod is completely removed will it allow you to view multi-paged pdf documents?
The example I posted above is a pdf file with more than 250 pages. 

Removing the mod will also allow visitors and users of your site able to download Open (localy), Print, Download, and Bookmark your pdf files if not prohibited somewhere else.
If that's no problem you don't need the pdf viewer.

 

Link to comment
Share on other sites

Leif Sweden
12 minutes ago, Rob Severijns said:

It doesnt hurt. It hasn't any use there.
When the mod is completely removed will it allow you to view multi-paged pdf documents?
The example I posted above is a pdf file with more than 250 pages. 

Removing the mod will also allow visitors and users of your site able to download Open (localy), Print, Download, and Bookmark your pdf files if not prohibited somewhere else.
If that's no problem you don't need the pdf viewer.

 

Thanks for your answer. Yes, I can see my own pdf documents without the mod so I will delete it completely.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...