I have many tiddlers that are of the type application/pdf
. The pdfs show up fine, taking the full width of the tiddlers. I want to be able to set the height of the embedded pdf so that some pdf can show up with its full height without the scrollbar. I dont see any setting for this. Is it possible to set the width and/or height of the embedded pdf in a tiddler?
Just a suggestion
Make the tiddler height taller and the pdf may expand to fit it. Try a custom CSS in a stylesheet and assign it to the tiddler using the class field.
Hi @TW_Tones , Thanks for the tip. I tried creating the following sytesheet class:
.tallpdf{
height: 1000px;
}
Then on the tiddler with type application/pdf
I assigned the class tallpdf
. The tiddler body is tall as expected, but it seems the embedded pdf has a fixed height Perhaps
height
is not the the right property to control the pdf height?
Hello Pak,
this may be of some help.
Tobias Beer solution suggests using a helper macro and an iFrame.
Embedded External PDF
$ _.tb_macros_pdf.json (5.7 KB)
Hi @Scot , Wow it works! I followed your link and use <embed>
tag. Now I can control the height of pdf. Thank you!
BTW I just discovered that embedded pdf in TW does not show up correctly in Safari. It appeared as a static non-scrollable image. In Chrome it works fine. Perhaps it’s something to do with the user interface that displays the embedded pdf.
Glad to here it was useful.
Tobias has contributed a lot to the TW community.
His site has a lot of solutions that are useful to users no matter what their level of TW knowledge.
It seems the name got mangled in the json export process. But the macro tiddler seems to import fine if you go to the source – at
https://tobibeer.github.io/tb5/#%24%3A%2F.tb%2Fmacros%2Fpdf
– and drag it from there.
I did this already…
What else is needed? - changing the height value in the macro has no effect to the imported pdf tiddler.
Hi @StS . This is my current solution to show pdf with controllable width and height. It works fine for me. You can try it on tiddlywiki.com
\define pdfembed(src height:600 width:100%)
<embed src='$src$' type="application/pdf" width=$width$ height=$height$/>
\end
<<pdfembed "https://www.africau.edu/images/default/sample.pdf" height:400>>
Hello @Pak.
This works fine for this pdf.
When I import a local pdf-file than the tiddler uses only half of the screen height.
I’m asking for a setting, that all imported pdfs have the same tiddler height without extra coding.
This works for me:
.tc-tiddler-body > embed, .tc-tiddler-body > iframe { width: 100%; height: 950px; }