cfjedimaster / eleventy-plugin-pdfembed

Eleventy plugin for Adobe's PDF Embed API
0 stars 1 forks source link

Adobe requires migration from legacy to "modern" viewer #2

Closed SummittDweller closed 1 year ago

SummittDweller commented 1 year ago

I just started using this plug-in in a new Eleventy site and Adobe is prompting me to "Please update your PDF Embed API viewer". When I open their Migration Guide I found this:

To migrate over Adobe's new modern PDF viewer, developers are required to use [viewer.js](https://documentservices.adobe.com/view-sdk/viewer.js) script (line 11) in place of the previously used [main.js](https://documentservices.adobe.com/view-sdk/main.js) script. All APIs and callbacks will work as expected with significant improvement in user experience.

I've forked this repo to try and update per the migration instructions, and I'll report back here if/when I have something.

cfjedimaster commented 1 year ago

In theory it should only be changing the url, nothing more. :) If you haven't started it, I can fix it in main quickly enough.

SummittDweller commented 1 year ago

Sounds right to me, and no, I haven't started anything yet. Thanks! My site is coming from a Hugo instance where I was using pdf.js so I've also been looking into using that for display.

cfjedimaster commented 1 year ago

I committed the change directly, no testing, cuz I live on the edge. Let me know. :)

SummittDweller commented 1 year ago

I like the edge too. Be happy to give it a test, but I'm new to 11ty so can you tell me how I update my local site to the latest version of this package? I tried npm i eleventy-plugin-pdfembed --save in my project directory and then npm run build followed by npm run start but that didn't appear to do anything useful (no change to my package.json).

cfjedimaster commented 1 year ago

There is probably a better way, but I'd npm uinstall it, then npm install it. Oh wait, I didn't update npm yet. Give me a few minutes (stuck in a boring meeting).

SummittDweller commented 1 year ago

Belay that order, mate! I did npm i https://github.com/cfjedimaster/eleventy-plugin-pdfembed, gave it a test, and it worked perfectly! Thank you so much for the quick action on this! Awesome response!

Ok, now feel free to update npm at your leisure. Thanks again.

cfjedimaster commented 1 year ago

Heh I didn't even know npm could install from a repo! Thank you!

cfjedimaster commented 1 year ago

FYI, I'm going to edit the version in package.json, so technically your copy will not be 100% up to sync, but no need to do anything else I think.

SummittDweller commented 1 year ago

I'm learning too. Got that install-from-GitHub advice from https://www.pluralsight.com/guides/install-npm-packages-from-gitgithub. Apparently you can even npm install from a gist.

A little later I'll do the npm uninstall and then re-install it. The install from GitHub even updated my packages.json file accordingly so I need to override that at some point. I'm currently playing with view options on the plug-in.

SummittDweller commented 1 year ago

I wonder if some of the options might have changed? When I tried 'SIZED_CONTAINER' I got the migration message from Adobe again. 'IN_LINE' seems to work just fine and it's what I need so I'm going to go with that. However, feel free to ping me if you need a quick test of any other changes.

Another note... Not sure it was intended, but I found that using relative paths to "passthrough" PDF files also works. The syntax I'm successfully using in my local build is: {% pdfembed '../static/pdfs/wieting-501c3.pdf' 'IN_LINE' %}. static is the name of my "passthrough" directory (that's old Hugo convention) and I copied my pdfs subdirectory into the project there. Works beautifully, at least with my local build.

cfjedimaster commented 1 year ago

In theory, published to npm. Thank you again and please reach out if you have any questions. I would say that if you have questions about PDF Embed itself, email me directly.

SummittDweller commented 1 year ago

Ok, I'm thinking that migration message was something that got cached. All of the options are working as-expected now.

Great blog and background post by the way. We have similar stories and interests, although I only have 3 kids (plus 2 cats) and my early IT work was in FORTRAN... yup, that's because I was a Civil Engineer in a ~former life~ galaxy far, far away.

cfjedimaster commented 1 year ago

I didn't notice your previous comment when I mentioned I updated npm and closed - sorry about that - but it looks like you are ok - so lets pretend I knew the future. ;)

cfjedimaster commented 1 year ago

Thank you for the donation!