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 John Brown <jo...@hotmail.com> on 2008/04/13 22:40:17 UTC

Including an image as a page


Hello all,

Is it possible to include an image as a page?

That is, if I have an image that is 8.5in X 11in, and set my
letter-sized page borders to 0 so that the printable area is 8.5in X 11in,
can I add the image to a blank page without cropping or scaling,
or convert the image into a page by itself?
_________________________________________________________________
Get in touch in an instant. Get Windows Live Messenger now.
http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_getintouch_042008
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Including an image as a page

Posted by John Brown <jo...@hotmail.com>.
JJeremias Maerki wrote:
> 
> John Brown wrote:
> > 
> > 
> > Hello all,
> > 
> > Is it possible to include an image as a page?
> > 
> > That is, if I have an image that is 8.5in X 11in, and set my
> > letter-sized page borders to 0 so that the printable area is 8.5in X 11in,
> > can I add the image to a blank page without cropping or scaling,
> > or convert the image into a page by itself?

> Please take a look at: 
> http://xmlgraphics.apache.org/fop/0.95/extensions.html#external-document
> 
> Of course, you can create the same effect by setting up the page-master
> accordingly and using line-height="0" to avoid half-leading effects. The
> above extension is simpler but renders your XSL-FO incompatible with
> other FO implementations.
> 

Thanks. It works well. The trouble is that I am using DocBook 5.0. 
After xsltproc generates the fo, I modify it by hand to replace

<fo:page-sequence ...>
  ...
  <fo:block id="x">
     <fo:external-graphic src="url(y)">
  </fo:block>
...
</fo:page-sequence>

with

<fox:external-document src="x" id="y"/>

I am now looking for a way to customise the DocBook stylesheet or
automatically correct the fo.


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


Re: Including an image as a page

Posted by John Brown <jo...@hotmail.com>.
Jeremias Maerki <dev <at> jeremias-maerki.ch> writes:

> 

<snip/>
> the warning is about the
> block-container further up in your file. The height of the
> block-container is set to 0.01in and its contents (the fo:leader) grow
> beyond that. Just remove the leader.
> 

All warnings are gone now. Thanks.


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


Re: Including an image as a page

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 17.04.2008 14:12:47 John Brown wrote:
> Jeremias Maerki <dev <at> jeremias-maerki.ch> writes:
> 
> > On the block containing the fo:external-graphic add these properties:
> > font-size="0" line-height="0" break-before="page" break-after="page"
> 
> When I made the changes, I saw that the page seemed to be indented, so I
> added 'start-indent="0" end-indent="0"' also. The appearance seems to be
> perfect now, but I still get one warning (I got 2 originally):
> 
> WARNING: Part/page 0 overflows the available area in block-progression
> dimension. (fo:block-container, location: 317/58)
> How can I avoid this warning? Can I ignore it?
> 
> The relevant block now looks like this:
> <fo:block id="id2489196" text-align="center" line-height="0"
>           font-size="0" break-before="page" break-after="page" 
>           start-indent="0" end-indent="0">
>   <fo:external-graphic src="url(doc1-page1.pdf)" 
>                        width="8.5in" height="11in" 
>                        content-width="8.5in" content-height="11in"             
>                        
>                        text-align="center" display-align="center"/>
> </fo:block>

That's not the relevant block. Look closer: the warning is about the
block-container further up in your file. The height of the
block-container is set to 0.01in and its contents (the fo:leader) grow
beyond that. Just remove the leader.

> 
> 
> ><snip/>
> > 
> > A better solution might be to investigate if you can create a custom
> > extension for DocBook so you could still use fox:external-document from
> > inside DocBook. But I don't know enough about DocBook to know if that is
> > even doable.
> > 
> 
> Now that I know the FO that works, I will probably try to see if I can
> extend my custom stylesheet to add the necessary attributes. I think that
> this way is easier because it does not disturb the structure of the DocBook
> document. 
> 
> The DocBook docs explain how to add elements to the Docbook DTD, but
> considering that I don't really know what I am doing, I would not want to
> take on that task.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org




Jeremias Maerki


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


Re: Including an image as a page

Posted by John Brown <jo...@hotmail.com>.
Jeremias Maerki <dev <at> jeremias-maerki.ch> writes:

> On the block containing the fo:external-graphic add these properties:
> font-size="0" line-height="0" break-before="page" break-after="page"

When I made the changes, I saw that the page seemed to be indented, so I
added 'start-indent="0" end-indent="0"' also. The appearance seems to be
perfect now, but I still get one warning (I got 2 originally):

WARNING: Part/page 0 overflows the available area in block-progression
dimension. (fo:block-container, location: 317/58)
How can I avoid this warning? Can I ignore it?

The relevant block now looks like this:
<fo:block id="id2489196" text-align="center" line-height="0"
          font-size="0" break-before="page" break-after="page" 
          start-indent="0" end-indent="0">
  <fo:external-graphic src="url(doc1-page1.pdf)" 
                       width="8.5in" height="11in" 
                       content-width="8.5in" content-height="11in"             
                       
                       text-align="center" display-align="center"/>
</fo:block>



><snip/>
> 
> A better solution might be to investigate if you can create a custom
> extension for DocBook so you could still use fox:external-document from
> inside DocBook. But I don't know enough about DocBook to know if that is
> even doable.
> 

Now that I know the FO that works, I will probably try to see if I can
extend my custom stylesheet to add the necessary attributes. I think that
this way is easier because it does not disturb the structure of the DocBook
document. 

The DocBook docs explain how to add elements to the Docbook DTD, but
considering that I don't really know what I am doing, I would not want to
take on that task.



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


Re: Including an image as a page

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On the block containing the fo:external-graphic add these properties:
font-size="0" line-height="0" break-before="page" break-after="page"

The breaks are necessary to work around a current limitation of FOP. The
other two properties make sure that half-leading effects are eliminated
thus nicely fitting the image in the page.

A better solution might be to investigate if you can create a custom
extension for DocBook so you could still use fox:external-document from
inside DocBook. But I don't know enough about DocBook to know if that is
even doable.

HTH

On 17.04.2008 02:02:32 John Brown wrote:
> The fox:external-document extension works. Since it seems that I will
> probably have to post-process the fo file, I need to decide whether 
> it is easier to:
> 
> 1) insert the fox:external-document at an appropriate place, so that 
>    the table of contents and any other hyperlinks still work
> 2) Fix the FO so that I do not get the following warnings:
> 
> Apr 16, 2008 6:29:20 PM org.apache.fop.layoutmgr.PageBreakingAlgorithm
> updateData2
> WARNING: Part/page 0 overflows the available area in block-progression
> dimension. (fo:block-container, location: 317/58)
> Apr 16, 2008 6:29:20 PM
> org.apache.fop.layoutmgr.inline.LineLayoutManager$LineBreakingAlgorithm
> updateData2
> WARNING: Line 1 of a paragraph overflows the available area by more than
> 50
> points. (fo:block, location: 324/52)
> Apr 16, 2008 6:29:20 PM org.apache.fop.layoutmgr.PageBreaker$1
> notifyOverflow
> WARNING: Content of the region-body on page 2 overflows the available
> area in
> block-progression dimension. (fo:page-sequence, location: 65/312)
> 
> I have created extdoc.tar.bz2 and uploaded it to:
> http://download.yousendit.com/4487E58200672F10
> 
> The archive contains:
> Bytes  Filename         Description
> 28823  doc1-page1.pdf   External document that I am trying to import
> 
> 18854  extdoc.fo        FO produced by DocBook stylesheets + xsltproc
>                         trimmed as much as possible
> 
> 39827  extdoc.pdf       Result of fop extdoc.fo extdoc.pdf. You will
>                         note the result is not correct.
> 
> 16150  images/draft.png Background image in document
> 
> I did what I thought was necessary to set all borders to 0 in the
> DocBook XML file.
> 
> Can you tell me how to fix the FO so that all the space on the 
> 8in X 11in page is available for the external document?
> 


Jeremias Maerki


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


Re: Including an image as a page

Posted by John Brown <jo...@hotmail.com>.
The fox:external-document extension works. Since it seems that I will
probably have to post-process the fo file, I need to decide whether 
it is easier to:

1) insert the fox:external-document at an appropriate place, so that 
   the table of contents and any other hyperlinks still work
2) Fix the FO so that I do not get the following warnings:

Apr 16, 2008 6:29:20 PM org.apache.fop.layoutmgr.PageBreakingAlgorithm
updateData2
WARNING: Part/page 0 overflows the available area in block-progression
dimension. (fo:block-container, location: 317/58)
Apr 16, 2008 6:29:20 PM
org.apache.fop.layoutmgr.inline.LineLayoutManager$LineBreakingAlgorithm
updateData2
WARNING: Line 1 of a paragraph overflows the available area by more than
50
points. (fo:block, location: 324/52)
Apr 16, 2008 6:29:20 PM org.apache.fop.layoutmgr.PageBreaker$1
notifyOverflow
WARNING: Content of the region-body on page 2 overflows the available
area in
block-progression dimension. (fo:page-sequence, location: 65/312)

I have created extdoc.tar.bz2 and uploaded it to:
http://download.yousendit.com/4487E58200672F10

The archive contains:
Bytes  Filename         Description
28823  doc1-page1.pdf   External document that I am trying to import

18854  extdoc.fo        FO produced by DocBook stylesheets + xsltproc
                        trimmed as much as possible

39827  extdoc.pdf       Result of fop extdoc.fo extdoc.pdf. You will
                        note the result is not correct.

16150  images/draft.png Background image in document

I did what I thought was necessary to set all borders to 0 in the
DocBook XML file.

Can you tell me how to fix the FO so that all the space on the 
8in X 11in page is available for the external document?



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


Re: Including an image as a page

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Please take a look at: http://xmlgraphics.apache.org/fop/0.95/extensions.html#external-document

Of course, you can create the same effect by setting up the page-master
accordingly and using line-height="0" to avoid half-leading effects. The
above extension is simpler but renders your XSL-FO incompatible with
other FO implementations.

On 13.04.2008 22:40:17 John Brown wrote:
> 
> 
> Hello all,
> 
> Is it possible to include an image as a page?
> 
> That is, if I have an image that is 8.5in X 11in, and set my
> letter-sized page borders to 0 so that the printable area is 8.5in X 11in,
> can I add the image to a blank page without cropping or scaling,
> or convert the image into a page by itself?



Jeremias Maerki


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