1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-17 23:34:50 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/howtos/How to embed PDF and other documents.tid
2017-01-13 08:17:31 -07:00

36 lines
2.1 KiB
Plaintext

created: 20141117000000000
modified: 20161229175752081
tags: Learning
title: How to embed PDF and other documents
type: text/vnd.tiddlywiki
!!! Note about embedding versus external linking
''Note:'' Before we dive into how you can embed files of a certain type, you may want to consider not embedding and instead simply linking to external resources like this:
```
[ext[title|path/to/that.file]]
```
Then let your browser decide how to handle the resource. The advantage to this approach is that it is simple and quick. The disadvantage is that the file doesn't actually travel with the TW5 file and that you can't use `node.js` with method #2 below to quickly file paths.
!! Two ways to embed a PDF in your TW5 file.
!!! 1. Embedding with Drag and Drop
One is to drag and drop the file onto your TW5 file. Wait for the green bar to appear at the top, drop, and then import from the import tiddler. This actually embeds the contents of your imported PDF (or other file) into your TW5 file.
This method be OK as long as your PDF is not too big. There can be concerns if your TW5 file becomes too big.
!!! 2. Embedding with '_canonical_uri'
The other way is to create a tiddler link to the external file. In this method the file is not actually incorporated into your TW5 file, but can be accessed with the `{{My Image File.jpg}}` transclusion syntax just like an embedded file. The location address of the file can also be changed under [[node.js]]. See [[ExternalImages]] for details of using external images with node.js.
Create a tiddler with a field `_canonical_uri`. Put in the local address to the external file. Set the `type` field to `application/pdf`.
With either way, with an appropriately configured browser, you should see your embedded PDF file.
!!! Other File Types
There's only so many file formats that TW5 knows about. There is a list at [[ContentType]]. If your browser and/or TW5 doesn't know what to do with a particular file format, then you can only the use the second method to embed and then download a file. When you edit the tiddler a link is presented. You can right click on the link in order to download the file.