Hi James

Try the <embed> tag <http://www.w3schools.com/tags/tag_embed.asp> instead:

Here's an example how to turn it into a macro:

[[$:/embedPDFmacro 
<http://xn--mns-ula.dk/udtalelser/hu/#%24%3A%2FembedPDFmacro>]] 
$:/tags/Macro:

\define pdfembed(url)
<embed src='$url$' type="application/pdf" width='100%' height='915'/>
\end


Usage: <<pdfembed "web adress or file path">>

You might even be able to leave out the type attribute and experiment with 
other filetypes..

Cheers Måns Mårtensson

Den tirsdag den 19. maj 2015 kl. 06.43.23 UTC+2 skrev James:
>
> Hi Måns,
>
> I am sorry to post a reply on the old threat.
>
> I found your scripts really useful and it works on embedded PDF into TW5 
> very well.
>
> However, I encounter a problem when I tried to embedded a local PDF file 
> in TW5.  It pops up a download window instead of showing PDF in the 
> iframe.  Would you mind to shed some lights on that?
>
> Thanks.
>
>
> On Saturday, 28 February 2015 06:37:27 UTC+8, Måns wrote:
>>
>> Hi Bill
>>
>> If you have a look at the "Motovun Jack.pdf" tiddler in edit mode you'll 
>> see that it's a binary tiddler and that it's type is set to 
>> "application/pdf".
>> Maybe this all happens automagically when you drag a pdf on to a TW? 
>> (import it into the TW document)
>>
>> I don't know because I generally avoid embedding binary files in my TWs 
>> not to create too big Tidddlywiki documents...
>>
>> Instead I would create a tiddler and set the type to "application/pdf" 
>> manually - simply write it in the type field if it doesn't appear in the 
>> drop down list already.
>> Next I would create a new custom field: "_canonical_uri" and paste the 
>> URL to my web hosted pdf document (click add - or it won't be created).
>>
>> Usually I show pdfs via an iframe: <iframe width="100%" height="900" 
>> src="URL to my web hosted pdf document" frameborder="0" 
>> allowfullscreen></iframe>.
>>
>> If I have a lot of pdfs to show I will create a global macro with the 
>> iframe like this:
>>
>> 1) Create a tiddler called eg $:/_iframe/macro (It doesn't matter what 
>> you call it)
>> 2) Write something like this: 
>> \define iframe(url)
>> <iframe width="100%" height="915" src="$url$" frameborder="0" 
>> allowfullscreen></iframe>
>> \end"
>> 3) Tag it with $:/tags/Macro
>>
>> Now I can create an iframe with my pdf like this: <<iframe "URL to my web 
>> hosted pdf document">> in any tiddler.
>>
>> A more "involved version of the above macro could look like this:
>>
>> 1)Tiddler title eg $:/_iframe2/macro/link/fullscreen
>> 2) Write:
>> \define iframe2(url)
>> [ext[Link|$url$]] {{$:/core/ui/Buttons/full-screen}}
>> <iframe width="100%" height="900" src="$url$" frameborder="0" 
>> allowfullscreen></iframe>
>> \end
>> 3) Tag it with $:/tags/Macro
>>
>> Now I can create an iframe with my pdf like this: <<iframe2 "URL to my 
>> web hosted pdf document">> in any tiddler. 
>> I'll get a link to the pdf document and a button to open the tiddler in 
>> full screen mode at the top of the iframed pdf document.
>>
>> If I fetch all my pdfs from the same location I will add a "location 
>> snippet" to the macro like this: src="http://MyWebAddress/$url$.pdf";
>> Then there is only very little to write: <<iframe "filename">>. 
>> Address and filetype is already set by the macro...
>>
>>
>> Hope some of this helps - enjoy :-)
>>
>> Cheers Måns Mårtensson
>>
>>
>>
>> Den fredag den 27. februar 2015 kl. 21.32.28 UTC+1 skrev Bill Denbigh:
>>>
>>> Incidentally i did see the "Motovun Jack.pdf" tiddler inside of 
>>> tiddlywiki.com but can't figure out how it works. Sorry...
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e7bdedcf-92ee-4f03-9e51-a3018b609910%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to