89 20
Contact Author Sign in to rate

Basic Printing Support

<10kB. Updated 2022-03-04.
The author has shared 13 other item(s).

Description

This add-on will add an option to the Tools menu in the main window. When you select it, it will place all the cards in the currently selected deck into a web page, and show that web page in your browser. You can then use your web browser's print option to print the cards on paper. The add-on should automatically open your browser with the generated web page, but if this does not work on your system, you can manually open the print.html file on your desktop. Update 4 Mar 2022: Update shortcut to avoid conflict (thanks to Abdo). Updated 24 Feb 2020: Update for Anki 2.1.20. Updated 26 Aug 2017: A new version for Anki 2.1. Should fix the page failing to open in the browser, and integrates the page break fixes posted in a comment. The Anki 2.0 version has not been updated at this time. Updated Sep 1 2014: Fix issues some users were having with the display of non-latin text.

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

1025789669

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools->Add-ons menu item, then click on Get Add-ons and paste in the code.

All Anki 2.1.x Add-Ons Contact Author

Reviews

on 1684111845
It puts the answer right below the question, making it useless because you can see the answer before you can try to thing about the answer.
on 1682496346
Thank you. Works like a charm.
on 1680345703
o meu funcionou perfeitamente. Posso selecionar o baralho que quero e pedir para imprimir. Obrigado!
on 1679468339
worked well with my Mac!
on 1677676356
Great add-on! A couple notes for users:

(1) If you want MathJax equations to display properly automatically without having to open Chrome developer tools, then simply change the line in the '__init__.py' code that sets the head for the html document from:
"<html><head>" + '<meta charset="utf-8">' + mw.baseHTML() + "</head><body>"
to:
"<html><head>" + '<meta charset="utf-8">' + '<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script><script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>' + mw.baseHTML() + "</head><body>"

(2) If you only want to print the question text, in '__init__.py' you can replace the line ‘qatxt = c.render_output(True, False).answer_text’ with ‘qatxt = c.render_output(True, False).question_text’. This has the added benefit of actually displaying the cloze deletion questions correctly.
on 1676620160
Great
on 1675186989
Works really well thanks.
on 1671105039
it works! would be better if there's a script or an option to changed how it's arranged, like according to how i created my cards and not alphabetically (or sequentially)
on 1670315826
Nice Addon!

Is it possible to show Cloze Cards as 1 Card and not as multiple?
on 1668591234
Out of a couple of Anki add-ons for printing that I tried, this one was the closest to working. However, it still failed to deal with anything but basic cards, and even then, many basic cards were broken.
on 1664987220
To the user who posted on 26/09/2022: THANK YOU. You rendered all my Mathjax.
on 1664199828
Excellent for sharing notes with those who does not use Anki.
It does not work with cloze deletion.

If you want to use MathJax open Google Chrome, go to Developers tools then Console and paste this code:

function loadScript(src) {
var script = document.createElement("script");
script.src = src;
document.body.appendChild(script);
}
loadScript("https://polyfill.io/v3/polyfill.min.js?features=es6");
loadScript("https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js");
on 1663438133
Fantastic!!! That's just what I was lloking for to get all my decks on paper and study offline
on 1655871743
Great for sharing cards to people who don't use anki
on 1655024516
Just what I needed
on 1653416575
It worked as expected.

If you're having trouble with alignment, you can change it in the "__init__.py" file. Just replace "<center>{0}</center>" by "<left>{0}</left>" on line 70.
on 1651825785
Can't find the sign for doing this on tools. For some reason, it is not appearing.
on 1649849661
So, this works wonderfully, way better than the Cards to Paper or however it was that name. The only issue is that it prints ONLY the BackSide. But I managed to find a way to obtain FrontSide and BackSide separetely to print them one on one side of the paper and the other one on the other one.

The idea is creating two htmls (printed to PDF), one for each side. Fiddle with the styling to make both the Front and Back Side of the same height when you print the PDF. After a few tries, I've understood that it does not matter the font size of the lines, but how many lines there are.
I'll explain myself: I wanted this to print a few of the RTK cards for Japanese; the problem was that the backside (the kanji one) outputted circa 9 rows per page if I just wrote the kanji and a single line of info about strokes and so, WHEREAS with the front side, where I wanted only the keyword, no matter how big I set it, the single line was resized by Firefox when printing to PDF.
Therefore, the solution was to add a couple extra lines to make the resize work. Also, if you put one line too big over the other ones, Firefox will resize the cards anyway, and you'll have the same problem, so the lines must be of similar dimensions, especially Latin characters. If you fiddle with it, you'll understand what I mean.

