You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Peter Coppens <pc...@gmail.com> on 2009/01/13 22:39:04 UTC

Scale fop created pages for pdf output

Hello,

I guess this is somewhat off topic....

Assume existing code to create an XSL FO. Sometimes I need to render that
exact same content (to pdf) but with a different scale

One approach is to create a second stylesheet that refers to the originally
generated pdf but uses the scaled page size. 

Now I wonder whether I can take any shortcuts here. I have been looking into
some pdf lib's (PDFBox being one of them) but I can not immediately figure
out how I would be able to rescale the pages.

Many thanks for guidance or tips!

Peter
-- 
View this message in context: http://www.nabble.com/Scale-fop-created-pages-for-pdf-output-tp21445071p21445071.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Scale fop created pages for pdf output

Posted by Peter Coppens <pc...@gmail.com>.
Thanks Jeremias.  As always to the point and helpful

Jeremias Maerki-2 wrote:
> 
> This could be done using a similar approach as I've taken with my
> PDF-in-PDF plug-in for FOP. Each page could be converted to a PDF Form
> and then painted from a newly set-up page with the new dimensions. That
> could lead to a nice new function for PDFBox. They're also always
> looking for contributors. ;-)

I'll try to schedule some time to experiment with PDFBox to write such a
scaling tool, based on your pdf image extension. Having close to no
knowledge on PDF or PDFBox...that'll be...interesting.

> 
> Also you might want to take a look at Multivalent. It has a good impose
> function. Maybe it can be mistreated for your purposes.
> 
Multivalent has indeed what I was looking for (thanks for the pointer, I was
not aware of the project), but its license is a bit unclear to me. Also
could not find the source code.

> Another possibility is to use the new intermediate format I'm currently
> writing for FOP. It allows arbitrary transformation matrices which could
> be used to do something like you need. No guarantee that it'll work. I
> haven't done any tests in that direction. And it can only work for
> formats like PDF, PS and Java2D. For PCL and AFP this will definitely
> not work due to the format limitations. But I assume that won't bother
> you.

Well, that would certainly be the most optimal approach in terms of
performance, but I am not sure it would be optimal in terms of amount of
work and delivery date.
-- 
View this message in context: http://www.nabble.com/Scale-fop-created-pages-for-pdf-output-tp21445071p21452885.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Scale fop created pages for pdf output

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
This could be done using a similar approach as I've taken with my
PDF-in-PDF plug-in for FOP. Each page could be converted to a PDF Form
and then painted from a newly set-up page with the new dimensions. That
could lead to a nice new function for PDFBox. They're also always
looking for contributors. ;-)

Also you might want to take a look at Multivalent. It has a good impose
function. Maybe it can be mistreated for your purposes.

Another possibility is to use the new intermediate format I'm currently
writing for FOP. It allows arbitrary transformation matrices which could
be used to do something like you need. No guarantee that it'll work. I
haven't done any tests in that direction. And it can only work for
formats like PDF, PS and Java2D. For PCL and AFP this will definitely
not work due to the format limitations. But I assume that won't bother
you.

On 13.01.2009 22:39:04 Peter Coppens wrote:
> 
> Hello,
> 
> I guess this is somewhat off topic....
> 
> Assume existing code to create an XSL FO. Sometimes I need to render that
> exact same content (to pdf) but with a different scale
> 
> One approach is to create a second stylesheet that refers to the originally
> generated pdf but uses the scaled page size. 
> 
> Now I wonder whether I can take any shortcuts here. I have been looking into
> some pdf lib's (PDFBox being one of them) but I can not immediately figure
> out how I would be able to rescale the pages.
> 
> Many thanks for guidance or tips!
> 
> Peter
> -- 
> View this message in context: http://www.nabble.com/Scale-fop-created-pages-for-pdf-output-tp21445071p21445071.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: Scale fop created pages for pdf output

Posted by Peter Coppens <pc...@gmail.com>.
Apologies for not being sufficiently clear.

What i need is resized page but also scaled content (images and text).

