Bec d'état - Rebecca Scott

Blog | Links | Archive
About | Resume | Advisor profile | Projects | Contact


~/External graphics in XSL:FO not sizing correctly

04 June 2008

I’m using Apache FOP to generate PDFs from XSL:FO, and an external graphic (think the <img> tag in HTML) kept being resized incorrectly. Another image (different size) was the correct size on the page. Turns out I was using height and width attributes in the fo:external-graphic element, when I should have been using content-height and content-width. Somehow the second image respected the height and width I wanted. Possibly this has something to do with the stored DPI of the images (since XSL:FO is a specification for printed documents), but in any case content-width and content-height is the way to go.