fenfire-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ff-cvs] fenfire/org/fenfire/fenpdf importpdf.py


From: Asko Soukka
Subject: [ff-cvs] fenfire/org/fenfire/fenpdf importpdf.py
Date: Sun, 17 Aug 2003 12:47:01 -0400

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Branch:         
Changes by:     Asko Soukka <address@hidden>    03/08/17 12:47:01

Modified files:
        org/fenfire/fenpdf: importpdf.py 

Log message:
        recognizing PDF, PS, PNG, GIF... not sure about JPEG

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/fenpdf/importpdf.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: fenfire/org/fenfire/fenpdf/importpdf.py
diff -u fenfire/org/fenfire/fenpdf/importpdf.py:1.1 
fenfire/org/fenfire/fenpdf/importpdf.py:1.2
--- fenfire/org/fenfire/fenpdf/importpdf.py:1.1 Fri Aug 15 02:58:23 2003
+++ fenfire/org/fenfire/fenpdf/importpdf.py     Sun Aug 17 12:47:01 2003
@@ -43,8 +43,17 @@
 
     BUGS: assumes PDF
     """
-    # XXX SUPPORT PS!
-    scrollBlock = fen.alph.addFile(file, 'application/pdf')
+
+    f = open(str(file), 'rb')
+    type = f.read()[0:4]
+    f.close()
+    
+    if type.endswith('PDF'): p('Importing PDF'); scrollBlock = 
fen.alph.addFile(file, 'application/pdf')
+    elif type.endswith('PS'): p('Importing PostScript'); scrollBlock = 
fen.alph.addFile(file, 'application/postscript')
+    elif type.endswith('PNG'): p('PNG not yet supported!'); scrollBlock = None
+    elif type.startswith('GIF'): p('GIF not yet supported!'); scrollBlock = 
None
+    # XXX JPEG?!?
+    elif type.startswith('\xff\xd8\xff\xe0'): p('JPEG not yet supported!'); 
scrollBlock = None
 
     if treetime != None:
        try:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]