Skip to content

Commit

Permalink
Using embed instead of Adobe SDK for Resume pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-Kwan committed Dec 19, 2023
1 parent 275a8e1 commit cb75431
Showing 1 changed file with 6 additions and 42 deletions.
48 changes: 6 additions & 42 deletions pages/resume.tsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,19 @@
import React, { useEffect } from 'react';
import React from 'react';
import Head from 'next/head';
import Layout from '../components/RootLayout';
declare const AdobeDC: any;

export default function Resume() {
useEffect(() => {
// Check if the script has already been loaded
if (
document.querySelector(
'script[src="https://acrobatservices.adobe.com/view-sdk/viewer.js"]'
)
) {
return;
}

const script = document.createElement('script');
script.src = 'https://acrobatservices.adobe.com/view-sdk/viewer.js';
script.onload = () => {
document.addEventListener('adobe_dc_view_sdk.ready', function () {
var adobeDCView = new AdobeDC.View({
clientId: process.env.NEXT_PUBLIC_ADOBE_CLIENT_ID,
divId: 'adobe-dc-view',
});
adobeDCView.previewFile(
{
content: {
location: {
url: process.env.NEXT_PUBLIC_RESUME_LINK,
},
},
metaData: { fileName: 'Kevin_Kwan_Resume_2024.pdf' },
},
{
embedMode: 'FULL_WINDOW',
defaultViewMode: 'FIT_PAGE',
showAnnotationTools: true,
showDownloadPDF: true,
}
);
});
};
document.body.appendChild(script);
}, []);

return (
<Layout>
<Head>
<title>Kevin Kwan | Résumé</title>
</Head>
<main className="flex-1 p-4" style={{ height: '100vh' }}>
<div id="adobe-dc-view"></div>
<embed
src={process.env.NEXT_PUBLIC_RESUME_LINK}
type="application/pdf"
style={{ width: '100%', height: '100%' }}
/>
</main>
</Layout>
);
Expand Down

0 comments on commit cb75431

Please sign in to comment.