On 6 March 2012 09:08, Tomek Kaczanowski <[email protected]> wrote: > Hi All, > > it seems that width is more important than scaledwidth, for example, > in such case: > image::img/picture.png["Whatever", scaledwidth="50%", width="350", > align="center"] > when generating PDF output (with a2x) the scaledwidth will be ignored.
Hi Tomek, The docbook image size model is fairly comples and asciidoc doesn't support all options. What you need to understand is that it is based on two rectangles, the viewport (which is the space on the page) and the content which can be separately specified. The asciidoc width/height attributes correspond to the content width/height and can be specified in a whole lot of units, defaulting to pixels (whatever that is for a PDF?) and here % is percent of the original image size. For full details see http://docbook.org/tdg/en/html/imagedata.html Content size can also be specified as a scale of the original image size by the scale=xx where xx is a percent. Asciidoc does not provide an independent way of setting viewport size so the toolchains are free to choose, but seem to choose the viewport to be equal to the content. Asciidoc does however allow specification of viewport scaling using scaledwidth. Setting scaledwidth specifies the viewport width and also specifies that the content should be scaled to fit. Here a % is a percent of the size available. But you have specified both fixed content size and scaling and then fixed should win, not scaled. If scaling is winning, the PDF toolchain has a bug. XHTML only allows specifying an image by pixels and % of available space, set by asciidoc width and height. The scaledwidth attribute is ignored. I havn't tried it but the closest match between these two systems would seem to be if HTML were specified by width in % and docbook specified as scaledwidth in % without a content width. To do this you can make docbook output ignore width by adding a custom docbook45.conf. Copy the [image-blockmacro] section from the system docbook45.conf to the custom one and delete the part {width? contentwidth="{width}"}{height? contentdepth="{height}"} Hopefully then you can specify docbook and html separately. Cheers Lex > > This means that if I want to have a decent output for both PDF and > HTML I need to do something fancy. > > My current solution is to use sed to remove all "contentwidth" from > docbook output for PDF version like this: > sed -i 's/contentwidth="[0-9][0-9][0-9]" //g' my_book.xml > before xstlproc and fop are invoked. > > Is there better way to do it? How do other people deal with this? > Using ifdef? > > -- > Regards, > Tomek Kaczanowski > http://practicalunittesting.com > > -- > You received this message because you are subscribed to the Google Groups > "asciidoc" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/asciidoc?hl=en. > -- You received this message because you are subscribed to the Google Groups "asciidoc" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/asciidoc?hl=en.
