Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 02-06-2025, 01:09 PM   #1
hkngrdk
Junior Member
hkngrdk began at the beginning.
 
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.
Attached Files
File Type: zip PDF_to_EPUB_Converter.zip (2.6 KB, 103 views)
hkngrdk is offline   Reply With Quote
Old 02-06-2025, 02:47 PM   #2
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
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.
BeckyEbook is online now   Reply With Quote
Old 02-06-2025, 03:02 PM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is online now   Reply With Quote
Old 02-06-2025, 10:02 PM   #4
hkngrdk
Junior Member
hkngrdk began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2025
Device: Samsung Galaxy s8
Thank you both.
hkngrdk is offline   Reply With Quote
Old 02-07-2025, 02:45 PM   #5
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,670
Karma: 23468403
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by BeckyEbook View Post
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.
Try perplexity.ai. For simple tasks it actually produces code that looks like it might work. And if you ask it to create a pdf to epub converter, it'll tell you that it can't do it.
Doitsu is offline   Reply With Quote
Old 02-08-2025, 01:54 PM   #6
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
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
BeckyEbook is online now   Reply With Quote
Old 02-10-2025, 05:35 PM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
Attached Files
File Type: zip PDFtoEPUBConverter.zip (2.9 KB, 82 views)

Last edited by DiapDealer; 02-10-2025 at 06:58 PM.
DiapDealer is online now   Reply With Quote
Old 02-11-2025, 05:55 AM   #8
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
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
* Loading UI for PySide6 from here:
https://github.com/Sigil-Ebook/BibiR..._utils.py#L378

* The dialog box with labels in English is more understandable to most:
BeckyEbook is online now   Reply With Quote
Old 02-11-2025, 07:08 AM   #9
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is online now   Reply With Quote
Old 02-11-2025, 10:17 AM   #10
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is online now   Reply With Quote
Old 02-11-2025, 08:40 PM   #11
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,613
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Quote:
Originally Posted by DiapDealer View Post
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.

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.
roger64 is offline   Reply With Quote
Old 02-11-2025, 10:10 PM   #12
retiredbiker
Evangelist
retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.
 
retiredbiker's Avatar
 
Posts: 441
Karma: 3367292
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Jutoh, Kobo Forma
Quote:
Originally Posted by roger64 View Post
I use it regularly and it's indeed quite precise for normal text if you use good scans....
I also use it almost daily, version 5.4.1 on Pop!_os. I agree it is very good, really excellent in fact, on "good scans".

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.
retiredbiker is offline   Reply With Quote
Old 02-12-2025, 06:13 AM   #13
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is online now   Reply With Quote
Old 02-12-2025, 10:35 PM   #14
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
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.
roger64 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 10:21 AM.


MobileRead.com is a privately owned, operated and funded community.