Adobe Launch: Deploy the Adobe PDF Embed API
Many organizations have PDF documents on their web properties. While PDFs are a reliable format for storing and distributing content, when left up to the browser to determine, the consumption experience is unfortunately inconsistent.
Depending on the type of device, browser, and a user’s software preferences, a PDF may:
- Open in the current window or tab, taking them away from your web experience.
- Download directly to their device without opening (i.e: to a “Downloads” folder), potentially getting lost.
- Open a new window or a new tab, in either the foreground or the background.
As a site owner, none of these situations are predictable or ideal.
To make matters worse, a PDF in a new tab, window, or sent to a local folder becomes an analytics black box. You have no idea how people are interacting with the content.
There’s a better way.
The PDF Embed API solves this inconsistency by creating a uniform high-fidelity viewing experience for all users, regardless of device.
Not only do your PDFs look great and open within the browser as you intend, but the PDF Embed API also offers you complete control over the experience through a whole new set of capabilities including annotation, analytics, collaboration, save controls, and more.
Try the demo to get a sense of what the PDF Embed API can do. Oh, and did I mention it’s free to use?
But what about all the PDFs currently on your website? How can you make it easier to view all of the PDFs posted there without having to manually code each one to take advantage of these new features? That’s where Adobe PDF Embed API and Adobe Experience Platform Launch work beautifully together.
Adobe Experience Platform Launch enables brands to centrally manage and deploy scripts, data collection, and marketing technologies across their properties.
The instructions below assume you’re already familiar with Adobe Experience Platform Launch. If you’re not sure what that is or would like a refresher, check out the Launch homepage or product documentation to acquaint yourself.
What We’ll Do
- Create an Adobe PDF Embed API key
- Create an Adobe Experience Platform Launch Rule to deploy the PDF Embed API
Before We Begin…
You will need access to your organization’s Adobe Experience Platform Launch console. If you do not have access, please contact your organization’s Adobe administrator.
Assumptions and Caveats
Step 1 : Get an Adobe PDF Embed API Key
If you already have your PDF Embed API Key, skip ahead to the next section.
Head over to the PDF Embed API homepage and click the Get Free Credentials button, or use this direct link.
On the Get Started with Document Services APIs page:
- Click the Get Started button in the Create New Credentials section.
On the Create New Credentials page:
- Select PDF Embed API as the service.
- Give your credentials a name.
- Enter the domain name of the site you want to deploy the Embed API on.
- Click Create Credentials.
Step 2 : Create a Launch Rule
You’ll now use Adobe Experience Platform Launch to create a rule that:
- Runs on every page.
- Inspects the page for HTML ‘A’ tags that reference PDF documents.
- Rewrites the PDF links to use the Adobe PDF Embed API.
Create the Rule
- Log in to Adobe Experience Platform Launch.
- Select the Launch property on which you want to deploy the PDF Embed API.
- Click the Rules tab for the selected property.
- Click the Add Rule button.
- Give your rule an easily recognizable name (ex: ‘Change PDF Links to PDF embed API’).
- Click the Plus icon to add an event in the Events section.
Coreas the Extension.
DOM Readyas the Event type.
- Click the Keep Changes button in the top right hand corner.
On the Action Configuration screen:
Coreas the Extension.
Custom Codeas the Action type.
- Click the Open Editor button to edit the code.
Copy and paste the code from within the following gist into the code editor:
IMPORTANT: Replace the value of the client Id on line 4 with the value you were assigned when you created your PDF Embed API Client Id in step 1.
It should look something like this:
Publish the Rule
You will now publish and test your new rule.
- Click Publishing Flow from the left-hand rail.
- Click Add Library.
- Give your new library a name (ex: PDF Embed).
- Select the environment to which you want to deploy the rule.
- Click Add All Changed Resources.
You will see your new rule appear in the Resource Changes section.
Click the Save & Build for Development button.
Test the Rule
For the sake of demonstration, we’ll use the following HTML as an example. It’s deliberately simple, containing only 3 buttons with some PDF links.
Our test page when deployed to our web server:
We’ve been able to enhance the PDF reading experience for our site visitors in a matter of minutes with the combined power of the PDF Embed API and Adobe Experience Platform Launch.
Now that you see how easy it is to put the viewer on a page, explore the examples from our GitHub to get an idea of what possibilities are now open to you with the PDF Embed API.
Credit: Source link