인라인 PDF 미리보기

No i got 3 issue

  1. How to show PDF for everyone “login or not”

  2. Can i show PDFs from external URLs

  3. Why if user click on the PDF link it’s well auto download instead of open it in the URL

1개의 좋아요

Can anyone who is using this component together with iframe lightboxes confirm that they still get the “expand to fullscreen arrows” above the PDF preview?

For reference, it used to work in 2023…

1개의 좋아요

No. It is not available.

2개의 좋아요

Rats - because it would be super helpful.

3개의 좋아요

We use this TC on our site and find it very valuable. Today I created and shared a topic that includes a PDF, and it made this monstrosity: an inline PDF that can be fully navigated from an unfurl.

1개의 좋아요

Is there a way to enable this in select categories? I’m creating a topic that lists a bunch of files and it’s awkward that the PDF is expanded. I’d settle for a manual way to prevent it from triggering, like inserting a special character.

1개의 좋아요

Prevent what from triggering? How would you like the PDF(s) to display in the select categories?

1개의 좋아요

I want a way to block PDFs from being displayed inline. Where blocked, the PDF would look like any other post attachment.

As a simple link? Or as a Onebox? Or?

1개의 좋아요

All you have to do is insert a space before the name in the PDF link and you are away. This isn’t well documented (I’ve just addressed that), but I managed to get that added into the TC for the same reason a while back.

I’d prefer if it was done the same way as Oneboxes - i.e. a space in the markdown before the link, but this works well enough.

7개의 좋아요

Hello

I have this error with the plugin.

Do you have any idea of ​​the origin?

https://forums.ffjdr.org/t/test-dun-pdf-en-visibilite/2691

1개의 좋아요

Does it happen to every PDF or just this one?

Have you tried adding your forum’s domain to allowed internal hosts ?

2개의 좋아요

yes with all PDFs.

I just added it in ‘intern host’ ..no improvement.

Thank you for your advice :slight_smile:

Otherwise I just found this error message in the Chrome console:

initialize-for-pdf-preview.js:84 Refused to frame ‘blob:https://forums.ffjdr.org/79cf20bf-65ac-460f-b0b0-73c10bf85890’ because it violates the following Content Security Policy directive: “default-src ‘self’ data: https:”. Note that ‘frame-src’ was not explicitly set, so ‘default-src’ is used as a fallback.

Not allowed to load local resource: blob:https://forums.ffjdr.org/79cf20bf-65ac-460f-b0b0-73c10bf85890

2개의 좋아요

Check your allowed onebox iframes it should be *

3개의 좋아요

I just installed this component. These are the steps I took to get it installed. My environment is S3 (Digital Ocean Spaces) and CDN (Bunny.net).

Using Chrome developer toolbar (f12) will greatly help in setting this up. Click on the network tab to validate if the pdfs are being stopped by CORS.

Digital Ocean Configuration.

  1. Go to your Spaces Settings and click on Add CORS Configurations
  2. Settings:
Origin:   Your discourse URL - use full https://discourse.url
Allowed Methods:  GET and HEAD
Add the following headers:
      Access-Control-Allow-Methods 
      Access-Control-Allow-Origin
      Origin
      Range
Access Control Max Age: 0
  1. My screen looked like this:

  2. Save and validate via main screen.

CDN (Bunny.net) Configuration

I had to tell the CDN to deliver CORS headers for the filetype *.pdf

  1. Select your CDN and look for the option for Headers.
  2. Turn on “Add CORS Headers”
  3. Add PDF to the file extension
  4. Save.

After I did these two setups, everything was working great.

You might have a different set of tools, but this might help you trouble shoot/solve any problems you may have.

2개의 좋아요

I am referring to an additional “open in new Tab” option for inline PDFs. I figure @nathank never found the time?

This is still a pressing issue for us, using discourse as an enterprise intranet.

1개의 좋아요

바빠졌고, 저는 아마추어 수준이라 시간이 오래 걸릴 거예요. 그래서 그 뒤로는 다른 일을 하러 갔죠…

Contribute > Feature 채널에서 구체적으로 언급하거나, 개발자에게 비용을 지불해 PR을 진행하도록 하는 것도 도움이 될 수 있습니다.

2개의 좋아요

I got a deprecation notice for this great theme component in the developer console of the browser:

[THEME 30 ‘PDF previews’] Deprecation notice: Accessing site.mobileView or site.desktopView during the site initialization can lead to errors and inconsistencies when the browser window is resized. Please move these checks to a component, transformer, or API callback that executes during page rendering. [deprecated since Discourse 3.5.0.beta9-dev] [deprecation id: discourse.static-viewport-initialization] [info: Designing for Different Devices (Viewport Size, Touch/Hover, etc.)]

3개의 좋아요

I’ve addressed the above deprecation notice in my PR in this feature request, which improves the behaviour of the PDF links so they always open in a new tab - this addresses several of the concerns up the topic.

Basically, it means that on mobile there is now one-tap access to the pdf content (before it was multiple taps / wait / etc), as well as in desktop situations where this is desired.

It is a bit naughty combining a fix and a new feature, but I needed to modify the detection of mobile to change the behaviour.

5개의 좋아요

will there PDF preview inline on desktop still?