I know it's no final solution, but I wanted to share what has worked for me.
on 1649151603
good addon, but how to change the alignment to left, the origin alignment is middle
on 1648904504
Love it. Would also love the ability to decide the grid for each page (currently about 3 in landscape and 6 in portrait) would maybe prefer 2 in landscape.
on 1647632853
I love the add-on. It is great and exactly what I need. However, I am struggling with modifying the .py-script in a way that my cards are sorted columnwise instead of rowwise. I.e., instead of [[1,2,3],[4,5,6],[7,8,9],[10,11,12]], I would like to have it [[1,5,9],[2,6,10],[3,7,11],[4,8,12]]. Does anyone know how to deal with this?
on 1641824877
Exactly what I was looking for :)
on 1641493729
Thank you so much!

Feedback: Everything works fine, and it is especially nice since there are few alternatives. Though, for it to be more useful it would require the possibility to print the cards in the order added and/or by tag - not in alphabetical order since this is random and essentially shuffles the cards without the user wanting them shuffled.
on 1636412477
Works well for me - thanks a lot :-)
on 1633878276
the print it not to scale. it will not print to page margin
on 1629488174
it does work but it prints the front and back on one single flashcard which makes the flashcard a lot less efficient for active recall. Don't bother downloading this.
on 1625054030
does not do the job needed to .. which is question at back and answer at front .. or vice versa .. it just prints everything on one card .. and about 9 card on one paper
on 1624294353
Pretty good, but I wish it had more options like only showing cloze-type notes once, rather than having them repeat for each card.
Once you export the print file though, you can simply use HTML editing to reformat, but its kind of tedious.
on 1620653920
Good, but it'll be better if we can print some specific cards, like that I studied only today.
on 1616525187
Thanks
on 1615707273
Thank you so much!
Simple and elegant.
I printed a 3,000-item deck with different note types in the mix, and that has no images, and it looks great.
on 1614849393
Looks really good and works with Anki 2.3x. The problem is that if you print then you are going to need all of the cards the same size. When I wanted to print the page loaded without problems. It loaded 3500+ cards of all different sizes unfortunately. I imagine this is due to this being a very basic add on, it only renders well if the card is a basic card. I haven't tried basic cards and it may be possible that, depending on the length of the answer, the cards might also expand and shrink for printing. Great add-on, just too basic.
on 1614747674
Very helpful thx
on 1614640622
Worked perfect on the first try
on 1614326418
Very nice!
But I would like to ask if it is possible that it can be limited to showing one card per page (having a new page after each card)?
Thank you!
on 1614079937
Works brilliantly! Thanks!
on 1612009024
Great!! Thank you
on 1607822478
This works great! I was able to render LaTeX formulas by pasting this into the browser console:
```
function loadScript(src) {
var script = document.createElement("script");
script.src = src;
document.body.appendChild(script);
}
loadScript("https://polyfill.io/v3/polyfill.min.js?features=es6");
loadScript("https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js");
```
on 1605955755
Really good, but it would be great if there where more possibles to custumize the output. For example, linesize and color of the box, Backgroundcolor of the hole page and Backgroundcolor of the box.
on 1605473594
Great!
on 1605286902
does what it says on the tin
doesn't display LATEX or clozure, but images worked for me (no image addons)
on 1604680470
Does anyone know how to get the images to not appear as [?] ???
on 1604569949
good!
on 1603101330
It works. It also supports Unicode.
Version 2.0.32
on 1594285577
Superb! Better than other addons for printing. Highly recommended.
on 1591284404
The only thing that I miss, is that it doesn't work properly with Image occlusion Enhanced. If anyone has a solution, write that down here please!
on 1588946822
can someone tell me how to change alignment from center to left? simple but effective app!
on 1585293422
It works!
on 1584010012
Does not work
on 1583418104
Incompatible with cloze deletion or image occlusion
on 1583339614
I follow the steps, it worked. Thanks!
on 1582590694
I hope it supoort more cutomized option for layout.
now it only support card per row.

sometimes i want it just one card per a page.

