Bug 110353

Summary: kpdf can't open some pdf files
Product: [Applications] kpdf Reporter: Antonio E. <aironmail>
Component: generalAssignee: Albert Astals Cid <aacid>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: This is one of the pdf files.

Description Antonio E. 2005-08-07 17:52:08 UTC
Version:           0.4.2 (kde 3.4.2) (using KDE KDE 3.4.2)
Installed from:    Gentoo Packages
Compiler:          gcc 3.3.5
OS:                Linux

I've got a couple of pdf files that kpdf can't open. Xpdf and kghostview, and also the previous version of kpdf can open them perfectly. The have tables inside rotated 90 degrees. I want to attach the file.
Comment 1 Antonio E. 2005-08-07 17:58:09 UTC
Created attachment 12126 [details]
This is one of the pdf files.

This is one of the pdf files that kpdf can't open.
Comment 2 Albert Astals Cid 2005-08-08 01:54:27 UTC
SVN commit 443936 by aacid:

Fix %%EOF checking
BUGS: 110353


 M  +9 -1      PDFDoc.cc  


--- branches/KDE/3.4/kdegraphics/kpdf/xpdf/xpdf/PDFDoc.cc #443935:443936
@@ -127,7 +127,15 @@
     eof[i] = ch;
   }
   eof[i] = '\0';
-  if (strstr(eof, "%%EOF") == NULL)
+  
+  bool found = false;
+  for (i = i - 5; i >= 0; i--) {
+    if (strncmp (&eof[i], "%%EOF", 5) == 0) {
+      found = true;
+      break;
+    }
+  }
+  if (!found)
   {
     error(-1, "Document does not have ending %%EOF");	      
     errCode = errDamaged;