Thanks

Peter




Griffin,Sean wrote:
> 
> Peter,
> By "scale" do you mean a different page size?  As you probably know, this
> isn't exactly a difference scale (where the page size would be the same
> but the image zoom would be different).  If you want to use the same XSLT
> to generate similar XSL-FO with just different page sizes, you can easily
> pass the page dimensions in as XSLT parameters.  If you're actually
> generating images from the PDF and want the images to be scaled at
> different dimensions, some sort of post processor would be required.
> 
> Sean
> 
> -----Original Message-----
> From: Peter Coppens [mailto:pc.subscriptions@gmail.com] 
> Sent: Tuesday, January 13, 2009 3:39 PM
> To: fop-users@xmlgraphics.apache.org
> Subject: Scale fop created pages for pdf output
> 
> 
> Hello,
> 
> I guess this is somewhat off topic....
> 
> Assume existing code to create an XSL FO. Sometimes I need to render that
> exact same content (to pdf) but with a different scale
> 
> One approach is to create a second stylesheet that refers to the
> originally
> generated pdf but uses the scaled page size. 
> 
> Now I wonder whether I can take any shortcuts here. I have been looking
> into
> some pdf lib's (PDFBox being one of them) but I can not immediately figure
> out how I would be able to rescale the pages.
> 
> Many thanks for guidance or tips!
> 
> Peter
> -- 
> View this message in context:
> http://www.nabble.com/Scale-fop-created-pages-for-pdf-output-tp21445071p21445071.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> ----------------------------------------------------------------------
> CONFIDENTIALITY NOTICE This message and any included attachments are from
> Cerner Corporation and are intended only for the addressee. The
> information contained in this message is confidential and may constitute
> inside or non-public information under international, federal, or state
> securities laws. Unauthorized forwarding, printing, copying, distribution,
> or use of such information is strictly prohibited and may be unlawful. If
> you are not the addressee, please promptly delete this message and notify
> the sender of the delivery error by e-mail or you may call Cerner's
> corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Scale-fop-created-pages-for-pdf-output-tp21445071p21445355.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: Scale fop created pages for pdf output

Posted by "Griffin,Sean" <SG...@CERNER.COM>.
Peter,
By "scale" do you mean a different page size?  As you probably know, this isn't exactly a difference scale (where the page size would be the same but the image zoom would be different).  If you want to use the same XSLT to generate similar XSL-FO with just different page sizes, you can easily pass the page dimensions in as XSLT parameters.  If you're actually generating images from the PDF and want the images to be scaled at different dimensions, some sort of post processor would be required.

Sean

-----Original Message-----
From: Peter Coppens [mailto:pc.subscriptions@gmail.com] 
Sent: Tuesday, January 13, 2009 3:39 PM
To: fop-users@xmlgraphics.apache.org
Subject: Scale fop created pages for pdf output


Hello,

I guess this is somewhat off topic....

Assume existing code to create an XSL FO. Sometimes I need to render that
exact same content (to pdf) but with a different scale

One approach is to create a second stylesheet that refers to the originally
generated pdf but uses the scaled page size. 

Now I wonder whether I can take any shortcuts here. I have been looking into
some pdf lib's (PDFBox being one of them) but I can not immediately figure
out how I would be able to rescale the pages.

Many thanks for guidance or tips!

Peter
-- 
View this message in context: http://www.nabble.com/Scale-fop-created-pages-for-pdf-output-tp21445071p21445071.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: Scale fop created pages for pdf output

Posted by Peter Coppens <pc...@gmail.com>.
Pascal,

Thanks for the tip. It does not seem to do what I want though.

If I naievely wrap the content of the page's <flow> element, which is a
sequence of block-container's, in a wrapping <block-container
fox:transform='scale(0.5)' >, the scaling does not seem to be taken into
account. Scaling on the deeper block-containers works perfect.

Peter
-- 
View this message in context: http://www.nabble.com/Scale-fop-created-pages-for-pdf-output-tp21445071p21453056.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org