From a37137d42689d65b3cee5f276d3f1122bf3ae669 Mon Sep 17 00:00:00 2001 From: Marxsal Date: Sat, 31 Dec 2016 05:21:32 -0800 Subject: [PATCH] DOC: How to embed PDFs and other documents (#2678) * How to embed PDFs and other documents * Adding notes about external linking and other details --- .../How to embedd PDF and other documents.tid | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 editions/tw5.com/tiddlers/howtos/How to embedd PDF and other documents.tid diff --git a/editions/tw5.com/tiddlers/howtos/How to embedd PDF and other documents.tid b/editions/tw5.com/tiddlers/howtos/How to embedd PDF and other documents.tid new file mode 100644 index 000000000..585c0b369 --- /dev/null +++ b/editions/tw5.com/tiddlers/howtos/How to embedd PDF and other documents.tid @@ -0,0 +1,35 @@ +created: 20141117000000000 +modified: 20161229175752081 +tags: Learning +title: How to embedd 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.