View Full Version : PRS-500 Software: LRF TOC Editor v1.02


hal9000
04-14-2008, 02:17 PM
http://img300.imageshack.us/img300/3258/lrftoceditor110eng.jpg

What is "LRF TOC Editor"?

Usually, when a LRF file for the SONY eReader is created, the TOC information is automatically added, but sometimes may happen that such information is not added, because the conversion tool doesn’t support it or because the source file doesn’t have a TOC, or may be that the TOC information is added but it’s incorrect or there are more or less entries that it should. In these cases "LRF TOC Editor" can open the existing LRF file, without the need to have the source file from which it was created, and then add, remove, modify or sort the TOC entries as we want, and then save these changes to the same or other LRF file. In order to work, "LRF TOC Editor" need that the application Calibre (or its former version libprs500, by Kovid Goyal, is installed on your system. It can be downloaded from http://calibre-ebook.com/. If this application is not found in its default folder, a folder selection dialog will appear to search for it.


The user interface

In the top area of the window there are two buttons to load and save a LRF, a button to change the language between English and Spanish, a help and a checkbox to control whether the text should be displayed using the book styles or using the default text style.

Under the buttons there are the two main panels. The one to the left is the TOC panel and the one to the right is the text panel.

Finally under the TOC panel there are the buttons to move the TOC entries, rename them, remove them and add new ones.


How does "LRF TOC Editor" work?

Once a LRF file has been loaded we can perform the following actions:

move the current entry up or down, using the arrow buttons under the TOC panel or pressing on the keyboard the shift key at the same time than the up or down arrow keys while the TOC panel is active
rename the current entry, using the button with the edition icon under the TOC panel or pressing the F2 key on the keyboard while the TOC panel is active
remove the current entry, using the button with a red X under the TOC panel or pressing the delete key on the keyboard while the TOC panel is active
add a new TOC entry pointing to the text selected on the text panel, using the button with a green + under the TOC panel or pressing the shift key at the same time than the enter key while the text panel is active; a new entry can only be added pointing to a text fragment which is not already assigned to another TOC entry
go to the text fragment pointed by a TOC entry, clicking on that entry or moving across the TOC with the keyboard
go to the corresponding TOC entry for a text fragment, right clicking on a currently assigned text fragment on the text panel, or pressing the space key while the text panel is active
assign the current text fragment to the current TOC entry, right clicking on a currently unassigned text fragment on the text panel, or pressing the space key while the text panel is active; by doing this the text fragment previously pointed by the TOC entry is released and that TOC entry will point now to the new text fragment

When a TOC entry is renamed the current name will be displayed so we can modify it, and when a TOC entry is created or pointed to a new text position a fragment of the text on that position will be displayed as suggestion for the name.

The added or modified TOC entries will be displayed in green. Sometimes a TOC entry may be displayed in red, this means that this entry is pointed to an inexistent text position or it’s pointed to an object that "LRF TOC Editor" cannot handle (see "limitations" section).


"LRF TOC Editor" limitations

There cannot be two or more entries in the TOC pointing to the same text position
When a text block or page is too long, there may be visualization problems in the text panel at the end of that block or page, in that cases it's necessary to view text without styles and may be use short text too
When viewing without styles the images and the canvas contents are not displayed
Even when the view with styles is enabled, what is shown by the application does not always match 100% what is shown in the actual device, mainly on for some margins, spacing and font sizes
The libprs500/Calibre version equal or older to 0.4.50 doesn’t preserve the special characters in the TOC entries, such as accentuated characters; if when opening a previously saved LRF you observe that this kind of characters have disappeared you’ll need to replace them with the equivalent standard characters, such as the equivalent unaccentuated characters; this problem has been fixed on Calibre 0.4.51
The load time for some documents is too long, I know it; may be some day I have the time to optimize it, or may be not


Acknowledgements

As said above, "LRF TOC Editor" need that the application Calibre, by Kovid Goyal, is installed in order to work. I want to thank Kovid for create Calibre and all the set of conversion tools which are part of it. I also want to thank him for bear my tickets about bugs and mainly the tickets asking for new program features. ;-)


Change log

v1.10 (07/Jan/10):
added: show the cover thumbnail for the loaded file
added: support for additional styles within a text block, instead applying an unique style to the whole block, thus allowing a representation closer to the one on the PRS screen
added: support for "<canvas>" blocks; now images will be displayed
added: "Calibre - E-book Management" and "Calibre2" paths to the possible default locations of Calibre
added: navigation through pages using CTRL+PagUp/PagDown and CTRL+Home/End
removed: page and object number for each item in TOC and text panels
removed: header row in TOC and text panels
changed: new color to highlight selected items
changed: icons for up and down buttons
changed: new TOC panel font for better visibility
changed: the way to show that a text panel item is linked to a TOC entry, showing a blue bar to its left, along the full height of the item, instead showing a checked box
changed: the way to select the TOC entry linked to a text panel item or to assign a text panel item to the current TOC entry, right-clicking with the mouse on the text panel item instead clicking on the corresponding checkbox
changed: now there are three visualization modes (full text with styles, full text without styles and short text without styles)
changed: dialogs for add/rename/reassign TOC entries so the operation can be cancelled
changed: use of external DLL for keyboard and mouse events control, as the standard method fails with the control type used for the text panel
fixed: problem with long names and with detection of the end of conversion process, which prevents the application from working on Windows XP
fixed: now if the text have an special color for its status, as for example a modified item, the color is preserved when the item is selected, changing its background color only
fixed: sometimes the available action buttons were displayed incorrectly for the current selected item
fixed: scroll position change on TOC panel when an entry is removed
fixed: sometimes there could be problems with files containing special characters in it's name; now the work is made with a renamed copy of the file

v1.02 (07/may/08): internal fixings to improve stability
v1.01 (03/may/08): modification to reflect the name change of libprs500 to Calibre, and to allow the application to find Calibre files on its default folder
v1.00 (27/apr/08): initial release

Contact

For any question, doubts or suggestion, use the following links:

. in English:
http://www.mobileread.com/forums/showthread.php?t=22823

. in Spanish:
http://www.todoumpc.com/forum/forum_posts.asp?TID=5322

____________________

"LRF TOC Editor" is free software and it can be distributed freely as long as the author and the above contact links are mentioned.

mdhuang
04-17-2008, 12:00 PM
Thank you for your efforts!
That's something I have been looking for. I downloaded many LRF files from the net and often times found that the TOC is missing or incomplete. Sometimes I manually decomplile it and edit it but it is too time consuming. A GUI based tool will be an ideal solution.

Hi.

When I create LRF file with libprs500, I often get the LRF without TOC or with a TOC which includes footnotes, or any other problems related to the TOC, so I was looking for a way to modify these LRF files to edit and fix the TOC, but as far as I know, currently there is no way to edit the TOC of an existent LRF file.

I got disappointed at first, but then I decided that if the application didn't exist I will create it, and that's what I'm doing. "LRF TOC Editor" can take an LRF, show you the content and the TOC and let you add/remove TOC entries, rename them and change the location they links to.

The application works in Windows, it's programmed in VB.NET and relies on "lrf2lrs" and "lrs2lrf", which are part of libprs500 (by Kovid Goyal) to decompile the original LRF file and recompile it once the changes are made.

It has limitations too:
• there cannot exist two or more entries in the TOC linking to the same location
• only <textblock> placed directly inside a <page> will be shown, no <canvas> nor <textblock> inside other containers (at least in the first version)
• when you select to show the content with it's original style only the style of the whole textblock is applied, ignoring substyles used locally inside the textblock

Anyway I think it results very usable even with these limitations. I hope to have it finished soon and that you find it useful... I will. :p

hal9000
04-27-2008, 11:11 AM
Ok, I finished it at last.

You can download "LRF TOC Editor" from the first post on this thread, there is a copy of the readme too, with info about the application.

I hope you find it useful. :)

------

P.S.: By the way, can a moderator change the thread title to "Software: LRF TOC Editor v1.0" please?

hal9000
04-27-2008, 12:15 PM
Oops... Sorry, the first file I uploaded was wrong. I changed it, the correct one have the suffix "_fixed".

harpum
04-27-2008, 10:07 PM
Thank you for making a TOC editing tool.
I have some LRF files from pdflrf. But I cannot use it for these files. I think the reason is these files only contains PNG file.
Can you add some functions for these files.
Thanks again.^^

JSWolf
04-27-2008, 11:18 PM
I've made the thread a sticky for easier finding.

Thank you for the ToC editor.

hal9000
04-28-2008, 04:53 AM
I've made the thread a sticky for easier finding.

Thank you for the ToC editor.
Thanks JSWolf. Could you please change the "Work in progress:" to "Software:" in the thread title. I changed it in the first message, but for the thread is still the same.

