[okular] [Bug 443055] Pdf File's Size Changed to 0 Bytes After Sudden Power Outage

Jason Liam bugzilla_noreply at kde.org
Tue Sep 28 15:43:28 BST 2021


https://bugs.kde.org/show_bug.cgi?id=443055

--- Comment #2 from Jason Liam <jlame646 at gmail.com> ---
(In reply to David Hurka from comment #1)
> > My question is that Is there a way to get back my old pdf file back
> > using these above xml files?
> 
> No, but...
> 
> > For example, i have an old pdf which is the same as the old pdf
> > except that this one doesn't have any annotations in it. So Will
> > it be possible to add these xml information into that file(that
> > doesn't have any annotation)?
> > 
> > I am using Ubuntu 18.04 x86_64 and Okular 1.3.3
> 
> This old Okular version stored annotations in these XML files. So if you
> find that one of these XML files contains your annotations, you only need to
> get the original PDF file back. Then the annotations will either appear
> magically in the PDF file, or you can figure out which new XML file is
> created for this new PDF file, and copy the annotations from the old XML
> file to the new XML file.
> 
I tried this but this doesn't seem to work. I have the following things:
1) NetworkProgramming.pdf . This file is the replica of the file that i lost
except that this old version doesn't have any annotations in it. Actually when
i downloaded this file then i copied this file to another folder and then
started adding annotation in that file. So this is the file i started with. 
2) I have the xml files for the version that had a lot of annotations in it and
which i lost. But i checked these xml files and almost all of them(AFAIK) have
a very similar content inside them. For example the xml file contains
information like the following:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE documentInfo>
<documentInfo url="/home/username/Documents/NetworkProgramming.pdf">
 <generalInfo>
  <history>
   <oldPage viewport="199;C2:0.5:0.99783:1"/>
   <oldPage viewport="200;C2:0.5:1.0038:1"/>
   <oldPage viewport="201;C2:0.5:0.990287:1"/>
   <oldPage viewport="202;C2:0.5:0.970861:1"/>
   <oldPage viewport="203;C2:0.5:0.975084:1"/>
   <oldPage viewport="204;C2:0.5:0.956503:1"/>
   <oldPage viewport="205;C2:0.5:0.0713682:1"/>
   <oldPage viewport="204;C2:0.5:0.000422297:1"/>
   <oldPage viewport="203;C2:0.5:0.00802365:1"/>
   <oldPage viewport="202;C2:0.5:0.0646115:1"/>
   <current viewport="201;C2:0.5:0.467483:1"/>
  </history>
  <views>
   <view name="PageView">
    <zoom mode="0" value="1.28479"/>
   </view>
  </views>
 </generalInfo>
</documentInfo>

I had a lot of annotations in my pdf around 2 MB or so and looking at the
content of the xml files it looks like they have very little to do with those
annotations. Is this how Okular's xml format save annotation information for
like underline, text etc? Each of these xml files takes around 800 bytes of
space.
This is what i did next:
Step 1) I put the pdf file(with not annotation) in the same folder that i lost. 
Step 2) I opened a xml file from yesterday since i added a lot of annotations
yesterday. The content of this xml file is what i have pasted above.
Step 3) Next i opened the new version(that doesn't have any annotation) of the
pdf with okular and found out the xml file that is created. Actually there were
4 new xml files that were created for this new version of pdf.
Step 4) I pasted the content that i copied from yesterday's xml to this new xml
and then save this xml file and closed the application(text editor).
Step 5) I opened the pdf version with okular to see whether the yesterday's
annotations were added but they aren't. 
What am i doing wrong? 
> To get the annotations actually in the PDF file, you will need to install a
> newer version of Okular. It should offer you to migrate the annotations from
> the XML file to the PDF file.
> 
> I am surprised that the PDF file has been lost. Your Okular version should
> theoretically not modify it...
Yes if instead a temporary file were used to write and checked if the write was
successful this problem could have been avoided.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list