LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 05-01-2013, 10:28 PM   #1
Geremia
Member
 
Registered: Apr 2011
Distribution: Slackware 14.1
Posts: 173

Rep: Reputation: 5
Okular bookmarks, annotations lost for renamed PDFs, etc. (Okular 0.16.2, KDE 4.10.2)


Okular stores PDF bookmarks and annotations in ~/.kde/share/apps/okular/docdata. However, when I rename a PDF document, its associated bookmarks and annotations are lost because docdata still contains the PDF document's old filename.

How do I restore PDF bookmarks and annotations to PDFs whose filenames have changed?

thank you
 
Old 05-02-2013, 12:34 AM   #2
Diantre
Member
 
Registered: Jun 2011
Distribution: Slackware
Posts: 372

Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by Geremia View Post
How do I restore PDF bookmarks and annotations to PDFs whose filenames have changed?
The xml files in ~/.kde/share/apps/okular/docdata are named this way:

Code:
<size>.<file>.xml
Where <size> is the file size in bytes and <file> is the file name.

So let's suppose I have a test.pdf file which is 4667911 bytes in size. I open it with Okular and add some annotations. This creates a 4667911.test.pdf.xml in the docdata directory.

Then I rename test.pdf to renamed.pdf, and open it in Okular, which creates 4667911.renamed.pdf.xml. But, as you mention, there are no bookmarks nor annotations. They remain in 4667911.test.pdf.

So, copy (or move) 4667911.test.pdf.xml to 4667911.renamed.pdf.xml. That should solve your problem.

Good luck!

EDIT: Disclaimer: I have KDE 4.8.5 and Okular 0.14.3, so I don't know if okular changed the file format in any way. I suppose not. YMMV.

Last edited by Diantre; 05-02-2013 at 12:40 AM.
 
Old 05-02-2013, 11:34 AM   #3
Geremia
Member
 
Registered: Apr 2011
Distribution: Slackware 14.1
Posts: 173

Original Poster
Rep: Reputation: 5
Quote:
Originally Posted by Diantre View Post
The xml files in ~/.kde/share/apps/okular/docdata are named this way:

Code:
<size>.<file>.xml
Where <size> is the file size in bytes and <file> is the file name.

So let's suppose I have a test.pdf file which is 4667911 bytes in size. I open it with Okular and add some annotations. This creates a 4667911.test.pdf.xml in the docdata directory.

Then I rename test.pdf to renamed.pdf, and open it in Okular, which creates 4667911.renamed.pdf.xml. But, as you mention, there are no bookmarks nor annotations. They remain in 4667911.test.pdf.

So, copy (or move) 4667911.test.pdf.xml to 4667911.renamed.pdf.xml. That should solve your problem.
Thanks, but I've tried this, and unfortunately to no avail. I think ~/.kde/share/apps/okular/bookmarks.xml still contains the old filename, too…
 
Old 05-02-2013, 02:05 PM   #4
Diantre
Member
 
Registered: Jun 2011
Distribution: Slackware
Posts: 372

Rep: Reputation: 143Reputation: 143
Yes, you're right. The method I mentioned before works fine with annotations, but not with bookmarks. Sorry about that.

The bookmarks.xml file hold the bookmarks for all documents opened in Okular. In my example test.pdf I added one bookmark, and this is what Okular adds to the file:

Code:
 <folder href="file:///tmp/test.pdf">
  <title>/tmp/test.pdf</title>
  <bookmark href="file:///tmp/test.pdf#18">
   <title>#19</title>
   <info>
    <metadata owner="http://freedesktop.org">
     <bookmark:icon name="application-pdf"/>
    </metadata>
   </info>
  </bookmark>
 </folder>
Each file opened gets a <folder> tag, and every bookmark for the file is stored inside a <bookmark> tag. The full pathname to the file is in the attribute href in both tags.

After changing this href value to the full path of renamed.pdf, the bookmarks created in test.pdf work in renamed.pdf. Have you tried this?
 
1 members found this post helpful.
Old 05-04-2013, 01:51 PM   #5
Geremia
Member
 
Registered: Apr 2011
Distribution: Slackware 14.1
Posts: 173

Original Poster
Rep: Reputation: 5
Quote:
Originally Posted by Diantre View Post
Yes, you're right. The method I mentioned before works fine with annotations, but not with bookmarks. Sorry about that.

The bookmarks.xml file hold the bookmarks for all documents opened in Okular. In my example test.pdf I added one bookmark, and this is what Okular adds to the file:

Code:
 <folder href="file:///tmp/test.pdf">
  <title>/tmp/test.pdf</title>
  <bookmark href="file:///tmp/test.pdf#18">
   <title>#19</title>
   <info>
    <metadata owner="http://freedesktop.org">
     <bookmark:icon name="application-pdf"/>
    </metadata>
   </info>
  </bookmark>
 </folder>
Each file opened gets a <folder> tag, and every bookmark for the file is stored inside a <bookmark> tag. The full pathname to the file is in the attribute href in both tags.

After changing this href value to the full path of renamed.pdf, the bookmarks created in test.pdf work in renamed.pdf. Have you tried this?
No, but it seems it would work, thanks. This would be a good feature request for future versions, where a dialog box would pop up asking to find the file's new location.
 
1 members found this post helpful.
  


Reply

Tags
bookmarks, kde, pdf


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] KDE how to ark to call Okular? matiasar Linux - Software 2 02-23-2013 11:45 AM
To the effect of, starting kubuntu, and Okular not opening PDFs automatically. Bhakta Neal Linux - Newbie 1 07-22-2012 03:10 PM
LXer: Annotating PDFs With the Open-Source Software Package Okular LXer Syndicated Linux News 0 03-23-2010 09:42 PM
kde 4 - kubuntu - okular with japanese fonts checkmate3001 Linux - Software 1 02-24-2009 02:17 AM
Why Do I Need KDE for Okular PDF Reader?? taurusx5 Linux - Software 1 04-03-2008 07:11 PM


All times are GMT -5. The time now is 09:42 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration