![]() |
#1 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Feb 2025
Device: Samsung Galaxy s8
|
[Plugin] Scan PDF to EPUB Converter
Hello, I wrote a plugin but it gives an error Sigil 2.4.2 python 3.13 "Error:This is not a Sigil plugin". I sent the plugin in the attachment. I would be grateful if a friend helps.
|
![]() |
![]() |
![]() |
#2 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 801
Karma: 2416112
Join Date: Jan 2017
Location: Poland
Device: Various
|
This plugin looks like it was written by AI.
Sigil plug-ins have some rules that you have to follow: a) The name cannot have spaces, so the plugin can be called PDFtoEPUBConverter. b) The main file of the plugin is to be named plugin.py. c) It is also important to write the name without spaces in the plugin.xml file as Code:
<name>PDFtoEPUBConverter</name> d) There is no "conversion" plugin type. Sigil supports "edit," "validation," "input," and "output" types. In this case, it should probably be "input," but... e) The plugin will not run anyway, because it will throw errors (e.g., missing pytesseract, pdf2image, packaging, ebooklib, bs4, and PyQt6). External libraries must be included in the plugin. f) Definitely something else. I have yet to find an AI (and out of curiosity I have tried a dozen of them) that can write a plugin for Sigil out of the box. Many of them claim that it’s clear, that of course, it will help... Unfortunately, what they offer are fabrications, non-existent functions, and misleading outputs. It doesn’t work that way, unfortunately. Even after explanations and giving examples, you get code that simply has no right to work. Maybe someday... ![]() Of course, I could be wrong and some paid AI is already able to create something brilliant after learning from the code of existing 200 plugins. AI, for its part, can help optimize already existing code. It’s just that something has to work first in order to optimize it later. |
![]() |
![]() |
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,260
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
The external libraries don't have to be a concern if you're on Linux (or you're using an external python on Windows or macOS that has those extra libraries already installed). You'd just not be easily able to share it with others if there are a lot of external dependencies. But as Becky already pointed out... you're getting a "not a Sigil plugin error" because it's not a properly constructed Sigil plugin.
|
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Feb 2025
Device: Samsung Galaxy s8
|
Thank you both.
|
![]() |
![]() |
![]() |
#5 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,670
Karma: 23468403
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#6 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 801
Karma: 2416112
Join Date: Jan 2017
Location: Poland
Device: Various
|
I tested it in the middle of last year and it was very stubborn.
Today I made a second attempt. For a person who "something-knows" about Sigil plugins, talking to perplexity.ai was a pleasure. In a few steps we came to an agreement, AI was catching my suggestions on the fly, and within seconds I was receiving a fresh version of the plugin code. I wasn't going to create a plugin to convert PDF to EPUB, but I asked for a plugin that would look up the email address in the EXIF description for JPG files. AI did not insist on its solutions, it promptly recognized its mistakes, so – after several prompts – the plugin was ready. I liked perplexity.ai (this is not an advertisement, I am simply stating the fact that I had a more pleasant conversation with this AI than with others). I know that she is getting more and more "smart" with each new conversation. So I have to admit that AI writing a working plug-in for Sigil IS possible ![]() |
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,260
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
With a limited number of changes, I have this plugin working on Linux (Python 3.13.1) after installing all of the external dependencies.
It will even run on Windows using an external Python plugin interpreter with all dependencies installed (including a preference tweak for Windows users to indicate the paths to their poppler and tesseract binaries). On Windows, one would need to launch the gui and close it at least once to generate the preferences json. Hope this helps you get going. Last edited by DiapDealer; 02-10-2025 at 06:58 PM. |
![]() |
![]() |
![]() |
#8 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 801
Karma: 2416112
Join Date: Jan 2017
Location: Poland
Device: Various
|
I confirm that it can also work on Windows with internal Python.
* Four libraries: ebooklib, packaging, pdf2image, pytesseract added to plugin. * Two external programs: Tesseract from here: https://github.com/UB-Mannheim/tesseract/wiki Poppler from here: https://github.com/oschwartz10612/po...ndows/releases * Modifying imports to use PySide6: Code:
try: from PySide6 import QtCore from PySide6.QtWidgets import QDialog, QFileDialog, QApplication from PySide6.QtUiTools import QUiLoader except: from PyQt6.QtWidgets import QDialog, QFileDialog, QApplication from PyQt6 import uic https://github.com/Sigil-Ebook/BibiR..._utils.py#L378 * The dialog box with labels in English is more understandable to most: |
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,260
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Great! I never looked into the feasibility (or potential licensing conflicts) of distributing the the extra Python modules with the plugin. Once I saw there was a need for binary dependencies (poppler and tesseract), I just took the easy way out and made it work with an external interpreter altogether. Mainly because I could easily set up a virtual Python environment to do all the testing.
|
![]() |
![]() |
![]() |
#10 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,260
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I was also quite impressed with how well tesseract did right out of the box. I'd not played with it in a lot of years.
|
![]() |
![]() |
![]() |
#11 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,613
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Quote:
I use it regularly and it's indeed quite precise for normal text if you use good scans. With current version, it recognizes italics and bold as normal text and requires special parameters for tables (and even then...) Down here with archlinux. [roger@roger-lenovo ~]$ tesseract -v tesseract 5.5.0 leptonica-1.85.0 libgif 5.2.2 : libjpeg 8d (libjpeg-turbo 3.0.4) : libpng 1.6.46 : libtiff 4.7.0 : zlib 1.3.1 : libwebp 1.5.0 : libopenjp2 2.5.3 Found AVX2 Found AVX Found FMA Found SSE4.1 Found OpenMP 201511 Found libarchive 3.7.7 zlib/1.3.1 liblzma/5.6.3 bz2lib/1.0.8 liblz4/1.10.0 libzstd/1.5.6 Found libcurl/8.12.0 OpenSSL/3.4.0 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.64.0 nghttp3/1.7.0 - for info, which AI has been used in the first place? Last edited by roger64; 02-11-2025 at 09:04 PM. |
|
![]() |
![]() |
![]() |
#12 | |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 441
Karma: 3367292
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Jutoh, Kobo Forma
|
Quote:
I've also watched, over the years, folks looking for some magic OCR to handle musty brown old two-column stuff, typeset by an orangutan, with the push of a single button! So I trust your plug-in will arrive with an Elf or Hobbit to do the proof reading ![]() Joking aside, it would be a very nice addition...just have to manage expectations. |
|
![]() |
![]() |
![]() |
#13 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,260
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'm never done any testing on scanned paper. My testing of this plugin (not my own, by the way) has been with quality PDFs (most often created from electronic sources and not from scans of paper), that are converted to images and OCRed with tesseract. Making it useful for creating reflowable text documents from quality PDFs whose original electronic sources are lost or unavailable. When last I experimented with tesseract (many years ago) it could not accomplish even that with any great success.
|
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,613
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
I had it working after installing the missing python-pytesseract, python-pdf2image, python-ebooklib as told by the prompt.
The front GUI is in turkish language. No big deal. To make it useful, we absolutely need to be able to tell previously to Tesseract which is the language of the PDF. If not, he consistently makes a mistake for each accented letter... Last edited by roger64; 02-12-2025 at 10:38 PM. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Best EPUB to PDF converter | Lordblacknail | Workshop | 14 | 08-30-2019 06:52 AM |
ePub to PDF converter | Iznogood | ePub | 5 | 04-28-2013 10:33 AM |