Thank your for your all the effort! I really get the best of it.
on 1582576786
✅ Update 24.02.2020: Damien fixed it now. Thanks! ✅

༼ つ ◕_◕ ༽つ 🆘 Fix for Anki 2.1.20: 🆘

1. Open the "__init__.py"-file of this addon in a text editor. You can find this file by clicking on Extras > Addons, selecting "Basic Printing Support" in the list on the left and clicking the "Show Files"-button on the right.

2. Go to Line 57. It says: qatxt = c._getQA(True, False)['a']

3. Replace this with: qatxt = c.css() + c.render_output().answer_text

4. Save the changes to this file.

5. Restart Anki.

Voila! Printing works again.
on 1581249585
simply does not work!
on 1576706883
Thank You
on 1573234244
For those who are new to installing add-ons: restart Anki, the menu item won't show up until you do.
For some reason some of my MathJax formulas do not get rendered in the output. Otherwise looks good.
on 1569342929
So useful, thanks!
on 1563335066
Just save
on 1558025570
OK
on 1556698638
Very useful and easy to use. Sometimes I need a PDF file just to review my cards.
on 1556411806
thank you so much. works great for me with some additional tweaks
on 1552899725
It really work.help me a lot!!!Thank u!!!
on 1544265655
Thank you. Everything works!)
on 1542145351
Reasonably good hack (almost does what I want it to do) but... it's definitely _basic_ support. Problems include:

