5 Replies Latest reply: Dec 10, 2012 10:36 AM by aracila RSS

    PDF file generation based on (XSL-FO) (.fo file)

    aracila
      Hi ALL, need your help!

      I do have a problem showing image in PDF I generate based on XSL-FO template.
      Please take a look at the code related to image in my .fo file
      <fo:block     margin-left="1.49cm" margin-right="0.58cm"  margin-top="0.0cm" >
       <fo:external-graphic content-width="scale-to-fit" content-height="scale-to-fit" width="7.43cm"  height="1.49cm"    ><xsl:attribute name="src">/i/specs_logo.png</xsl:attribute></fo:external-graphic>
      </fo:block>
      As you can see I am referring my spec_logo.png as /i/, and also was trying to put here the full path to the file with no luck (empty space is coming on PDF).
      Please can someone who has been printing (generating PDF) using XSL-FO help me understand how to indicate the image I want to show.

      Thanks a lot!
      Andrei
        • 1. Re: PDF file generation based on (XSL-FO) (.fo file)
          GudrunPabst
          Hi,

          the Apache FOP included with APEX does not support PNG images. Use an image in JPG or GIF format instead.

          Regards,
          Gudrun
          • 2. Re: PDF file generation based on (XSL-FO) (.fo file)
            aracila
            Hi, thanks for the advice.

            jpg is working, but not streching :(
                    <fo:table-cell   number-columns-spanned="2">
                  <fo:block     margin-left="1.49cm" margin-right="0.58cm"  margin-top="0.0cm" ><fo:external-graphic content-width="scale-to-fit" content-height="scale-to-fit" width="7.43cm"  height="1.49cm"    ><xsl:attribute name="src">/my_full_path/specs_logo.jpg</xsl:attribute></fo:external-graphic>
            </fo:block>
                    </fo:table-cell>
            I can see the image but it is very small, looks like FOP ignoring the parameters
            content-width="scale-to-fit" content-height="scale-to-fit" width="7.43cm"  height="1.49cm" 
            Does any one had this issue before?

            Thank you,
            Andrei
            • 4. Re: PDF file generation based on (XSL-FO) (.fo file)
              VC
              Try adding this scaling="non-uniform"
              <fo:table-cell   number-columns-spanned="2">
                    <fo:block margin-left="1.49cm" margin-right="0.58cm"  margin-top="0.0cm" ><fo:external-graphic content-height="scale-to-fit" width="7.43cm"  height="1.49cm" scaling="non-uniform" ><xsl:attribute name="src">/my_full_path/specs_logo.jpg</xsl:attribute></fo:external-graphic>
              </fo:block>
                      </fo:table-cell>
              http://stackoverflow.com/questions/1957847/how-to-display-fixed-image-height-and-width-using-xsl-fo-with-apache-fop-0-95
              • 5. Re: PDF file generation based on (XSL-FO) (.fo file)
                aracila
                Thanks a lot it was helpful, actually in my case it works only after i removed completely content-width="scale-to-fit" content-height="scale-to-fit"

                This is how it works for me.
                <fo:table-cell   number-columns-spanned="1">
                   <fo:block     margin-left="4.25cm" margin-right="0.58cm"  margin-top="0.0cm" >
                      <fo:external-graphic width="7.43cm"  height="1.49cm"  scaling="non-uniform"  >
                         <xsl:attribute name="src">/My Path/specs_logo.jpg</xsl:attribute>
                      </fo:external-graphic>
                   </fo:block>
                </fo:table-cell>
                Edited by: aracila on Dec 10, 2012 8:36 AM