07-09-2023, 07:55 PM | #1 |
Wizard
Posts: 1,107
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
svg
I was attempting to recreate a title page in an epub v3 that matches a pbook that I own.
I created the svg code in Calibre editor and it looks pretty good in the Calibre editor and Calibre viewer. See image 1 When I loaded it into my stock standard Libra 2, it looks like garbage. I only use svg for occasional images so I don't have a huge amount of experience with it. Anybody see where I have gone wrong? I have since opted to create and use a png instead, but still curious on where I have gone wrong. |
07-09-2023, 10:53 PM | #2 |
Bibliophagist
Posts: 35,513
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Did you send it to your Libra 2 as an epub or kepub?
Also, if you are going to post code here, please post it as text wrapped in a code box and preferably wrapped in spoiler tags. Not to mention, posting the relevant contents of your stylesheet.css would have been helpful. OTOH, the first line of your code ( <svg width="1200" height="1600" version="1.1" xmlns="http://www.w3.org/2000"> ) when typed into a epub3 file caused epubcheck to spit out: Code:
Error while parsing file: element "svg" not allowed here; expected the element end-tag, text, element "a", "abbr", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "blockquote", "br", "button", "canvas", "cite", "code", "data", "datalist", "del", "details", "dfn", "dialog", "div", "dl", "em", "embed", "epub:switch", "epub:trigger", "fieldset", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "i", "iframe", "img", "input", "ins", "kbd", "label", "link", "main", "map", "mark", "menu", "meta", "meter", "nav", "ns1:math", "ns2:svg", "object", "ol", "output", "p", "picture", "pre", "progress", "q", "ruby", "s", "samp", "script", "section", "select", "small", "span", "strong", "sub", "sup", "table", "template", "textarea", "time", "u", "ul", "var", "video" or "wbr" (with xmlns:ns1="http://www.w3.org/1998/Math/MathML"xmlns:ns2="http://www.w3.org/2000/svg") or an element from another namespace" |
07-09-2023, 11:29 PM | #3 |
Wizard
Posts: 1,107
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Oh, yes, I should have posted the code so it could be copied and pasted. Slipped my mind at the time.
Spoiler:
I send to the Libra 2 as epub. I am not getting any such error here. I guess something is incomplete at your end, but try with the above code. CSS... Spoiler:
That is what I have. Last edited by Karellen; 07-09-2023 at 11:33 PM. |
07-09-2023, 11:50 PM | #4 |
Bibliophagist
Posts: 35,513
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
|
07-10-2023, 02:05 AM | #5 |
Wizard
Posts: 1,107
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
So you couldn't get it to work correctly either?
I guess it might be Libra 2 software not playing nice. Thanks for looking |
07-10-2023, 02:23 AM | #6 |
The Grand Mouse 高貴的老鼠
Posts: 71,515
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
|
I suspect it's the use of CSS styling inside the SVG. I think it's supposed to work, but I'm guessing the Libra 2 isn't doing it properly.
I'd try with a stand-alone SVG file, when the SVG file defines the fonts, sizes, etc. |
07-10-2023, 03:06 AM | #7 | |
Wizard
Posts: 1,107
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
Do you mean convert it into an svg image file or do you mean that there is an svg file that works similar to a stylesheet.css and link that to my svg code? |
|
07-10-2023, 06:28 AM | #8 |
The Grand Mouse 高貴的老鼠
Posts: 71,515
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
|
Yes, an svg image file. Or just don't use the CSS inside your in-line svg image.
|
07-10-2023, 08:56 AM | #9 |
Wizard
Posts: 1,551
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Three things you must do:
1) Style your svg INLINE (otherwise, you won't be able to do the next step). 2) After that, open it on Inkscape and convert all svg objects to PATHS. 3) Save the svg as PLAIN SVG. After that, all your issues will have disappear under Kobo. Last edited by RbnJrg; 07-10-2023 at 08:59 AM. |
07-10-2023, 06:36 PM | #10 | ||
Wizard
Posts: 1,107
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
Quote:
I have downloaded and installed Inkscape, and I can see I am in for a pretty steep learning curve. I thought I could just copy and paste my existing code above into Inkscape, but no such luck. Looks like it needs to be created from scratch. Might take a bit of time to figure out, but not unachievable. |
||
07-10-2023, 08:38 PM | #11 | |
Wizard
Posts: 1,551
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
By the way, you could have designed your svg directly from Inkscape; it's quite easy to do it (simpler than what you made writing the code by hand). In the Help menu you'll find some good tutorials to learn Inkscape (is easy). |
|
07-10-2023, 09:25 PM | #12 |
Bibliophagist
Posts: 35,513
Karma: 145557716
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Other than the random house logo image not be present, I inlined the svg and imported it into Inkscape. I've attached the output png to this message. I also set the svg to 600x800 and then exported a 1200x1600 png.
Last edited by DNSB; 07-10-2023 at 09:35 PM. Reason: added extra image. Forgot to change the name so the second image survived |
07-11-2023, 08:03 PM | #13 | ||
Wizard
Posts: 1,107
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
Spoiler:
I am sorry, but I am being a bit obtuse here. My question is "How?" How do I open it in Inkscape? I have done the File>Open, but what am I opening? There is no option to import the epub. If I save that code to an xml, html or xhtml file, it is not a recognised format, so it doesn't appear in the list. If I save it with .svg extension it says "Failed to open requested file". Copy and paste doesn't work. So what am I opening? Quote:
At the moment I use photoshop and just create whatever images I need, but it will be good to learn more about svg images. Great. Thank you. |
||
07-11-2023, 08:19 PM | #14 |
Grand Sorcerer
Posts: 6,498
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
|
|
07-11-2023, 08:21 PM | #15 |
Wizard
Posts: 1,107
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
<svg><text> | Karellen | ePub | 4 | 07-03-2022 01:34 PM |
Can't add cover in Calibre -- get "svg-error" (the property 'svg' should be declared) | Just some guy | Editor | 7 | 04-11-2017 09:54 PM |
<svg> to <img> | codrutoctavian | ePub | 8 | 03-01-2012 08:54 PM |
Problems with SVG's | ferulebezel | Conversion | 0 | 10-29-2011 09:15 PM |
MathML TO SVG | saravanan.p | ePub | 2 | 08-11-2011 11:38 AM |