View Full Version : HOWTO: Making Wikipedia and Wikibooks BeBook-friendly


oddity
05-04-2009, 05:25 AM
Wikipedia is an online encyclopedia and Wikibooks is a similar site that offers books.

If you want to read Wikipedia articles or Wikibooks books on BeBook, try this:

Go to Wikipedia or Wikibooks and access the article or the book you want. On the toolbox there is a box about collections. There, click on the Add link to add the page you are reading to your collection. Access any other pages you want to have in the same file and click the Add link while you read them. After you have accessed and added all the pages you need, click on the Show Collection link to see your collection.

You can then download your collection as either a PDF file or an OpenOffice wordprocessor (ODT) file.

The PDF may not look good on BeBook, so what you need is the OpenOffice ODT file. Download the ODT file and then open it with OpenOffice.org.

While in OpenOffice, Save As your collection in plain text format, Word doc format, RTF format, HTML format, or any other format you prefer for reading on BeBook that OpenOffice supports.

For most Wikipedia articles and for printable editions of Wikibooks books, you probably only need one page in each collection. Just Add it and then Show Collection and Download, and then convert it for BeBook use.


HOWTO: Creating BeBook-friendly PDFs for Wikipedia and Wikibooks pages

Reading Wikipedia/Wikibooks articles as RTF or other text format is nice, but sometimes due to images or extensive formatting you might feel the need for reading them as PDF files. Unfortunately Wikipedia/Wikibooks PDF export makes the text too small for BeBook's screen, but there is a solution:

Access the Wikipedia or Wikibooks page(s) you are interested in and add it/them to a new collection through the site's collection facility.

Access your collection and download the collection as an OpenOffice (odt) file.

Open the odt file with OpenOffice and click on Format->Page menu. Change the paper size to: 3.54 inches wide x 4.72 inches high. Set the margins to 0.00 inches if you want to use all of BeBook's screen or 0.05 or 0.10 or any other margin you feel comfortable with. Then click OK and answer YES to OpenOffice's question about printing range.

After you have set the paper size and margin, export the odt file as a pdf file, either through the toolbar or the File->Export to PDF menu.

Then transfer this PDF to your BeBook and it should display in readable large print.

With OpenOffice you can even change the typeface (eg from sans-serif to serif) before saving the PDF.

This way the PDF will be readable on BeBook and still contain all images and formatting that is present in the Wikipedia/Wikibooks article.

the pagesize of 3,54 x 4,72 inch is equivalent to 90 x 120 mm


One problem you might notice upon converting a wikibook from odt to pdf through openoffice is that some or all hyperlinks might not display at all on the bebook. You can see all hyperlinks if you convert from odt to html, though.


You can create an OpenOffice macro to semi-automate the procedure:

Download a wikibook or wikipedia article collection as an odt file, open it with openoffice and goto menu Tools->Macros->Record Macro.

Select all text with CTRL+A, right-click and choose Default Formatting. With all text selected, you can optionally change the font to one of your liking (my system default is DejaVu Serif which I hate it, so I change it to another serif font which I like best and closely resembles Times New Roman which I like best, it's the FreeSerif font). Then go to Format->Page and put 3.54 inch (9cm or 90mm) for the paper's width and 4.72 inch for the height (12cm or 120mm), this is the size of the BeBook's screen, and then in the margin section change the left and other margins to the values you like best (I use 0.20 inch for left and 0.10 for the other margins). Click OK and Yes. Save the odt document and then export it as PDF. Then hit the Stop Recording button and save your macro.

Open another file and try your macro, it should work okay, except that you should re-enter the paper and margin values, but all the rest is automated.


here is my OpenOffice macro for transforming any odt (or other file opened with OpenOffice) to BeBook-readable PDFs.

Remember the paper size must be set to 3.54x4.72 and the margins to anything you like (0.2x0.2x0.2x0.2 or 0.1, 0.05 or other, you can also set the left margin slightly larger than the rest)

you may use this code as public domain.

For the code to work, you must change two things:

Where I write FONT you should replace this with your favourite font typeface. Use "Times New Roman", "Free Serif", "Liberation Serif", or "DejaVu Serif" depending on which font you have installed and what you like best.

Where I write PATH you should replace this with the directory path where you want to have your PDFs saved into. Use \ for the directory delimiter. An example for Windows is file://C:/PDFs/ and an example for GNU/Linux and Unix is file:///home/george/PDFs/

REM ***** BASIC *****

sub BeBookPDF
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:ResetAttributes", "", 0, Array())

rem ----------------------------------------------------------------------
dim args3(4) as new com.sun.star.beans.PropertyValue
args3(0).Name = "CharFontName.StyleName"
args3(0).Value = ""
args3(1).Name = "CharFontName.Pitch"
args3(1).Value = 2
args3(2).Name = "CharFontName.CharSet"
args3(2).Value = -1
args3(3).Name = "CharFontName.Family"
args3(3).Value = 3
args3(4).Name = "CharFontName.FamilyName"
args3(4).Value = "FONT"

dispatcher.executeDispatch(document, ".uno:CharFontName", "", 0, args3())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageDialog", "", 0, Array())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Save", "", 0, Array())

rem ----------------------------------------------------------------------
dim args6(2) as new com.sun.star.beans.PropertyValue
dim basefilename
dim sourceObject
GlobalScope.BasicLibraries.LoadLibrary("Tools")
sourceObject = thisComponent
basefilename=GetFileNameWithoutExtension(sourceObj ect.url,"/")
args6(0).Name = "URL"
args6(0).Value = "file://PATH/" + basefilename + ".pdf"
args6(1).Name = "FilterName"
args6(1).Value = "writer_pdf_Export"
args6(2).Name = "SelectionOnly"
args6(2).Value = false

dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, args6())


end sub

wallcraft
05-04-2009, 08:49 AM
Calibre imports ODT, so it is worth trying converting them to (say) MOBI using Calibre. This won't give you as much control as ODT->PDF, but the result will be reflowable.

DaleDe
05-05-2009, 02:43 PM
Our wiki now supports collecting pages and making your own eBook from the wiki. Thank Alex for adding this.

Dale

nrapallo
05-05-2009, 04:55 PM
Our wiki now supports collecting pages and making your own eBook from the wiki. Thank Alex for adding this.

Dale

WOW! Looks like a great feature to have! For help with this new feature, go here (http://wiki.mobileread.com/wiki/Help:Books).

EDIT: Or just go to Dale's announcement Make your own book from our wiki (http://www.mobileread.com/forums/showthread.php?t=46202) that I just spotted! :smack: