On Fri, Feb 02, 2007 at 11:44:09PM +0100, Uwe Stöhr wrote: > > Let me be more provoking. So, to solve a bug related to PDF files generated > > by an obscure application on Mac, you are willing to break LyX on an entire > > platform?! > > No, of course not. Note that the bug was there on all platforms, not only > on Windows. Just to answer you comparison: System Solaris would then > prevent a bugfix on systems Linux and Windows, it's the point of view > what breaks what ;-)
I have no doubt: Windows breaks everything ;-) > I can revert my commit but the bug would then stay open until the next > Solaris come out. I currently see no other way to solve this. OK? Thanks, but I think that you will not have to wait so much ;-) > I asked on the list and as nobody complained I put it in. Please shout > the next time. I did so when I became aware of the problem. Attached you can find a patch to configure.py defining a converter PDF->PNG when the convert command supports the -define option. Please test. I verified through "-dbg graphics" that it is indeed used, but it doesn't solve bug 2418 for me. I tested it with the pdf file attached to bug 2418. I also tried convertDefault.py with that option but got the same result. With both ImageMagick 6.2.7 (native) and 6.3.0 (cygwin) I still get an A4 page format in the preview within LyX. Much ado about nothing, seemingly :( -- Enrico
Index: lib/configure.py =================================================================== --- lib/configure.py (revision 17030) +++ lib/configure.py (working copy) @@ -1,4 +1,5 @@ #! /usr/bin/env python +# -*- coding: utf-8 -*- # # file configure.py # This file is part of LyX, the document processor. @@ -226,6 +227,62 @@ def checkLatex(dtl_tools): return '' +def checkConvertOpts(conv_opts): + ''' + Check whether ImageMagick convert supports the option for using the + CropBox rather than the MediaBox for the PDF->PNG conversion + ''' + # Write a minimal pdf file + writeToFile('chkconvert.pdf', '''\ +%PDF-1.3 +%Çì¢ +4 0 obj +<</Type/Page/MediaBox [0 0 612 792] +/Parent 3 0 R +/Resources<</ProcSet[/PDF] +>> +>> +endobj +3 0 obj +<< /Type /Pages /Kids [ +4 0 R +] /Count 1 +>> +endobj +1 0 obj +<</Type /Catalog /Pages 3 0 R +>> +endobj +2 0 obj +<</Producer(GPL Ghostscript 8.50) +/CreationDate(D:20070202113553) +/ModDate(D:20070202113553)>>endobj +xref +0 5 +0000000000 65535 f +0000000172 00000 n +0000000220 00000 n +0000000113 00000 n +0000000015 00000 n +trailer +<< /Size 5 /Root 1 0 R /Info 2 0 R +/ID [<1D738D1FF85EC971DD3FC2E47E302B89><1D738D1FF85EC971DD3FC2E47E302B89>] +>> +startxref +329 +%%EOF +''') + # run convert on chkconvert.pdf and check result + convert_out = cmdOutput('convert ' + conv_opts + ' chkconvert.pdf chkconvert.png') + if not 'Unrecognized' in convert_out and os.path.isfile("chkconvert.png"): + convert_ok = True + else: + convert_ok = False + # remove generated files + removeFiles(['chkconvert.pdf', 'chkconvert.png']) + return convert_ok + + def checkFormatEntries(dtl_tools): ''' Check all formats (\Format entries) ''' checkViewer('a Tgif viewer and editor', ['tgif'], @@ -408,6 +465,11 @@ def checkConverterEntries(): checkProg('an EPS -> PDF converter', ['epstopdf'], rc_entry = [ r'\converter eps pdf "epstopdf --outfile=$$o $$i" ""', '']) # + path, convert = checkProg('a PDF -> PNG converter', ['convert']) + conv_opts = "-define pdf:use-cropbox=true -depth 8" + if (convert != '' and checkConvertOpts(conv_opts)): + addToRC(r'\converter pdf png "convert %s pdf:$$i png:$$o" ""' % conv_opts) + # checkProg('a Grace -> Image converter', ['gracebat'], rc_entry = [ r'''\converter agr eps "gracebat -hardcopy -printfile $$o -hdevice EPS $$i 2>/dev/null" ""