hal9000
04-28-2008, 04:56 AM
Thank you for making a TOC editing tool.
I have some LRF files from pdflrf. But I cannot use it for these files. I think the reason is these files only contains PNG file.
Can you add some functions for these files.
Thanks again.^^
Well, this version only supports text and even that is supported with some restrictions. May be the next version could support <canvas> blocks. I'll think of it.

hal9000
05-03-2008, 10:36 AM
I updated LRF TOC Editor to version 1.01 just to reflect the name change of libprs500 to calibre, and to allow the application to locate calibre on its default folder. The file can be downloaded from the first post on this thread.

hal9000
05-07-2008, 02:17 PM
I updated "LRF TOC Editor" to version 1.02. No new features has been added, just some internal fixings to improve stability. The file can be downloaded in the first post of this thread.

Lime2K
05-08-2008, 03:53 AM
Wow! Thank you so much for this awesome tool! It definitely falls into the 'I didn't realize how awesome of a tool this would be until I had it' category.

If I had some extra money, I'd send you some ^_^.

(Now, the first person who makes a tool to add images to a LRF file, I will officially love you forever!)

hal9000
06-09-2008, 07:13 AM
I'm working on the next version of LRF TOC Editor. At the moment of writing this post this is the change log for it:

v1.03 (--/---/08):
added: show the cover thumbnail for the loaded file
added: navigation through pages using CTRL+PagUp/PagDown and CTRL+Home/End
added: support for additional styles within a text block, instead applying an unique style to the whole block, thus allowing a representation closer to the one on the PRS screen
removed: page and object number for each item in TOC and text panels
removed: header row in TOC and text panels
changed: new color to highlight selected items
changed: icons for up and down buttons
changed: new TOC panel font for better visibility
changed: the way to show that a text panel item is linked to a TOC entry, showing a blue bar to its left, along the full height of the item, instead showing a checked box
changed: the way to select the TOC entry linked to a text panel item or to assign a text panel item to the current TOC entry, right-clicking with the mouse on the text panel item instead clicking on the corresponding checkbox
changed: use of external DLL for keyboard and mouse events control, as the standard method fails with the control type used for the text panel
changed: dialogs for add/rename/reassign TOC entries so the operation can be cancelled
changed: now there are three visualization modes (full text with styles, full text without styles and short text without styles)
fixed: scroll position change on TOC panel when an entry is removed
fixed: now if the text have an special color for its status, as for example a modified item, the color is preserved when the item is selected, changing its background color only
fixed: sometimes the available action buttons were displayed incorrectly for the current selected item

I hope to have it finished soon. Anyway the change log still may grow, so I'm thinking of give it version number 1.1 instead 1.03.

lionfish
06-10-2008, 02:01 AM
Hi, Hal9000:

Can this TOC editor expand to a complete LRF editor, i.e. can edit the content?

My reason is I have some LRF books but after reading I found some typing errors in them. There are two ways to fix it. This first is to fix the source text if I have and convert to LRF format. The second is to reverse it to LRS format, then manually fix it and convert back to LRF format.

hal9000
06-10-2008, 04:55 AM
Hi, Hal9000:

Can this TOC editor expand to a complete LRF editor, i.e. can edit the content?

My reason is I have some LRF books but after reading I found some typing errors in them. There are two ways to fix it. This first is to fix the source text if I have and convert to LRF format. The second is to reverse it to LRS format, then manually fix it and convert back to LRF format.

I know what you say, I have some LRF that would need to be fixed too. As for the application, well, I have enough difficulties just trying to make it work as I want, so it will remain a TOC editor by now. But who knows? May be a future version allow some kind of content editing.

Dr. Drib
06-10-2008, 01:49 PM
"The Appliciation failed to initialize properly. 0xC000013."


I have the required calibre 0.4.56 and that program's working fine. (At this particular moment, I don't plan to upgrade to the current version of calibre, as this version is working fine and I'm continuing to play with it.)

Any suggestions, anyone about getting TOC to work?

Thanks,
Don

hal9000
06-10-2008, 02:15 PM
Dr. Drib, have you installed the .NET Framework 2.0 (or later)? What OS are you using?

Dr. Drib
06-10-2008, 03:13 PM
Dr. Drib, have you installed the .NET Framework 2.0 (or later)? What OS are you using?

I'm using Microsoft XP Professional with Service Pack 2. I can't remember if I upgraded to .NET Framework 2.0.

Is there a quick way to check on that?

Also, I use AVG Anti-Virus v8.0.100, if that helps.


Thanks,
Don

