Project

General

Profile

Actions

Support #11276

closed

unable to embed PDF with PDF Embedder

Added by scott voth about 5 years ago. Updated almost 5 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
-
Category name:
WordPress Plugins
Target version:
-
Start date:
2019-03-27
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

Stefania Porcelli is trying to embed a PDF in a page using PDF Embedder.She is getting message "PDF must be on exactly the same domain as current webpage" (see attached screenshot).

For some reason, I noticed that the media is getting uploaded to a subfolder called /resources/ (see second attached screenshot).

Stefania tried to upload it again and it went into that subfolder again.


Files

pdf msg.png (41.2 KB) pdf msg.png scott voth, 2019-03-27 01:08 PM
pdf in media library.png (161 KB) pdf in media library.png scott voth, 2019-03-27 01:11 PM
Actions #1

Updated by scott voth about 5 years ago

Forgot to give you the site - https://divinecomedy19.commons.gc.cuny.edu/

Actions #2

Updated by Boone Gorges about 5 years ago

  • Status changed from New to Reporter Feedback

My guess is that you've used the /resources/ URL (the WP URL) instead of the actual file URL (eg https://divinecomedy19.commons.gc.cuny.edu/wp-content/blogs.dir/6471/files/2019/03/sayers_the-meaning-of-purgatory.original.pdf). Can you try that, or barring that, can you please share the Dashboard URL of a post where you've attempted to perform the embed so that I can look myself?

Actions #3

Updated by scott voth about 5 years ago

Hi Boone - I asked to become an admin of the site and created a page where this happens: https://divinecomedy19.commons.gc.cuny.edu/test-pdf/

I don't see that /resources/ subfolder that I saw on her screenshot - it seems to be going to the actual file URL in my example. And the PDF does download from there.

Actions #4

Updated by Boone Gorges about 5 years ago

Thanks, Scott. It looks like this is an incompatibility between PDF Embedder and the Hypothesis plugin. Hypothesis greedily tries to hijack each PDF link on the page, pointing the links toward the Hypothesis mirror. This is why it's setting off the cross-domain browser warnings.

I've just put a hotfix in place to test a compatibility fix. Because I'm not very familiar with the way that Hypothesis PDF linking is supposed to work, I wonder if you, Scott, might test around the Commons to see if that feature of Hypothesis is working elsewhere as expected?

Posting the diff below for my info (wp-content/mu-plugins/js/cac-via-pdf.js)

 for ( i=0; i<anchors.length; i++ ) {
    var href = anchors[i].href;
    if ( href.match(hypRe) )
-       anchors[i].href = 'https://via.hypothes.is/' + anchors[i].href;
+                // Exception for pdf-embedder links.
+                if ( -1 !== anchors[i].className.indexOf('pdfemb-viewer') ) {
+                        continue;
+                }
+
+     anchors[i].href = 'https://via.hypothes.is/' + anchors[i].href;
   }
Actions #5

Updated by scott voth about 5 years ago

Thanks Boone! I will investigate Hypothesis PDFs on my test site. I also asked Stefania to report if she sees any odd behavior with Hypothesis.

Actions #6

Updated by Boone Gorges almost 5 years ago

Hi Scott - Any feedback from the user about this?

Actions #7

Updated by scott voth almost 5 years ago

  • Status changed from Reporter Feedback to Resolved

Everything is fine now with this issue. I haven't heard of any problems.

Actions

Also available in: Atom PDF