![]() |
#1 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,542
Karma: 19001081
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
[GUI Plugin] Prince PDF
This plugin converts a book to PDF using Prince (www.princexml.com). Prince can create PDF files with typographical quality, and supports some advanced features like real footnotes and floats, different page styles, etc.
This is the calibre plugin version of my previous script, which is available in two other versions: It is implemented as a GUI plugin rather than a conversion plugin because it may use some non-standard metadata and otherwise unused files, which are not available in normal conversion. Only a few formats can be converted with this plugin, mainly EPUB, AZW3 and HTMLZ. The resulting PDF can be added to the book record or saved to disk. As with the other versions, this plugin will use, if it exists in the book, a special CSS file tagged in the metadata section of the OPF file as: Code:
<meta name="prince-style" content="pdfoutput_css" /> So far, it has only been tested with ePub files and in Linux (and to some extent in Windows). If anyone tries it with other formats and/or in other platforms, please notify me of any issues. Special Notes:
Translations: Want to translate the plugin to another language? Use transifex. Older versions If you need an older version for compatibility with an older calibre, you can find previous versions in GitHub. Version History: Spoiler:
Last edited by Jellby; 04-08-2023 at 05:55 AM. Reason: Version 1.6.0 |
![]() |
![]() |
![]() |
#2 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,485
Karma: 29308976
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,542
Karma: 19001081
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
![]() I don't know if there's any other way to do it, but you may try downloading and installing the attachment in this post. (Edit: attachment removed, old version.) Last edited by Jellby; 12-29-2013 at 03:43 AM. |
|
![]() |
![]() |
![]() |
#4 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,755
Karma: 59473090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
![]() |
![]() |
![]() |
#5 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,485
Karma: 29308976
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
![]() ![]() Minor point, I think you should make it abundantly clear in the introductory post that the Prince software must be installed in order to use the plugin - my eyes went straight over the link to the princexml web site. And I've yet to see the window you posted as ss2.png ![]() @thducks - I tried it both ways (I think), can't recall what the msg was when I did it manually, but words to the effect that 'this is For Linux Only'. I was able to manually install it on Mint - but right now my Mint box has a half life of < 5 minutes, so its NSFW. Maybe I should re-purpose it as a kitty kontainer :lol: BR Last edited by BetterRed; 12-26-2013 at 04:37 PM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,485
Karma: 29308976
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
On first try using a book called "Test Epub" by "Test Author" - the Prince application started, but it did not appear to 'have' the current epub. So, I closed Prince and got following error
Code:
calibre, version 1.17.0 ERROR: Unhandled exception: <b>IOError</b>:[Errno 2] No such file or directory: u'C:\\_CalTemp\\calibre_dcvy4w\\tf2pn2_unpack\\Test Author\\Test Epub\\Test Epub - Test Author.pdf' calibre 1.17 [64bit] isfrozen: True is64bit: True Windows-7-6.1.7601-SP1 Windows ('64bit', 'WindowsPE') ('Windows', '7', '6.1.7601') Python 2.7.5 Windows: ('7', '6.1.7601', 'SP1', 'Multiprocessor Free') Traceback (most recent call last): File "calibre_plugins.prince_pdf.main", line 133, in convert_to_PDF File "calibre_plugins.prince_pdf.main", line 210, in set_pdf_metadata IOError: [Errno 2] No such file or directory: u'C:\\_CalTemp\\calibre_dcvy4w\\tf2pn2_unpack\\Test Author\\Test Epub\\Test Epub - Test Author.pdf' See attachment to see the what's in C:_CalTemp- I can zip it up and post if you're interested. NB: I haven't used Prince until now, so I have no preconceived ideas or expectations of what it does or how it should work. BR ps : I found ss2.png - was hiding under the Help button ![]() Last edited by BetterRed; 12-26-2013 at 05:19 PM. |
![]() |
![]() |
![]() |
#7 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,755
Karma: 59473090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#8 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,485
Karma: 29308976
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
![]() |
![]() |
![]() |
#9 | ||
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,542
Karma: 19001081
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Quote:
But note that Prince is a command-line tool. Every window you see is the plugin (or calibre). When you say you closed Prince, I guess you mean you closed the conversion window (ss4.png). Anyway, when the process is cancelled (or it fails) there should be no further attempt to access the pdf file. Do you see a "View log" button in the main plugin window after this happens? If you do, please click it and post what it says. Otherwise, I'm afraid I'd need a more detailed description on how to reproduce this, since I cannot see what could be going wrong at the moment. |
||
![]() |
![]() |
![]() |
#10 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,485
Karma: 29308976
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Hi Jelby - I'll talk to the attachments
Capture 1
Capture 2 The odd thing is the two items shown for calibre - not only is that unusual, I cant see "Convert to PDF with Prince" in Task Manager's list of Processes, or in Process Explorer's list of Processes - the only place it is apparent is in the Taskbar and in Task Managers list of Applications. I can't recall seeing an an entry in Task Manager's Application list, that wasn't also in its Process list - quite odd, bizarre even. You can also see the icon for Prince that was started by the plugin BR Last edited by BetterRed; 12-27-2013 at 05:23 AM. Reason: put the images back - why does MR lose them ? |
![]() |
![]() |
![]() |
#11 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,542
Karma: 19001081
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Ah... I think the problem is Prince is starting some GUI frontend that does not exist (as far as I know) in linux. The plugin should be calling a command-line interface, not a GUI. When I click the "Convert" button, I see the "working" progessbar, but nothing else; when the prince process ends, the "Convert to PDF with Prince" window is closed.
According to the Prince doc, the command-line should work in Windows too, can you configure the plugin and select the prince.exe executable as indicated there? As for the two taskbar items, I have no idea why that happens, The "Convert to PDF with Prince" dialog is just a plain QDialog widget. What I don't like from your screenshots is that the plugin icon is missing (from its main window and the calibre toolbar), and the window titlebars are all wrong. Maybe I'm doing something wrong, or maybe that's a common problem with PyQt in Windows... Last edited by Jellby; 12-27-2013 at 06:23 AM. |
![]() |
![]() |
![]() |
#12 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,485
Karma: 29308976
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Aaah that's better
Assuming Prince is installed in the default location, the cli program will be at 64bit Windows ==>> "C:\Program Files (x86)\Prince\Engine\bin\prince.exe" 32bit Windows ==>> "C:\Program Files\Prince\Engine\bin\prince.exe" The conversion works - a PDF is produced in the right place and the database is updated to 'say so' and I can open the book (in my PDF reader) via the View feature in calibre However, when the update is finished the Formats 'column' in Book Details doesn't show a PDF. The Book Details panel probably needs to be refreshed, if I make another book current and return to book just converted the PDF is shown. I'm not bothered by the missing icons - but other PI's have their icons in the their images folder, that folder is empty in the Prince PDF.zip. I'm still seeing the aberrant second item in my taskbar. I've got a heavily tweaked taskbar so when I've done my morning chores I'll turn the tweaks off and have another look. It's most unlikely that the tweaks are the cause the of the aberration, but their lack may make it easier to diagnose. BR Last edited by BetterRed; 12-27-2013 at 03:02 PM. Reason: clarity |
![]() |
![]() |
![]() |
#13 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,485
Karma: 29308976
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
![]()
Hi Jelby,
The aberration is another instance of the calibre process - sort of I get exactly the same with my mail client. when I hit the reply button it opens a Reply window that shows as another item in the taskbar, which gets grouped (that's a Windows setting not a 3rd party tweak) with the main icon. And the Reply window shows as a separate Application, but not as a separate Process. So I'm assuming the 'aberrant' taskbar icon represents the prince.exe program I'm OK with it now, but it may 'disturb' other Windows users - on the other hand they may not even notice it ![]() So... bottom line is that it's ready to go in Windows (icons aside). I wont be doing any quality checking of the output PDF - just thought I'd help by doing some basic 'does it work' tests. Cheers BR Last edited by BetterRed; 12-27-2013 at 06:08 PM. Reason: grammar said to |
![]() |
![]() |
![]() |
#14 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,542
Karma: 19001081
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Thanks for the tests. I've updated the plugin to fix some of the problems.
|
![]() |
![]() |
![]() |
#15 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,485
Karma: 29308976
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
![]() Quote:
I got the standard notification of new version for an installed plugin, I now have the icons I see the PDF in Book Details Last edited by BetterRed; 12-29-2013 at 01:06 AM. |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[GUI Plugin] KindleUnpack - The Plugin | DiapDealer | Plugins | 508 | 02-27-2025 12:33 PM |
[GUI Plugin] EpubMerge | JimmXinu | Plugins | 555 | 01-18-2025 06:08 PM |
[GUI Plugin] Ex Libris | AlPe | Plugins | 87 | 10-10-2020 03:10 PM |
[GUI Plugin] Wordpress | frescogamba | Plugins | 11 | 04-06-2015 09:09 PM |
[GUI Plugin] Plugin Updater **Deprecated** | kiwidude | Plugins | 159 | 06-19-2011 12:27 PM |