Version: 0.13.2 (using KDE KDE 3.0.8) Installed from: Unlisted Binary Package OS: FreeBSD Hello, This morning I created a PDF file by using the OpenOffice 1.0.1 "Print to File" feature". The resulting file would not open in Kghostview. Here's the output in the terminal: mark@asana> kghostview 5_scenerios_for_longterm.pdf kio (KDirWatch): Can't use FAM (fam daemon not running?) kio (KDirWatch): Available methods: Stat kghostview (kdegraphics): KGVConfigDialog::readSettings kghostview (kdegraphics): KPSWidget::setupWidget() kparts: MainWindow::createGUI, part=0x80e6000 KGVPart kgvpart kghostview (kdegraphics): KGVRun::foundMimeType( application/pdf ) kghostview (kdegraphics): KGVPart::slotMimetype: type=application/pdf kghostview (kdegraphics): KGVMiniWidget::openFile kghostview (kdegraphics): Pdf2dsc: started kghostview (kdegraphics): Pdf2dsc: process exited kghostview (kdegraphics): KGVMiniWidget::openPDFFileContinue ####### The same file opens fine with "gv". Thanks! -mark
Please add such a file as attachment.
Created attachment 371 [details] simple test case for bug
I just checked the file and it is a postscript file! It doesn't open if you try to open it as PDF because, of course, PDF parsing fails. Apparently gv just ignores the extension uses magic to determine the real file type. Don't know how this case should be handled by kghostview, though.
I confirmed tonight that when I use the OpenOffice "print to PDF" feature, it is producing a file that is identical in size to the one produced by the "print to Postscript" feature-- as noted above. This is a bug in OpenOffice. Could KGhostview be updated to handle this more gracefully, though? It looks like PDF files always start like this: %PDF and Postscript files start like this: %!PS Perhaps KGhostview could be updated to check for that? Even if it just emits an better error like "file extension was .pdf, but appears to contain a Postscript file. I don't think you would even need to perform this check all the time-- it could be a last resort when the program is about to fail as it did above.
If you rename a postscript file to a name ending in .pdf, kghostview fails to open it. This is a bug, as kghostview should never rely on the file name!
I think this should be classified as a kio bug because that's where kghostview gets the mimetype guessing from.
Subject: kdelibs/mimetypes/application CVS commit by coolo: kio magic can recognize both pretty correct, so don't screw it up when using patterns (again it would be nice to have a way to specifiy that the pattern should only be used when no magic can be used) CCMAIL: 50111-close@bugs.kde.org M +0 -1 pdf.desktop 1.206 M +0 -1 postscript.desktop 1.196 --- kdelibs/mimetypes/application/pdf.desktop #1.205:1.206 @@ -4,5 +4,4 @@ MimeType=application/pdf Icon=pdf -Patterns=*.pdf;*.PDF; Comment=PDF Document Comment[af]=Pdf Dokument --- kdelibs/mimetypes/application/postscript.desktop #1.195:1.196 @@ -4,5 +4,4 @@ MimeType=application/postscript Icon=postscript -Patterns=*.ps;*.PS; Comment=PostScript Document Comment[af]=Postscript Dokument
Subject: Re: kdelibs/mimetypes/application On Wednesday 19 March 2003 22:55, David Faure wrote: > On Monday 17 March 2003 12:11, Stephan Kulow wrote: > > CVS commit by coolo: > > > > kio magic can recognize both pretty correct, so don't screw it up when > > using patterns (again it would be nice to have a way to specifiy that > > the pattern should only be used when no magic can be used) > > Interesting...... > 1) see untested patch below, if we want to go that way > 2) the xdg-defined mimetype future-standard defines the same order as the one > we had up to now: extensions first, magic as fallback. > http://www.ecs.soton.ac.uk/~tal00r/info.html#id2797567 > And I did agree with the reasoning behind it: it's easier for the user to > change the extension if the filetype isn't recognized correctly, than to > fix things if the magic goes wrong. The problem with relying on the magic is > that the magic isn't always correct! > Hmm, ok, I guess it's much more reliable for image formats and PS/PDF > than for e.g. C++ and other text-based stuff. I'm very much aware of your reasonings and would have decided the same. But fact is people don't stop naming their postscript files *.pdf for whatever reason :) And as long as we can use magic and we're pretty sure the magic works most often reliable for that file type, we should flag that somehow. I remember days when the file magic returned a percentage value of what it thought how correct it's guess was. I have no idea how it did that, but if that could work, it would be best. Second best is your patch I guess :) Greetings, Stephan
CVS commit by carewolf: We can use patterns, but we dont entirely trust them though. If noone complains I will backport to KDE_3_2_BRANCH and close 75031. CCMAIL: 75031@bugs.kde.org CCMAIL: 50111@bugs.kde.org M +2 -0 pdf.desktop 1.227 M +1 -0 postscript.desktop 1.213 --- kdelibs/mimetypes/application/pdf.desktop #1.226:1.227 @@ -4,4 +4,6 @@ MimeType=application/pdf Icon=pdf +Patterns=*.pdf;*.PDF; +X-KDE-PatternsAccuracy=90 Comment=PDF Document Comment[af]=Pdf Dokument --- kdelibs/mimetypes/application/postscript.desktop #1.212:1.213 @@ -5,4 +5,5 @@ Icon=postscript Patterns=*.ps;*.PS; +X-KDE-PatternsAccuracy=95 Comment=PostScript Document Comment[af]=Postscript Dokument