[pmwiki-users] GeneratePDF recipe limitation

Kathryn Andersen kat_lists at katspace.homelinux.org
Thu Sep 21 23:55:11 CDT 2006


On Thu, Sep 07, 2006 at 08:53:47PM -0500, Patrick R. Michaud wrote:
> On Wed, Sep 06, 2006 at 06:31:44PM +1000, Kathryn Andersen wrote:
> > I am using GeneratePDF http://www.pmwiki.org/wiki/Cookbook/GeneratePDF
> > on our Wiki at work.  I didn't use PublishPDF because it seems much more
> > difficult to set up, since we run behind a firewall and thus would have
> > to set up our own server, and I tried and I gave up.  Using the
> > generatepdf.php plus installing htmldoc was much simpler.
> > 
> > Unfortunately, I've just discovered a limitation with generatepdf -- it
> > doesn't handle images.  If there is an image on the page, it isn't
> > included in the generated PDF.
> > [...]
> > Since it was written by PM, I thought I'd send an appeal here.  Is there
> > any way of making this recipe deal with images correctly?
> 
> I've updated the recipe, see
> 
>     http://www.pmwiki.org/wiki/Cookbook/GeneratePDF
>     http://www.pmwiki.org/wiki/Cookbook/GeneratePDF?action=pdf
> 
> Essentially there are some additional arguments that need to be
> passed to htmldoc to get it to work, and an environment variable
> needs to be set.  

What environment variable?
Comparaing the two, it just looks as if the arguments to htmldoc have
changed, and that's all.
 
> Let me know if this works or not; if not, then I'll write a version
> of the recipe that generates the page via an http:// request instead
> of from a temporary .html file.

Well, it doesn't work for me on my wiki, but it does work when I go to
that page on pmwiki.org.  I'm using htmldoc version 1.8.27, so it's not
as if I'm using the wrong version.  And I've just upgraded PmWiki to
2.1.26, so that's up to date too.

So, is there something that's missing on my setup?

(does a bit more investigation)

Okay, I think I've found a clue or two.  The image files in question are
*uploaded* images (with Attach:).  The examples being used in, say, the
GeneratePDF page, were all absolute http:// image links.

But with Attached images, the URL depends on the $PubDirUrl and
$UploadUrlFmt values -- which in my case were relative, not absolute.

For some reason, the default $PubDirUrl doesn't work for me, but because
I mirror my wiki onto different machines, I'm setting it to a relative
rather than an absolute value:

$PubDirUrl = '/wiki/pub';

Likewise, the $UploadUrlFmt value was set to

$UploadUrlFmt = '/wiki/uploads';

This means that the temporary HTML file used by GeneratePDF was getting
links like 

<img src='/wiki/uploads/Main/image1.jpg'/>

which of course htmldoc couldn't find, since it didn't know what host
the image was on.

But if I set $PubDirUrl to an absolute value, it all works.

So I guess this is one example of where relative URLs don't work.

Kathryn Andersen
-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe




More information about the pmwiki-users mailing list