* It only prints the back side of the cards, meaning that (e.g.) cloze deletion cards do not properly function.
* They're in a fixed grid, meaning you can't (for example) print the cards on different-sized paper or have the individual cards have a different width. (Possible to partially fix: you could use Anki's new add-on configuration system to pick values for the `CONSTANTS`, allowing the user to change the cards-per-width.)
* Printing multiple times overwrites the previous printouts. (Possible to fix: use a temporary file or simply write to `"path/print"+repr(time.now())+".html"`, or perhaps prompt the user for where to save.)
* CSS is discarded. (Could be fixed using Shadow DOMs, but that's a really complicated feature.)
* Key combination Ctrl + P clashes with Preferences, rendering neither operable. (Possible to fix: choose something else, like Ctrl + Shift + P, or at least disable the key combination.)

But it does what I need it to (almost) and that's good enough for me until I have time to make an "Advanced Printing Support" addon.
on 1541787203
+1
on 1539790172
lovely, allows me to drag my anki decks into onenote for extra mischief.

you complete me.
on 1538987930
doesn`t work
on 1536143148
To get the cards in order you created them, go to the addons window, click "open folder", open __init__.py, go to line 24 and in the triple """, replace 'sort by n.sfld' by 'sort by c.id'
on 1535918671
Works fine!
on 1527984000
it worked for me
on 1518652800
Can somebody please explain how to install this printing add-on on Mac computer?
on 1517788800
Perfect, much needed. I was able to replace OneNote with flashcards because of this.
on 1505433600
Not appearing on Safari Browser Anymore

The print option was working fine, but now when I try this add-on the lightbulb appears on the bottom left corner of Anki, but my browser never opens a new tab for printing my cards. Please help! It was working well before, and now it just doesn't work for me
on 1503446400
on 1500768000
on 1500249600
Updating Print Settings for cleaner printing

To stop printing from cutting off tables in mid-row and to make the columns a consistent width you can edit this plugin and replace the following lines.

REPLACE:
tr { page-break-after:auto; }
WITH:
tr { page-break-inside:avoid; page-break-after:auto }

REPLACE:
cont = u"<td><center>%s</center></td>" % esc(c._getQA(True, False)['a'])
WITH:
cont = u'<td width="{1}%"><center>{0}</center></td>'.format(esc(c._getQA(True, False)['a']), 100/CARDS_PER_ROW)
on 1498003200
HowTo get Pictures into MS Word

1) Open print.html in Internet Explorer
2) File->Save As "Webpage" under new name (Internet Explorer will create a html file and a folder containing the pictures
3) Open saved .html-file in Chrome
4) CTRL+A -> CTRL+C into Word.
( 5) In Word get rid of the tables and replace them with paragraph marks)
on 1497916800
Still works OK

This is very basic, but it works.

As other reviewers mention, it would be great if it auto-loaded the exported html page in a browser.
on 1491523200
Addon needs an update

Generating the print.html works for me but some points:

1. It opens to C:\Users\xxxxx\AppData\Roaming\Anki2\addons and not to the documents folder.
2. It does not open the print.html in the browser.
on 1491177600
Does spawn brower, does not generate output file for printing, pretty shoddy

on 1488412800
print option

money. works fast. can convert from webpage to PDF and print away. sweet!
on 1487116800
Doesn't output to webpage

When I select the deck and then use the add-on, it tells me it is working, but doesn't ever output to a webpage for viewing and printing.

I'm running windows 10 and Anki Version 2.0.41, thoughts? I would really like to see this work.
on 1484611200
great support

highly recommended

[url=http://www.hello.com]hello[/url]
http://www.hello.com
<a href="http://www.hello.com">hello</a>

[url="http://www.hello.com"]hello[/url]
on 1478044800
on 1473292800
Please fix page breaks and dramatic variations in card height

Great add-on, but definitely needs some fixing
on 1473206400
Page breaks destroy the experience

Hi, thanks for this addon. I really like it and think it's great.

Unfortunately I have 2 big problems with it:
1. the flash cards I want to print are different in hight because of different amount of text on it. So they won't fit on a page without the half of one card continuing on the next... I didn't find a way to fix that in the Browser, yet.

2. to fix the problem from 1. I tried to open the print.html in excel and set the print margins for each row manually. But Latex Formulas weren't imported into excel. This makes it very impractial for my purposes :/ (running Mac OSX)

Any Ideas?
on 1456790400
on 1456358400
this is how you can modify the script so that it will open the Browser Windows

for me it didn't open the browser window.
I managed to resolve it by editing one line in the script (Tools --> Add-ons --> Basic_Printing_Support --> Edit..

replace "openLink(upath(path))" with "QDesktopServices.openUrl(QUrl.fromEncoded(upath(path)))" and then restart anki and print. It works for me
on 1449100800
on 1448496000
Thank you Thank you Thank you!

It automatically opened in Chrome on my Mac and then I copied the cards into Word :)
on 1446768000
Niektóre tale dobrze zamienia na nadające się do druku (głównie słówka). Jeżeli chodzi o rozbudowane talie, ze zdjęciami, kilkoma elementami, występują problemy. U mnie brakuje widoku przedniej strony fiszki w wydruku.
on 1439856000
brilliant app

works perfectly for me... when the output file first opened automatically in firefox i wasn't really satisfied as the characters were tiny and about 100000 cards were crammed into one page, but opening it in safari did the trick for me. also i tried word, but unfortunately no pictures were displayed there.
on 1432684800
has problem

add-on changes the order of words.
all the flashcards are not the same (Length and width).
on 1431475200
on 1431388800
on 1423440000
Genius!

Works perfectly, a little slow but awesome, thanks!
on 1422403200
on 1419033600
on 1414886400
on 1412380800
Great add on

Works as it says on the box. Thanks heaps.

Would love a way to select less than a whole deck, i.e. export to the print file just tag=something.

Thanks.
on 1411776000
on 1409961600
Very useful

Very useful.

Thank you very much :)
on 1405641600
on 1403827200
Change print order

Currently the cards are sorted in alphabetical order. Is it possible to add settings to print in order of date created? Or in the card order?
on 1401840000
WORKS, but does not open the browser automatically.

All of you who are saying this add-on does not work: it does. It just doesn't open the browser automatically.

Here's how to do it (Windows):

1. After printing the deck, head to file:///C:/Users/[Username]/Documents/Anki/[Anki username]
2. Here you'll find a file called "print.html". This is the file with your deck.
3. Open the file with your browser and you're good to go.

If your flash cards contain special letters and you end up with weird symbols within the deck, install a free software that allows you to convert the file into, for example, UTF-8. I used Notepad++ (http://notepad-plus-plus.org/). With Notepad++, the file can be converted through "Encoding -> Convert To...". After that just save the file and re-open it with your browser. Now the weird symbols should be gone.
on 1392508800
on 1381449600
on 1372809600
si la pagina web no abre automaticamente

debes ir a C:\Users\....\Documents\Anki\usuario 1, alli debe existir un archivo html con las tarjetas listas para imprimir
on 1372032000
Browser does not open

Unfortunately, the web page does not open after counting all cards in the deck. Is there a special thing I need to do to view them?