Tux

...making Linux just a little more fun!

Talkback:116/herrmann.html

[ In reference to "Automatic creation of an Impress presentation from a series of images" in LG#116 ]

Karl-Heinz Herrmann [kh1 at khherrmann.de]


Wed, 2 Jul 2008 12:23:06 +0200

Hi TAG,

I got an email a few days back including a patch to the img2ooImpress.pl script in issue 116. I would like to forward the following discussion to TAG (with permission, Rafael is CC'ed):

-------------------------------------------------------------------------

From: Rafael Laboissiere <[email protected]>
To: Karl-Heinz Herrmann <[email protected]>
Subject: Re: Bug in your img2ooimpress.pl script
Date: Tue, 24 Jun 2008 21:53:36 +0200
User-Agent: Mutt/1.5.17+20080114 (2008-01-14)
* Karl-Heinz Herrmann <[email protected]> [2008-06-24 21:39]:

> thanks for the patch... actually I stumbled onto the problem myself
> after an upgrade of OODoc some time back and sent a correction to LG
> which got published as talkback for the article. That patch is there:
> http://linuxgazette.net/132/lg_talkback.html#talkback.02
> 
> but as #116 was before they introduced talkbacks the talkback is not
> actually linked in the original article so it doesn't help people
> much. As LG is mirrored in many places the original articles are not
> changed usually.  

Indeed... Sorry for bothering you with this. It is too bad that the LG article does not link to the talkback.

> I hope -- apart from having to find and fix that bug -- that script
> was helpful :-)  

Yes, it was. I wrote another Perl script based on yours to directly convert a PDF file into ooImpress. Besides the OpenOffice::OODoc module, it needs the xpdf-utils (for pdfinfo), the pdftk, and the ImageMagick (for convert) packages. The script is attached below. [...]

and another followup by Rafael:

I am attaching below an improved version of the script. I improved the header material, put it under the GPL-3+ license and it now accepts a --size option.

I also put the script in a (kind of) permanent URL: http://alioth.debian.org/~rafael/scripts/pdf2ooimpress.pl

----------------------------------------------------------------------

Is there a possibility to "upgrade" the older TAG pages with the talk-back links? I'm of course aware of the mirror problem.

[[[ FYI to Karl-Heinz (and everyone else interested) - I manually build the Talkback style for dicussions of articles that predate the Talkback link. It doesn't help during the discussion, but it does make the published version look just as spiffy! -- Kat ]]]

In any case his improved script version might be a nice 2c tip (or mail bag) contribution.

K.-H.


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Wed, 2 Jul 2008 08:59:42 -0400

On Wed, Jul 02, 2008 at 12:23:06PM +0200, Karl-Heinz Herrmann wrote:

> Hi TAG,
> 
> I got an email a few days back including a patch to the
> img2ooImpress.pl script in issue 116. I would like to forward the
> following discussion to TAG (with permission, Rafael is CC'ed):
> 
> -------------------------------------------------------------------------
> From: Rafael Laboissiere <[email protected]>
> To: Karl-Heinz Herrmann <[email protected]>
> Subject: Re: Bug in your img2ooimpress.pl script
> Date: Tue, 24 Jun 2008 21:53:36 +0200
> User-Agent: Mutt/1.5.17+20080114 (2008-01-14)
> 
> * Karl-Heinz Herrmann <[email protected]> [2008-06-24 21:39]:
> > thanks for the patch... actually I stumbled onto the problem myself
> > after an upgrade of OODoc some time back and sent a correction to LG
> > which got published as talkback for the article. That patch is there:
> > http://linuxgazette.net/132/lg_talkback.html#talkback.02
> > 
> > but as #116 was before they introduced talkbacks the talkback is not
> > actually linked in the original article so it doesn't help people
> > much. As LG is mirrored in many places the original articles are not
> > changed usually.  

That's incorrect, actually; there are two links to the original article right at the top of that Talkback.

> Indeed...  Sorry for bothering you with this.  It is too bad that the LG
> article does not link to the talkback.
> 
> > I hope -- apart from having to find and fix that bug -- that script
> > was helpful :-)  
> 
> Yes, it was.  I wrote another Perl script based on yours to directly
> convert a PDF file into ooImpress.  Besides the OpenOffice::OODoc
> module, it needs the xpdf-utils (for pdfinfo), the pdftk, and the
> ImageMagick (for convert) packages.  The script is attached below.
>  
> [...]
> 
> and another followup by Rafael:
> 
> I am attaching below an improved version of the script.  I improved the
> header material, put it under the GPL-3+ license and it now accepts a --size
> option.
> 
> I also put the script in a (kind of) permanent URL:
> http://alioth.debian.org/~rafael/scripts/pdf2ooimpress.pl

That's very nicely written, Rafael! It even survives having "use strict;" added to it - at least once you insert "my $i;" above line 75. The only (minor) strikes that I see against it are all the outside dependencies; this essentially restricts it to a Linux system, or at least a system on which "pdftk", "convert", and "tempfile" compile and use the exact set of options that's specified. Besides, Perl already comes with the "File::Temp" module installed; there's no need to call an external prog for that.

There's also the somewhat odd line (73):

print (sprintf ("Page: %4d (out of $npages)", 0));

This would usually be written as:

printf "Page: %4d (out of $npages)", 0;

Other than those minor nitpicks, nicely done!

> ----------------------------------------------------------------------
> 
> Is there a possibility to "upgrade" the older TAG pages with the
> talk-back links? I'm of course aware of the mirror problem. 
I'm afraid not. :( Our current TAG, etc. pages are built by running a single script on the raw mailbox plus several rounds of tweaking by our fearless TAG Editor, Kat. We'd have to dig up all the old mail archives (which may not be available any longer), fix up all the bits that would break formatting - at least 3-5 hours per issue, and we've only got the one Kat to do it! - then, we'd have to rebuild the entire issue for which we were tweaking the mbox (since there would now be new files to add to the structure, plus the layout and the look is completely different) and republish them. Even if we had willing and eager volunteers ready to jump on the job - which we don't - I still wouldn't want to do it. The old LG pages are part of Linux history, and I'm hesitant to mess around with them for almost any but extreme reasons.

> In any case his improved script version might be a nice 2c tip (or mail
> bag) contribution. 

I agree! I also think that, given the LG search page and the fact that we get spidered by Google regularly, all of these links are easily found for anyone who wants to find them.

-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *


Top    Back


Rafael Laboissiere [rafael at debian.org]


Wed, 2 Jul 2008 15:57:36 +0200

* Ben Okopnik <[email protected]> [2008-07-02 08:59]:

> That's very nicely written, Rafael! It even survives having "use
> strict;" added to it - at least once you insert "my $i;" above line 75.
> The only (minor) strikes that I see against it are all the outside
> dependencies; this essentially restricts it to a Linux system, or at
> least a system on which "pdftk", "convert", and "tempfile" compile and
> use the exact set of options that's specified. Besides, Perl already
> comes with the "File::Temp" module installed; there's no need to call an
> external prog for that.
> 
> There's also the somewhat odd line (73):
> 
> ``
> print (sprintf ("Page: %4d (out of $npages)", 0));
> ''
> 
> This would usually be written as:
> 
> ``
> printf "Page: %4d (out of $npages)", 0;
> ''
> 
> Other than those minor nitpicks, nicely done!
> 

I will integrate your suggestions to the next version of the script. Thanks a lot for your feedback!

-- 
Rafael


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Sat, 5 Jul 2008 11:42:55 -0400

On Thu, Jul 03, 2008 at 03:03:27PM +0200, Rafael Laboissiere wrote:

> * Rafael Laboissiere <[email protected]> [2008-07-02 15:57]:
> 
> It is done now.  You will find a new version (SVN rev2713): of the script at
> the new URL:
> 
>     http://people.debian.org/~rafael/scripts/pdf2ooimpress.pl
> 
> I made all the changes that you suggested above and also dropped the
> dependencies on the external programs convert, pdfinfo, and pdftk.  The
> script is now pure Perl and uses the modules Image::Magick and PDF::API2.

Actually, the 'print sprintf' line is still there. :) Not that it harms anything.

I also have a general suggestion. Something I've taken to doing for module calls in scripts that I plan to distribute, particularly if the audience is likely to include people who don't know anything about Perl:

eval { use Foo::Bar };
die "Foo::Bar isn't installed on your system; it's available from http://cpan.org/.\n"
    if $@;

This, I find, leads to a lot less confusion than letting a user see

Can't locate Foo/Bar.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl /usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.7 .).
BEGIN failed--compilation aborted.

Thanks for your effort, Rafael. Given that we've had a number of people email us about it over time, I'm sure that it'll be put to good use.

-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *


Top    Back


Rafael Laboissiere [rafael at debian.org]


Sun, 6 Jul 2008 17:31:49 +0200

* Ben Okopnik <[email protected]> [2008-07-05 11:42]:

> On Thu, Jul 03, 2008 at 03:03:27PM +0200, Rafael Laboissiere wrote:
> > * Rafael Laboissiere <[email protected]> [2008-07-02 15:57]:
> > 
> > It is done now.  You will find a new version (SVN rev2713): of the script at
> > the new URL:
> > 
> >     http://people.debian.org/~rafael/scripts/pdf2ooimpress.pl
> > 
> > I made all the changes that you suggested above and also dropped the
> > dependencies on the external programs convert, pdfinfo, and pdftk.  The
> > script is now pure Perl and uses the modules Image::Magick and PDF::API2.
> 
> Actually, the 'print sprintf' line is still there. :) Not that it harms
> anything.
> 
> I also have a general suggestion. Something I've taken to doing for
> module calls in scripts that I plan to distribute, particularly if the
> audience is likely to include people who don't know anything about Perl:
> 
> ```
> eval { use Foo::Bar };
> die "Foo::Bar isn't installed on your system; it's available from http://cpan.org/.\n"
>     if $@;
> '''
> 
> This, I find, leads to a lot less confusion than letting a user see
> 
> ``
> Can't locate Foo/Bar.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl /usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.7 .).
> BEGIN failed--compilation aborted.
> ''

Thanks again for the further suggestions. I changed the script again and put the new version in the URL above.

> Thanks for your effort, Rafael. Given that we've had a number of people
> email us about it over time, I'm sure that it'll be put to good use.

Will my script be referenced somewhere in the LN web site.

-- 
Rafael


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Sun, 6 Jul 2008 11:52:27 -0400

On Sun, Jul 06, 2008 at 05:31:49PM +0200, Rafael Laboissiere wrote:

[ regarding http://people.debian.org/~rafael/scripts/pdf2ooimpress.pl ]

> * Ben Okopnik <[email protected]> [2008-07-05 11:42]:
> > 
> > This, I find, leads to a lot less confusion than letting a user see
> > 
> > ``
> > Can't locate Foo/Bar.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl /usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.7 .).
> > BEGIN failed--compilation aborted.
> > ''
> 
> Thanks again for the further suggestions.  I changed the script again and
> put the new version in the URL above.
> 
> > Thanks for your effort, Rafael. Given that we've had a number of people
> > email us about it over time, I'm sure that it'll be put to good use.
> 
> Will my script be referenced somewhere in the LN web site.

Assuming that you mean 'LG', yes - that's why I've been CCing The Answer Gang on our exchanges. TAG is our way of getting this kind of info out to the world.

-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *


Top    Back