Image size handling in PDF exports

XMLWordPrintable

      NOTE: This suggestion is for Confluence Cloud. Using Confluence Server? See the corresponding suggestion.

      If images are too large to fit into PDF page, they are not scaled down. Currently xsl-fo transformation includes only 96 dpi to 72 dpi scaling. It assumes that image will fit to page in any case. But after this scaling this doesn't mean that image still will fit to page. It is possible to use "scale-down-to-fit" value of content-width and content-height attributes. The below patch scales down image if needed to fit PDF page. Of course 96 dpi to 72 dpi scaling is not performed in this case.

              <!-- If no size parameters are specified, scale the image by width to fit -->
              <xsl:if test="not(@width) and not(@height)">
                  <!-- scale the image itself
                  <xsl:attribute name="content-width">75%</xsl:attribute>
                  <xsl:attribute name="content-height">75%</xsl:attribute>
                  -->
                  <!-- isn't it easier to specify just scale-down-to-fit if needed? -->
                  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
                  <xsl:attribute name="content-height">scale-down-to-fit</xsl:attribute>
                  <xsl:attribute name="width">100%</xsl:attribute>
                  <xsl:attribute name="height">100%</xsl:attribute>
              </xsl:if>
      

            Assignee:
            BillA
            Reporter:
            Murad Mamedov
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: