From a4daf3996d5d982b081a8c5a75d08740b1f1765d Mon Sep 17 00:00:00 2001 From: Neha9849 Date: Tue, 22 Feb 2022 02:04:32 +0530 Subject: [PATCH 1/5] added embed-pdf shortcode added download-pdf partial Keep HTML element on a single line, and other minor spacing Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] added embed-pdf shortcode added demo in installation/configuration file --- .../installation/configuration/_index.en.md | 4 +- exampleSite/static/pdfs/sample.pdf | Bin 0 -> 2830 bytes layouts/shortcodes/embed-pdf.html | 111 ++++++++++++++++++ 3 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 exampleSite/static/pdfs/sample.pdf create mode 100644 layouts/shortcodes/embed-pdf.html diff --git a/exampleSite/content/installation/configuration/_index.en.md b/exampleSite/content/installation/configuration/_index.en.md index 4a5e15c..a407959 100644 --- a/exampleSite/content/installation/configuration/_index.en.md +++ b/exampleSite/content/installation/configuration/_index.en.md @@ -24,4 +24,6 @@ Note that some of these parameters are explained in details in other sections of # Call to action is default enabled, if you want to disable it. just change the enable = false # You can change banner title and other text from the config file. -``` \ No newline at end of file +``` + +{{< embed-pdf pdfName="sample.pdf">}} \ No newline at end of file diff --git a/exampleSite/static/pdfs/sample.pdf b/exampleSite/static/pdfs/sample.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c0e31a076aeb1fa7729e82279943b3504f85338d GIT binary patch literal 2830 zcmd5;-EP}96u#$EoSOg%kdhLuKNm%TIEk^XOA{o|$l$1urA7}G%`-gh0z#{u*ztl%QS<`8GX}hHVSC$ z1#7bpRcRqJ1yrR3rNPc6{H6+9i5xEEbS|`-mS8Ju3MKNA!i6a$Sovfroahu5ZrYbf z$Y~t%wa1;kubKAQ=Lt=Mwosd>USoNma-T;(qRBA&Rz@Q%n4TTOSNCnzYHw71F1>&b zgZ9|!vhOwZ>eU{fA-OMc`Th4>8p!8gxnC!_O6sp|_(!9j!4 zl}rI2*Anp(v6E8TCW$z)#(@?w9K8J>pe)8XYW!;hbAlZxi{j`%A=xgD@m>JvAQ{$i zx+!l~m_<`ypTcJZ@b7hZF-aPQ?eXuN^uL?7r@s%cJHXn!ip%*i%*_h!Ycv4+yhKny zkVPObZIxvdMwJC^EQqpI!qH0D>D+1dx$Ge8QYh?=Y4Q9TxY=LlKA(X{v8k=GuYoxV zbzeBf?vyKQu?=mRpI}SD+lY(UFY12dGL(5vH|f26Pp*%X)OVnw6y0RN{t@%`%+H zQq6RUYqc%x-Dko|I6QmHJumVG9`X#H@aSkehNnViNHu()I11Bz5QX6&1eC8oAFJX% z&>PVZ8B|x~2Z#q<5$8z!x}w1llkSN8@P(Eiz0l$T-}T6Y5TUVSi-*XhS`k48gS4fn tdFze(DqWWB+Te?Dj27AI&pI>6zUm3`FC<{1uysXv><8rF;QVq-{svGq0pkDw literal 0 HcmV?d00001 diff --git a/layouts/shortcodes/embed-pdf.html b/layouts/shortcodes/embed-pdf.html new file mode 100644 index 0000000..7ce06ab --- /dev/null +++ b/layouts/shortcodes/embed-pdf.html @@ -0,0 +1,111 @@ + + +
+
+
+
+ + / + +
+ + View PDF +
+ +
+ \ No newline at end of file From 46f14ed73cd3e76546a1718415972bc68d552abe Mon Sep 17 00:00:00 2001 From: Neha9849 Date: Fri, 11 Mar 2022 23:06:39 +0530 Subject: [PATCH 2/5] some fixes --- exampleSite/content/installation/configuration/_index.en.md | 1 - exampleSite/content/installation/elements/_index.en.md | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/exampleSite/content/installation/configuration/_index.en.md b/exampleSite/content/installation/configuration/_index.en.md index a407959..58805a4 100644 --- a/exampleSite/content/installation/configuration/_index.en.md +++ b/exampleSite/content/installation/configuration/_index.en.md @@ -26,4 +26,3 @@ Note that some of these parameters are explained in details in other sections of # You can change banner title and other text from the config file. ``` -{{< embed-pdf pdfName="sample.pdf">}} \ No newline at end of file diff --git a/exampleSite/content/installation/elements/_index.en.md b/exampleSite/content/installation/elements/_index.en.md index 58539be..d672123 100644 --- a/exampleSite/content/installation/elements/_index.en.md +++ b/exampleSite/content/installation/elements/_index.en.md @@ -190,3 +190,8 @@ Markdown | Less | Pretty ##### Youtube video {{< youtube C0DPdy98e4c >}} + +
+ +##### Embed PDF +{{< embed-pdf pdfName="sample.pdf">}} From d3dc9be2086c3a30dd966fbe84bfe046d36fbc6c Mon Sep 17 00:00:00 2001 From: Neha9849 Date: Fri, 11 Mar 2022 23:29:54 +0530 Subject: [PATCH 3/5] fixing the pdf view --- layouts/shortcodes/embed-pdf.html | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/layouts/shortcodes/embed-pdf.html b/layouts/shortcodes/embed-pdf.html index 7ce06ab..9ce587c 100644 --- a/layouts/shortcodes/embed-pdf.html +++ b/layouts/shortcodes/embed-pdf.html @@ -30,11 +30,11 @@
/
@@ -86,22 +86,18 @@ function renderPage(no) { pdf.getPage(no).then((page) => { console.log(page); - var scale = 1.5; + var scale = 3; var viewport = page.getViewport({ scale: scale }); - var outputScale = window.devicePixelRatio || 1; var canvas = document.getElementById("the-canvas"); var context = canvas.getContext("2d"); canvas.width = viewport.width; canvas.height = viewport.height; canvas.style.width = "100%"; canvas.style.height = "100%"; - var transform = - outputScale !== 1 ? [outputScale, 0, 0, outputScale, 0, 0] : null; // Render PDF page into canvas context var renderContext = { canvasContext: context, viewport: viewport, - transform: transform, }; var renderTask = page.render(renderContext); }); From a37b551805d3e3390500421d6b9c85a8af631e2d Mon Sep 17 00:00:00 2001 From: Neha9849 Date: Fri, 11 Mar 2022 23:32:47 +0530 Subject: [PATCH 4/5] minor fix --- exampleSite/content/installation/configuration/_index.en.md | 1 - 1 file changed, 1 deletion(-) diff --git a/exampleSite/content/installation/configuration/_index.en.md b/exampleSite/content/installation/configuration/_index.en.md index 58805a4..e3cfa42 100644 --- a/exampleSite/content/installation/configuration/_index.en.md +++ b/exampleSite/content/installation/configuration/_index.en.md @@ -25,4 +25,3 @@ Note that some of these parameters are explained in details in other sections of enable = false # You can change banner title and other text from the config file. ``` - From 53d8dda68c9520e5fbd83d80525772f490505d71 Mon Sep 17 00:00:00 2001 From: Neha Deekonda <85057583+Neha9849@users.noreply.github.com> Date: Tue, 15 Mar 2022 12:00:31 +0530 Subject: [PATCH 5/5] Update exampleSite/content/installation/elements/_index.en.md Co-authored-by: Justin W. Flory --- exampleSite/content/installation/elements/_index.en.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exampleSite/content/installation/elements/_index.en.md b/exampleSite/content/installation/elements/_index.en.md index d672123..8979f72 100644 --- a/exampleSite/content/installation/elements/_index.en.md +++ b/exampleSite/content/installation/elements/_index.en.md @@ -194,4 +194,7 @@ Markdown | Less | Pretty
##### Embed PDF + +Embedded PDFs must be committed as [static files](https://gohugo.io/content-management/static-files/) in `static/pdfs/`: + {{< embed-pdf pdfName="sample.pdf">}}