hal9000
06-10-2008, 03:26 PM
Hum... I don't think it is the anti-virus. Well, if you have the .NET Framework installed it should appear in the "add/remove programs" list. Even if you have it, try to uninstall and reinstall it, since sometimes the current installation got corrupted causing this kind of error.

lionfish
06-10-2008, 09:24 PM
I know what you say, I have some LRF that would need to be fixed too. As for the application, well, I have enough difficulties just trying to make it work as I want, so it will remain a TOC editor by now. But who knows? May be a future version allow some kind of content editing.

Actually, only a 'very simple' content editing like MS notepad can fix 99.9% of the errors. Just simple editing and an "add paragraph" function will do. All other formats in the LRF file keep intact.

:thanks:

JSWolf
06-21-2008, 11:24 AM
Go to add/remove software and you'll see if .net is there for uninstall. If it is you have it, if not, you don't.

titokiza
12-12-2008, 09:17 AM
I have tried LRF TOC editor in Windows XP. It hangs up when loading a lRF file. I have deinstalled and reinstalled microsoft .net framework 2. Also a i have reinstalled calibre. Any suggestion?

Aguex
08-09-2009, 01:38 PM
Thank you very much. Very useful program :thumbsup:

kotasd
11-08-2009, 07:05 PM
I have the latest version of calibre (0.6.21) and version 1.02 of LRF TOC Editor. I am running Vista with .net 3.5 sp1. I cannot get LRF TOC Editor to load a lrf file. watching the process list it takes 25% of cpu and freezes. It does run lrf2lrs.exe occasionally but not every time. And ideas?

fortunados
11-13-2009, 05:28 AM
I have the same problem.
The program freezes loading the LRF, it takes long CPU proccessing but never opens the document.
Is it any replacement or alternative to this program ?

hal9000
01-07-2010, 10:53 AM
Well, it has take too long since the last update, but I've been rather busy with many things.

I guess that LRF TOC Editor starts to be less useful at this time, with the release of that new firmware for PRS-500 allowing the use of the ePub format and PDF with reflow. But those people who still keep LRF files or who haven't updated their reader, may still get juice from this application.

The version number skipped from 1.02 to 1.10 due to the high number of changes, some visible and some not, and to the fact of have been created on various phases, which could have become intermediate versions, but which I didn't want to release until get close to the targets I want to reach.

Basically, and as a summary, the main changes are a clearer and more easy to use interface and a closer look between what the application shows and what can be seen on the PRS-500's screen. For more details you can look at the change log.

You can find the new version in the first post of this thread. I hope you like it and find it useful.


P.S.: Could some admin or mod change the thread title so it says "1.10" instead "1.02", please? Thanks.

hal9000
01-07-2010, 10:55 AM
I have the same problem.
The program freezes loading the LRF, it takes long CPU proccessing but never opens the document.
Is it any replacement or alternative to this program ?

If you refer to the problem on Windows XP, it has been hopefully fixed on this new version.

kleinbiker
05-01-2010, 12:20 PM
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at LRF_TOC_Editor.b.a(String A_0, Int32 A_1, Double A_2)
at LRF_TOC_Editor.b.h()
at LRF_TOC_Editor.b.p(Object A_0, EventArgs A_1)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3603 (GDR.050727-3600)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
LRF TOC Editor
Assembly Version: 1.10.0.0
Win32 Version: 1.10.0.0
CodeBase: file:///C:/Data/Tools/LRF%20TOC%20Editor.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
MiniInput
Assembly Version: 2.0.2397.31337
Win32 Version: 2.0.2397.31337
CodeBase: file:///C:/Data/Tools/MiniInput.DLL
----------------------------------------
Microsoft.mshtml
Assembly Version: 7.0.3300.0
Win32 Version: 7.0.3300.0
CodeBase: file:///C:/WINDOWS/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

hal9000
05-03-2010, 06:05 AM
kleinbiker, does this happen for any LRF or a particular LRF?

pcinfoman
07-02-2010, 03:23 PM
I launch your program and I get a "Browse to Folder" popup. It says "Selecciona la carpete de libprs500". I have no idea what this is?

Is there an english version of this program?

hal9000
07-04-2010, 08:17 PM
I launch your program and I get a "Browse to Folder" popup. It says "Selecciona la carpete de libprs500". I have no idea what this is?

Is there an english version of this program?
Once you enter the program you can select Spanish or English. As for the message it means "Select the libprs500 folder" currently it should say "Select the calibre folder", but I forgot to change it.