Tiddly2PDF Release

Tiddly2PDF is a plugin that allows for seamless conversion from wikis to fully customized PDFs. It is designed to allow wikis serving as documentation or journals to be exported into a more standard document format.

This is my first plugin, so I hope I didn’t mess anything up too badly :slight_smile:

This is the v0.1.1 release, otherwise known as very early alpha. The basic functionality all works, but expect some bugs. Currently, issues when formatting templates and configs can cause js errors if filled out wrong.

I hope some people end up testing it out, as I would love to get some feedback, feature requests, and bug reports for me to use to improve the plugin.

Warning: Sadly due to the libraries the plugin runs on the total size ends up being 2MB, and there is not much I can do to shrink it.

Github: GitHub - GameDungeon/Tiddly2PDF
Docs: Tiddly2PDF Docs
Download: Releases · GameDungeon/Tiddly2PDF · GitHub

6 Likes

Great plugin! Thank you for sharing @GameDungeon

I add it to my list of favorites plugin as it is very handy!

Few features may be added in your long term run:

  • The footer and header may read from tiddler itself (e.g. recognize currentTiddler and then can read or access to header/footer field) this way you can have different header or footer on different page (like books)
  • A better name for exported pdf can be used or it can be a user input (now it is file.pdf)
  • A plain css may be better option versus a JSON one
  • The size of $:/plugins/GameDungeon/Tiddly2PDF/ExportAsPDFWidget.js is ~2MB, may be it can be reduced by some minimization techniques.
1 Like

Thanks a lot :slight_smile:

While I plan to add a lot of information from the tiddlers to it (which should be all you need), it is limited to the HTML, so you can’t do full Wikitext stuff.

I can’t believe I didn’t think of that. That’s an easy addition, so expect it next version.

Due to the way that PDF Make works, this is sadly not an option.

That is minimized. It’s really just a massive lib.

1 Like

Hi @GameDungeon I have tried it out and it is great. I have two questions and or improvements;

It seems great at automagically page breaking even a single long tiddler. But the solution prints all tiddlers tagged PDF.

  • I have wikis responsible for generating more than one pdf. Could we have a view toolbar button to only print the current tiddler, which itself may be a compound tiddler containing many tiddlers content?
    • this basic feature would be great, but then ultimately if individual tiddlers could specify different templates and settings that would be even more powerful.
  • Have an example tiddler containing multiple paragraphs, in html <p></p> tags generated by tiddlywiki. I would like to add page-break=avoid on each paragraph, but not sure the best way to do this just for the printing. I may wish to do this to other elements as well such as <ul> <ol> <tabel> etc…

The default font of pdfmake does not support Chinese

    let dd: docDefinition = {
            header: headerFunction,
            footer: footerFunction,
            background: backgroundFunction,
            content: [],
            images: {},
            styles: this.getPDFStyles()
        };

Maybe add a config font like the example below;

pdfMake.addFont('Arial.ttf', 'Arial', 'normal');

const docDefinition = {
  content: [
    { text: 'Hello world!', font: 'Arial' }
  ]
};

I was looking at implementing font selection, and then I noticed that the example code included the entire 700kb font lib. After handling that properly, I managed to shrink the plugin down to 1.2MB, which is a considerable improvement.

2 Likes

Version 0.1.2 is now out.

New Features include:

  • Shinked down to 1.5MB (I had to add some fonts back to get everything working)
  • File names are now selectable
  • Custom Fonts can now be uploaded and used. (This was the big thing)
  • Minor bug fixes and opened an issue to get one resolved.

What next? The ability to have multiple docs and to be able to select different templates and settings for individual tiddlers. Additionally, lots more vars for the templates to choose from.

Github: GitHub - GameDungeon/Tiddly2PDF
Docs: Tiddly2PDF Docs
Download: Releases · GameDungeon/Tiddly2PDF · GitHub

1 Like

Version 0.1.3 is now out.

New Features include:

  • Style Changes
  • Added additional built-in styles
  • Added Page fields

Looking for feedback on improving the default styling of the pdfs for a better out-of-the-box look, and suggestions for additional built-in styles, page fields, and template variables.

Github: GitHub - GameDungeon/Tiddly2PDF
Docs: Tiddly2PDF Docs
Download: Releases · GameDungeon/Tiddly2PDF · GitHub

1 Like

Small warning - It looks like I forgot to update the default font setting when changing which font came built-in. If the export button is not working make sure to check the right font is selected.

Thanks for working on this @GameDungeon,

As I raised before I would appreciate if we can PDF the current tiddler, because I have tiddlers that I have built from multiple other tiddlers, that I would like to print on their own, rather via a tag (PDF) in your example. It will mean I have to set when to page break etc… but I am fine with that.

  • perhaps a separate ViewToolbar button?

That’s on the to-do list, I just haven’t gotten around to it yet.

The tiddly in the name does not correspond to the pdf word, perhaps tiddler2pdf would be better?

The general idea is it converts a TiddlyWiki to a PDF, though the original name was TiddlyPDF, it was suggested to change it to this. I’m going to say it’s probably a bit late to change the name now.

1 Like

Version 0.1.4 is now out.

New Features include:

  • Added $pdf-subtitle page field and template var
  • Added support for non-standard image types.
  • Added support for the default highlighter

Soon:

  • A sub-plugin to allow highlight.js support in the PDFs

Still looking for any feedback on improving the default styling of the pdfs for a better out-of-the-box look, and suggestions for additional built-in styles, page fields, and template variables.

Github: GitHub - GameDungeon/Tiddly2PDF
Docs: Tiddly2PDF Docs
Download: Releases · GameDungeon/Tiddly2PDF · GitHub

3 Likes

Version 0.1.5 is now out.

New Features include:

  • Breaking: Style tiddlers are now based in CSS instead of JSON (Only a small subset of features is currently supported, as well as non-standard attributes.)
  • A guide for setting up highlight.js support.

Github: GitHub - GameDungeon/Tiddly2PDF
Docs: Tiddly2PDF Docs
Download: Releases · GameDungeon/Tiddly2PDF · GitHub

3 Likes