DITA and XMetaL Discussion
DITALearner September 29, 2010 at 12:59 pm
Graphic or image settings changeSeptember 29, 2010 at 12:59 pmParticipants 12Replies 13Last Activity 11 years, 9 months ago
I am looking where to change image settings in DITA_OTfo or DITA_OTxmfo folder in the provided style sheets. I need to make changes to the width, height, text wrapping and image position on the body page.
Would someone know where to make these changes? If yes, please point me to the right direction.
I am transforming DITA to PDF using Xmetal Enhanched PDF via RenderX XEP and Book via RenderX.
Thanks for your assistance in advanceIF September 29, 2010 at 2:55 pm
Reply to: Graphic or image settings changeSeptember 29, 2010 at 2:55 pm
I am not sure I understand the question. Are you saying that you want all your images to be the same size? If not, why not adjust the height and width of the figures from XMetal Author using the Image or Figure Properties dialog box?DITALearner September 29, 2010 at 3:18 pm
Reply to: Graphic or image settings changeSeptember 29, 2010 at 3:18 pm
Actually what I wanted to ask was if there is any general setting for images that affects all images during transformation to PDF. Since there are usually some global/common attributes.Derek Read September 29, 2010 at 6:28 pm
Reply to: Graphic or image settings changeSeptember 29, 2010 at 6:28 pm
You could perform a Find and Replace for all images in the current document if you want to set an attribute to a specific value that should be the same.
I'm not sure that's what you are asking for though, as it seems you're looking for something that will be added during transformation and not necessarily in the source XML. Is that right? What is it exactly that you want to add? Are we talking about styling (like a border?) or something else?DITALearner September 29, 2010 at 7:05 pm
Reply to: Graphic or image settings changeSeptember 29, 2010 at 7:05 pm
You could perform a Find and Replace for all images in the current document if you want to set an attribute to a specific value that should be the same for all.
I'm not sure that's what you are asking for though, as it seems you're looking for something that will be added during transformation and not necessarily in the source XML. Is that right? What is it exactly that you want to add? Are we talking about styling (like a border?) or something else?
Yes, my source XML are OK with images properly inserted and displaying in Xmetal. They also get displayed properly when transformed into one-column, but when transformed into two-column, which is a requirement for the document I am working on, then I get some images too large to fit into one side of the columns. The resulting PDF is not properly formatted because of that.
Or sometimes the text wrapping around the images is not good, big gap between the surrounding text and the image.
I would like to keep my source XML intact, and perform changes only using the xslt during transformation.
So I was wondering if there is a way to make global change that can change affect all images at once during transformation.
Thank you.Derek Read September 29, 2010 at 11:35 pm
Reply to: Graphic or image settings changeSeptember 29, 2010 at 11:35 pm
What it sounds like you want is a setting that will automatically scale your images down (only?) to fit within the column they are contained inside of? If so setting the attribute called “outputclass” to “scale” on should do that for you. Example:
this is a test image
This is not standard DITA OT behavior for PDF output so it will only work in the “XMetaL Enhanced PDF via RenderX XEP” deliverable. Also, as written, you need to set this value on all of your elements.
You could probably change that fairly easily though (provided you have some understanding of XSLT / XSL-FO) so that it does this for all images regardless of attribute or value, or if you wish to change the attribute value or name that is being checked (ie: rather than “scale” you want to use “foobar” or another attribute rather than outputclass). The file containing this code is located here:
I'm not sure about columns but this certainly works for pages. However, given the way it is coded I would expect it to work for columns as well. Note that it assumes an image DPI of 96 when doing necessary conversions so if things look wacky there (ie: perhaps you have some 72 DPI images, etc) that's what you'll probably need to look at.DITALearner September 30, 2010 at 1:56 pm
Reply to: Graphic or image settings changeSeptember 30, 2010 at 1:56 pm
Could you provide an example for all images as my coding skills are very limited. I just tested the solution and it did work fine.Derek Read September 30, 2010 at 8:46 pm
Reply to: Graphic or image settings changeSeptember 30, 2010 at 8:46 pm
Officially we are not aiding people with making changes to the DITA OT (this type of thing is typically redirected to our partners as a paid engagement). However, as this is likely to be useful for others and it might be simple I'll see what it might take to enable it (assuming I have some time to spare from my other duties).Derek Read September 30, 2010 at 9:53 pm
Reply to: Graphic or image settings changeSeptember 30, 2010 at 9:53 pm
OK, the following change will force images to be 100% (their original size as encoded in the image itself) regardless of what you set for their width or height attribute values (in the XML source) AND if the image is too big to fit inside its containing block (in your case this is essentially the column width) then they should be scaled down to fit — the feature you are looking for. This is working for me with raster images (tested with JPG and GIF).
Deliverable type: “XMetaL Enhanced PDF via RenderX XEP”
For those that wish to dig into this further the following file both defines and calls the template called “placeImage” that is being redefined in the file listed above:
The reason it was redefined in the first place is because the original DITA OT plug-in that our plug-in is based on (from Idiom, sometimes called the “PDF2” transtype) is that it assumed images would be coded at 72 DPI (72 pixels per inch, which is standard on some operating systems like Macs). As our software runs on Windows where 96 DPI is the standard display resolution we changed this to 96, so that what you see while editing would match what you see in output. For more information on the complexities of embedding raster images into PDF documents at the “right” resolution you may wish to search the web for “pdf image resolution” (the main point being that there really is no “right” resolution).DITALearner October 1, 2010 at 12:50 pm
Reply to: Graphic or image settings changeOctober 1, 2010 at 12:50 pm
Thanks a lot Derek,
I just made the change and it worked fine with the document I have at the moment. This really helps.
Can we use these same settings on the “Book via RenderX” profile? In other words what are the files that need to be changed in the %AppData%SoftQuadXMetaL SharedDITA_OTdemofo folder to produce the same behavior?
Once again, thank you for your support.Derek Read October 1, 2010 at 9:23 pm
Reply to: Graphic or image settings changeOctober 1, 2010 at 9:23 pm
Book via RenderX doesn't have the same file in place to modify so the fix would be different but since all our file has done is to override this template it might not be too different.
You'd likely need to make a similar (or perhaps even exactly the same) change to this file (though the location of the template will be on a different line):
Can I ask why you need to produce PDF using both deliverables? I'm not sure I understand why that would be the case as most clients decide to customize one and then use it as the basis for all their PDF outputs.DITALearner October 1, 2010 at 9:30 pm
Reply to: Graphic or image settings changeOctober 1, 2010 at 9:30 pm
Thanks again Derek for your follow up.
Actually, I have a set of documents that need to be transformed using the same approach but via “Book via RenderX”. For those, I already some customized style sheets and was wondering if it could be done. At least if I could be directed to the right set of files to modify for the same effect.
Regards.IF March 27, 2013 at 2:53 am
Reply to: Graphic or image settings changeMarch 27, 2013 at 2:53 am
I made the template change suggested by Derek. It works well for me except that the placement attribute value is ignored when it is set at inline. All my images have a break whether I want one or not. I tried a few things wiht the template but could not resolve this issue. Any thoughts? Thanks. Isabelle
- You must be logged in to reply to this topic.