Monday, March 23, 2009

Patch for Linux launcher

The Linux launcher for jpdfbookmarks has a bug preventing the use of paths with spaces in the command line, the Windows launcher instead has no problem. The next release will correct this, for the time being you can easily resolve the bug substituting the script launcher in the installation directory (named target_executable.sh) with this new one.

Below are the easy steps to accomplish this in a Debian system (also shown in the side picture), and should work on any Linux system.

I suppose you have downloaded the new target_executable.sh file in your home directory, anyway open a terminal and enter the folder where you have saved the file, if you don't remember where you installed jpdfbookmarks one way to find this information is to use the command:

ls -l `whereis jpdfbookmarks`

and examine the results.

Then copy the new file over the existing one, you probably need to become superuser to accomplish this using the su or sudo commands because the installation directory is usually in a system path, if the installation directory is /usr/local/lib/jpdfbookmarks the command to use is:

sudo cp -i target_executable.sh /usr/local/lib/jpdfbookmarks/

give the new file execution permissions (maybe not strictly necessary but doesn't hurt):

sudo chmod +x /usr/local/lib/jpdfbookmarks/target_executable.sh

Now you should be able to use spaces in your commands.

I would like to thank Scott Bronson for having reported this annoying bug and also for providing the smart solution, I really appreciate your help, thank you.

7 comments:

Anonymous said...

I've written a quick-n-dirty way of joining a bunch of PDFs representing chapters into a single book, complete with bookmarks:

http://github.com/bronson/pdfdir

Thanks for JPdfBookmarks. This task would have been MUCH harder without it! Glad to help out.

Anonymous said...

Hello,
This tool sounds nice.
I would be interested by the "import bookmarks" feature.

However i think there is a small problem with that one : i always get only the page numbers and not the labels while importing (in console i have bunch of "Error: line 10 is not well formed. Will be skipped.").

Even if i :
- open a pdf file with bookmarks
- export the bookmarks
- re-import the exported bookmarks

i have the same problem.

Guess it's a line encoding problem "\r\n", "\n" .. (i'm on Linux SuSE, and using JPdfBookmarks 1.2.3).

I would need to be able to use a simple ascii file (with unix line encoding) with

/(PageNumber)>,Fitpage(CR)
(REAL_TABULATION)Test(CR)

flavianopetrocchi said...

Hi, thank you for posting. If you can send me the PDF file you are using and the text file of the bookmarks you want to import, I will make some test on my debian machine. Send all to flavianopetrocchi@gmail.com.

Anonymous said...

EXCELLENT job. I was merging and bookmarking 2 large collections of pdf files in short order. I especially like that one can run this tool in "batch" mode, too.

The only problem I have noticed is selecting Tools->Change->Look and Feel->GTK+. I get the following messages:
[lambe@crllin ~]$ jpdfbookmarks 5-star.pdf

(unknown>:4175): Gtk-WARNING **: Attempting to add a widget with type GtkButton to a GtkComboBoxEntry (need an instance of GtkEntry or of a subclass)

(unknown>:4175): Gtk-CRITICAL **: gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(unknown>:4175): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed

(unknown>:4175): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed

But all seemed to work and display OK. I am running Fedora 8 which uses (I believe) GTK 2.0

Thanks again for such a nice tool. Did I mention the excellent documentation!

flavianopetrocchi said...

Thanks for posting, I often see that warnings even in native gtk applications, their more informative to developers then to users, I find them annoying but as long as the application behaves well we can ignore them. I am working on the next version of this tool, which is almost a complete rewrite with additional possibilities both in the batch mode and in the gui mode, I am also trying to add a basic integrated pdf viewer but this will take some time.

Anonymous said...

Very useful tool! The --apply feature works just fine from the command line on a Linux box, but I'm having an issue with the --dump feature. I receive the following error message related to PDFBOX:

jpdfbookmarks --dump: org.pdfbox.cos.COSString cannot be cast to org.pdfbox.cos.COSArray

flavianopetrocchi said...

Thank you for posting, I know that bug, I'm working on a new release that should fix it. I hope I will finish it soon.