User Tools

Site Tools


links:linking_and_viewing_pdfs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
links:linking_and_viewing_pdfs [2024/11/24 13:19] – va7filinks:linking_and_viewing_pdfs [2024/11/24 13:20] (current) – va7fi
Line 1: Line 1:
 +~~NOTOC~~
 +====== Linking and Viewing PDFs ======
 +There are many ways to link, view, or create PDFs in Dokuwiki.
 +
 +===== External Links =====
 +The first way to link to an external pdf is to use ''%%[[ ]]%%'' brackets as one would for links:
 +
 +^Code ^Result^
 +|''%%[[https://bcarcc.org/twometre.pdf]]%%'' |[[https://bcarcc.org/twometre.pdf]]|
 +|''%%[[https://bcarcc.org/twometre.pdf|Two Metre Repeaters]]%%'' |[[https://bcarcc.org/twometre.pdf|Two Metre Repeaters]]|
 +
 +This works, but notice the "Earth" icon on the left of the link, identifying that it's a link to an external webpage.  We can change this identifying icon to a PDF by using the ''%%{{ }}%%'' brackets instead, which are also used for images:
 +^Code ^Result^
 +|''%%{{https://bcarcc.org/twometre.pdf}}%%'' |{{https://bcarcc.org/twometre.pdf}}|
 +|''%%{{https://bcarcc.org/twometre.pdf|Two Metre Repeaters}}%%'' |{{https://bcarcc.org/twometre.pdf|Two Metre Repeaters}}|
 +
 +===== Internal Links =====
 +These brackets also work for internal files that are stored on our server (like images):
 +^Code ^Result^
 +|''%%{{/links/twometre.pdf |}}%%'' |{{/links/twometre.pdf |}}|
 +|''%%{{/links/twometre.pdf |Two Metre Repeaters}}%%'' |{{/links/twometre.pdf |Two Meter Repeaters}}|
 +
 +Using the [[https://www.dokuwiki.org/plugin:pdfjs |PDF.js Plugin]], it's also possible to display a local pdf in a window.  For example,
 +
 +  {{pdfjs 600px,300px>/links/twometre.pdf}}
 +
 +gives:
 +
 +{{pdfjs 600px,300px>/links/twometre.pdf}}
 +
 +Note, that the width (''600px'') and length (''300px'') parameters are optional.  Also, this doesn't work with external links.
 +
 +
 +===== Export Page To PDF =====
 +{{ /links/exporttopdf.png}}Finally, thanks to the [[https://www.dokuwiki.org/plugin:dw2pdf |DW2PDF Plugin]], Dokuwiki pages can be easily exported as PDFs using the PDF icon on the right hand side of the page.
 +
 +Sometimes, it is useful to add an Export link in the text.  This can be done by adding ''?do=export_pdf'' at the end of a URL.  Quick caveat: counter intuitively, this time, the ''%%[[ ]]%%'' brackets must be used:
 +
 +^Code ^Result ^
 +|''%%[[/links/linking_and_viewing_pdfs?do=export_pdf |Export This Page to PDF]]%%'' |[[/links/linking_and_viewing_pdfs?do=export_pdf|Export This Page to PDF]]|
 +
 +But to simplify this process further and add the fancy PDF icon, I manually added ''mpdf'' -> ''%%{NAME}?do=export_pdf%%'' to the InterWiki Links configuration file with the PDF icon so that this can be used instead:
 +^Code ^Result ^
 +|''%%[[mpdf>/links/linking_and_viewing_pdfs |Export This Page to PDF]]%%'' |[[mpdf>/links/linking_and_viewing_pdfs |Export This Page to PDF]]|
 +
 +Or, if the page to export is the one containing the link, this works too:
 +^Code ^Result ^
 +|''%%[[mpdf>|Export This Page to PDF]]%%'' |[[mpdf>|Export This Page to PDF]]|
 +
 +When writing a page that will likely get exported, it's useful to be able to manually start a new page.  The [[https://www.dokuwiki.org/plugin:pagebreak |Pagebreak Plugin]] allows this using ''%%<pagebreak>%%''.
 +
 +The best example of this is the [[/ecomm/scec |Sunshine Coast Emergency Communications]] page, which was created to be printed.
 +
 +===== Plugins =====
 +A full list of all installed plugins can be found at the end of the [[links:syntax#syntax_plugins|Syntax]] page.