MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Plugins (https://www.mobileread.com/forums/forumdisplay.php?f=268)
-   -   PrincePDF: PDF export (https://www.mobileread.com/forums/showthread.php?t=274972)

lxs602 07-06-2021 06:43 PM

PrincePDF and styles.css on Linux
 
Hi,

I am trying to use the PrincePDF plugin on Sigil 1.6.0 on Linux.

I added
Code:

"style": true,
to /home/user/.local/share/sigil-book/sigil/plugins_prefs/PrincePDF/PrincePDF.json to enable a custom stylesheet, style.css.

I put a custom style.css in the following directories, but the plugin does not find it (The epub file is in /home/user):

Quote:

/home/user/.local/share/sigil-book/sigil/plugins_prefs/PrincePDF/PrincePDF.json
/home/user/.local/share/sigil-book/sigil/plugins/PrincePDF
/home/user/.local/share/sigil-book/sigil/
/home/user
I get the error:
Code:

prince: Applying style sheets...
prince: loading style sheet: ../style.css
prince: ../style.css: warning: can't open input file: No such file or directory


The below is just a guess as I cannot code (it did not work), but I also tried temporarily changing the line in plugin.py , from:
Code:

stylesheet_path = os.path.join(bk._w.plugin_dir, bk._w.plugin_name, 'style.css')
to:
Code:

stylesheet_path = os.path.join('/home/user', 'style.css')
Where should I put the styles.css file?

Thanks,

L

DiapDealer 07-06-2021 07:44 PM

Quote:

Originally Posted by lxs602 (Post 4136659)
Hi,

I am trying to use the PrincePDF plugin on Sigil 1.6.0 on Linux.

I added
Code:

"style": true,
to /home/user/.local/share/sigil-book/sigil/plugins_prefs/PrincePDF/PrincePDF.json to enable a custom stylesheet, style.css.

I put a custom style.css in the following directories, but the plugin does not find it (The epub file is in /home/user):



I get the error:
Code:

prince: Applying style sheets...
prince: loading style sheet: ../style.css
prince: ../style.css: warning: can't open input file: No such file or directory


The below is just a guess as I cannot code (it did not work), but I also tried temporarily changing the line in plugin.py , from:
Code:

stylesheet_path = os.path.join(bk._w.plugin_dir, bk._w.plugin_name, 'style.css')
to:
Code:

stylesheet_path = os.path.join('/home/user', 'style.css')
Where should I put the styles.css file?

Thanks,

L

The 'style.css' file goes in the plugin folder. The second one in the list of folders you tried.

Code:

/home/user/.local/share/sigil-book/sigil/plugins/PrincePDF
Obviously "user" needs to be changed to your actual user name. It works as described for me. But I'm worried about your output:

Code:

prince: loading style sheet: ../style.css
Is that the actual output you're seeing? Because when I run the plugin, it shows the entire path to the style.css file:

Code:

prince: loading style sheet: /home/<USER>/.local/share/sigil-ebook/sigil/plugins/PrincePDF/style.css

lxs602 07-07-2021 04:26 PM

Hi,

That was the actual output: https://imgur.com/a/BxMx613

https://imgur.com/a/BxMx613

I just ran Sigil from terminal, and I noticed:
Quote:

Debug: URLSchemeHandler failed request for: QUrl("sigil:///tmp/Sigil-WLAXFL/OEBPS/style.css")
I copied style.css to the /tmp/Sigil-WLAXFL/OEBPS/style.css and it worked.

Also, I can now see that I was incorrectly using "styles.css", rather than style.css.

DiapDealer 07-07-2021 05:37 PM

You don't want to be copying stuff to Sigil's scratch (temp) directory. Bad things can happen. But then the plugin's code doesn't indicate it would be looking for the custom style.css file in that location in the first place.

Did you make sure to run Sigil's Tools > Restructure Epub to Sigil Norm before running the PrincePDF plugin? It sounds to me that there are some pathing issues you're running into.

As per the plugin's notes from the first page:
Quote:

This plugin does not support non-standard epubs. Select Tools > Restructure Epub to Sigil Norm before running this plugin with Sigil 1.0 and higher.


All times are GMT -4. The time now is 08:28 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.