Today I learned some new Sigil tricks. You know how when you convert from PDF to html, you end up with lots of extra formatting? Getting rid of all the extra stuff is by far the most difficult and time-consuming part of the conversion process. I’ve found some new/interesting tricks.

It is possible to create a css stylesheet from within Sigil. You just right-click the Styles folder and start a new one. Copy/paste the style info that’s useful from your PDF file. It won’t be all of it. There’s a whole section of extra stuff you can just delete. It will be within one of the sets of style tags and has a lot of sgc-34 and other numbers. Just get rid of it. Then copy/paste what’s between the other set of style tags and move that over to your style sheet that you’ve created. Then, within every html file (or chapter) you’ll need to link back to it in the “head” section of your html, right after the last “title” tag. It should look roughly like this: (enclose in tags for it to work)
link rel=”stylesheet” href=”../Styles/Style0001.css” type=”text/css” /
When you have that in there, you can go into your css file and update your entire document at once. Very helpful & time-saving!

Let’s say you have a standard style you use for almost all your books. Sigil will allow you to go out and grab that file from somewhere else and then will add it to the zip file.

I had a weird case when I was working with an InDesign file exported to .epub. Because the original document was created in separate files, when it converted it, it just gave me empty html files but no text. I ended up taking the PDF and copy/pasting the text directly into html view. Before switching to book view, I inserted all the paragraph breaks and formatting. It turned out to be a very clean file & pretty easy to do. All my css was in the css file where it belonged, so all I had to do was put the right class on each paragraph. This is a good way to go, especially if your navigation is already set up.

Hope this helps!

Tagged on: