[xep-support] XEP/XML - Newline chars being eaten and logo not scaling

Alexander Peshkov peshkov at renderx.com
Tue Aug 26 02:12:06 PDT 2003


Hello Daniel,

A follow-up to my previous message: I was quite inattentive then
writing about image scaling, sorry. I haven't noticed that you place
your image in a block container with fixed height. So your image
scaling code is OK.
The problem is as follows: fo:external-graphic is an inline-level element.
When it is hosted in a block, there is always a bit of white space
before and after each inline element (known as half-leading). It's
this space that leads to container overflow and thus your image
disappear. To fix the issue, simply specify line-height="0pt" on the
block that enclose image. 

Best regards,
Alexander Peshkov                             mailto:peshkov at renderx.com
RenderX


AP> Hello Daniel,

AP> 1. To scale down image by height use the following code:

AP>    <fo:external-graphic content-height="scale-to-fit"
AP>                         height="3.19cm"
AP>                         content-width="100%"
AP>                         scaling="uniform"
AP>                         src="url(....)"/>

AP>    Note that image scaling technique was discussed on this list before
AP>    - please use search utility at our site http://xep.xattic.com
AP>    (Google search at the top of the main page).

AP> 2. I wasn't able to reproduce newlines problem that you experiencing
AP>    using XEP 2.78 and 3.54. I suppose it has nothing to do with XEP
AP>    itself but rather caused by different XSLT transformers (or their
AP>    settings) used in a tool chain. In general line breaks treatment
AP>    defined by the 'linefeed-treatment' property and its behavior
AP>    hasn't changed since 2.78.
AP>    Are you sure that input XSL FO documents are absolutely equal for
AP>    2.78 and 3.54? If you feed the same FO document (cited below) to
AP>    XEP 2.78 and 3.54 from command line does this 'newline eating'
AP>    effect persists?
AP> ---------------------------------------------------------------------
AP> <?xml version="1.0"?>
AP> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
AP>         <fo:layout-master-set>
AP>                 <fo:simple-page-master master-name="my-page">
AP>                         <fo:region-body margin="1in"/>
AP>                 </fo:simple-page-master>
AP>         </fo:layout-master-set>
AP>         <fo:page-sequence master-reference="my-page">
AP>                 <fo:flow flow-name="xsl-region-body">
AP>                   <fo:block linefeed-treatment="preserve">
AP>                       Thanks for ordering our product.

AP>                       We appreciate your business.
AP>                   </fo:block>
AP>                 </fo:flow>
AP>         </fo:page-sequence>
AP> </fo:root>
AP> ---------------------------------------------------------------------

AP> Best regards,
AP> Alexander Peshkov                             mailto:peshkov at renderx.com
AP> RenderX
   

DK>> Currently I am using JDK 1.3.1 with XEP 3.54.  The system I am working on
DK>> creates some dynamic XML and pushes it off to XEP to transform to PDF using
DK>> an XSL sheet.  We were using JDK 1.3.1 with XEP 2.78.  Due to the newer
DK>> version changing the API, I had to rewrite the code that called up XEP and
DK>> transformed the XML document.  I am having two problems that I didn't have
DK>> in the previous version.  Newline characters are being eaten and a logo at
DK>> the top of the page isn't scaling properly.  Since the logo isn't scaling
DK>> properly everytime sometimes it appears and sometimes it doesn't.  The XSL
DK>> sheet hasn't been changed at all.  The code that I changed to work with the
DK>> new version of XEP shouldn't have affected the output at all.  Therefore I
DK>> am wondering why the older version didn't eat newline characters and the
DK>> newer version does.   I compared the .FO file that is generated to the
DK>> previous version and the latest version and nothing was different.  The XML
DK>> generated is also the same.  As far as the logo goes here are code snippets:

DK>> ========================================
DK>>   <fo:block-container height="3.3cm" top="0.5cm" left="1.35cm" padding="0pt"
position="absolute">>>
DK>>     <fo:block/>
DK>>       <xsl:apply-templates select="Logo"/>
DK>>    </fo:block-container>

DK>>   <xsl:template match="Logo">
DK>>     <fo:block text-align="start">
DK>>       <fo:external-graphic content-height="3.19cm" scaling="uniform">
DK>>         <xsl:attribute name="src"><xsl:value-of select="concat('file:///',
@AbsolutePath)"/>>></xsl:attribute>        
DK>>       </fo:external-graphic>
DK>>     </fo:block>
DK>>   </xsl:template>
DK>> =======================================
DK>> I even tried changing the last code snippet to this since with the above
DK>> code the logo wouldn't appear at all.  Now it appears sometimes and
DK>> sometimes it doesn't.  The graphics are all different sizes.  And therefore
DK>> I need to be able to scale them to fit in this one block that is absolute.

DK>>  <xsl:template match="Logo">
DK>>     <fo:block text-align="start">
DK>>       <fo:external-graphic content-width="scale-to-fit" width="100%"
DK>> content-height="100%" scaling="uniform">
DK>>         <xsl:attribute name="src">url('<xsl:value-of
DK>> select="concat('file:///', @AbsolutePath)"/>')</xsl:attribute>
        
DK>>       </fo:external-graphic>
DK>>     </fo:block>
DK>>   </xsl:template>

DK>> Example of newline chars being eaten:

DK>> Old code:

DK>>  Thanks for ordering our product.

DK>>  We appreciate your business.

DK>> New code:

DK>>   Thanks for ordering our product.
DK>>   We appreciate your business.


DK>> If any other information would be helpful to include then please let me
DK>> know.  I'm definitely befuddled as to what the deal is.  I've tried to even
DK>> add <xsl:text>&#xA;</xsl:text> to put a newline character at the end of
DK>> every paragraph.


DK>> Thanks,
DK>> Daniel W King
DK>> Scientific Programmer II
DK>> MDL Information Systems, Inc.
DK>> (615) 366-2000x5114  
 

DK>> -------------------
DK>> (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
DK>> in the body of the message to majordomo at renderx.com from the address
DK>> you are subscribed from.
DK>> (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html


AP> -------------------
AP> (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
AP> in the body of the message to majordomo at renderx.com from the address
AP> you are subscribed from.
AP> (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html


-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



More information about the Xep-support mailing list