Laszlo Szilagyi
unread,Mar 7, 2011, 8:28:48 AM3/7/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Flying Saucer Users
Hi,
I'm about to generate PDF files from URLs. Some of the web pages
contains dynamic tables, which can be wider than normal. So sometimes
the edge is cut off.
I need to figure out a solution to handle this situation. I can
compare the page width and the width on the PDF with this code:
renderer = new ITextRenderer(dotsPerPoint, dotsPerPixel);
renderer.setDocument(doc, url);
renderer.layout();
// width of the web page
d = renderer.getRootBox().getPaintingInfo().getOuterMarginCorner();
// width of the PDF page with the current settings
paperWidth =
((PageBox)renderer.getRootBox().getLayer().getPages().get(0)).getContentWidth(null);
Two questions:
1., How can I dynamically change the CSS for a renderer through the
API?
So when I detect that the table is too wide, I may want to switch to
another CSS, which is using landscape orientation.
2., How can I force the landscape mode for printing?
Here's what I've tried:
@page {size: 8.5in 11in landscape; margin: 0.25in;}
body{line-height:1;background-color:red;size: 8.5in 11in
landscape;margin: 0.25in;}
According to the documentation, these should work but they don't work
for me.
Thanks,
Laci