[xwiki-users] Images to large at PDF Export

Sergiu Dumitriu sergiu at xwiki.com
Thu Dec 27 23:39:05 CET 2007


Hi,


Rudolf.Tronicek at eisenmann.de wrote:
> Hi,
> 
> We're just verifying XWiki Enterprise as a base to a corporate InfoCenter.
> Virtual Wikis are really fine to separate global infos from division infos.
> 
> To make some infos viewable offline we want to use the PDF export function
> with hierarchical output via macro.
> The problem seems to be that pictures (.jpg,...) are exported in a big
> scale - even exports from the site www.xwiki.org create large images.
> Is it possible to keep the size of pictures "as is" at PDF export - or
> scale them down to page-width?

Should be done by changing the pdf css. I also noticed this issue, and I 
think it should be fixed.

Later edit: Just tried it, and there are several bugs in Apache FOP. 
First, max-width does not seem to be implemented ( 
http://xmlgraphics.apache.org/fop/compliance.html#fo-property-max-width 
), second, scale-down-to-fit isn't working either. I looked at the 
source code, and in the trunk it seems to be implemented, but not on the 
released versions. So, what can be done, is to create a file called 
pdf.css in <xwiki_dir>/templates, and put the following content:

img {
   content-width: scale-to-fit;
   width: 100%;
}

Now, all the images will have the same width... So not only large images 
will be scaled down to fit in the page, but smaller images will be 
scaled up to the same width, too... I'm sorry, but with the curent FOP 
implementation, that's the best we can get.

A workaround is to manually put the large images inside a <div 
class="largeimagewrapper"> and change the css rule to match only these, 
like:

div.largeimagewrapper img {
   ...
}

> It would be nice to start each page of the hierarchy tree on a new page...

A CSS + velocity template issue. Between documents add a <div 
class="newpagehere"></div>, and in the pdf css add a rule like:

div.newpagehere { page-break-after: always; }

> Is the developer team working on any PDF related point?

Regarding the planned improvements in the PDF-export area, I am working 
on adding support for UTF, and we're also planning to add UI for 
exporting more than one document (children, linked pages, or even a 
variable list of documents).

> Best regards,
> Rudolf
> 

And season's greetings to you,
Sergiu


More information about the users mailing list