Pages: 1
Print
Author Topic: How to include an image in a pdf header  (Read 8935 times)
s. anderson
Member

Posts: 10


« on: March 19, 2014, 01:37:52 PM »

Hi,

I'm trying to include an image in the pdf header with no luck. I'm not exactly sure how to go about this. I've read the documentation for XMetal 8 over and over and can't find what I'm looking for -- or even something that suggests how to do this.

Can anyone help?

Note: I'm using XMetal Author v8.0.1, without the TopLeaf plugin. And I'm rendering with XMetal Enhanced PDF via renderX XEP.

Thanks

Edit: I know I need to modify the custom.xsl in AppData/Whatevs/xmfo/yaddayadda. I've tried doing that. At this point I've tried modifying the header template and the header attribute without luck. It seems that the engine just ignores what I did, making me believe that I've screwed up major. So instead of slamming my head against this wall for another 3 hours, I figured I'd post this question. Hopefully y'alls are nicer and more understanding than most developer forums.
« Last Edit: March 19, 2014, 01:46:13 PM by sandra » Logged
severin.foreman
Member

Posts: 47



« Reply #1 on: March 19, 2014, 01:43:30 PM »

Hi Sandra,

You would need to customize the DITA Open Toolkit that is included with XMetaL to do that. Someone has likely asked a similar question on the DITA Users group.
https://groups.yahoo.com/neo/groups/dita-users/info

Also, this document has a section on updating headers and footers that might help get you started.
http://www.scriptorium.com/whitepapers/ditaotpdf/DITA-PDF-tweaks.pdf

Regards,
Severin
Logged
s. anderson
Member

Posts: 10


« Reply #2 on: March 19, 2014, 01:47:51 PM »

Hi Severin,

The reason I'm posting this is because I haven't found an answer online. I've been working on this for upward three hours, trying out fo code, and I've decided that instead of continuing, I'd just ask if anyone knew how to do this.

Thanks
Sandra
Logged
severin.foreman
Member

Posts: 47



« Reply #3 on: March 19, 2014, 01:51:38 PM »

I see. Well the short answer is that you need to modify the static-content.xsl file in the directory where the open toolkit is installed. The actual answer is a bit more involved with that, which I why I referred you to the Scriptorium PDF. However, if you are willing to buy a book, there are some very good resources out there that will help you all the way through the process. XML Press has books by Eliot Kimber and Leigh White that contain all the information you need.

I searched DITA users and found at least one post about someone wanting to add an image to the document footer, which would be the same process as adding an image to the header.

Regards,
Severin
Logged
s. anderson
Member

Posts: 10


« Reply #4 on: March 19, 2014, 01:53:26 PM »

Thanks.
« Last Edit: March 19, 2014, 01:55:23 PM by sandra » Logged
s. anderson
Member

Posts: 10


« Reply #5 on: March 19, 2014, 02:24:31 PM »

Let me try this again:

Anytime I make a change to the header or footer -- even using the code in the XMetal doc -- it doesn't affect my pdf output.

I'm modifying \AppData\Roaming\SoftQuad\XMetaL Shared\DITA_OT\plugins\xmfo\Customization\fo\attrs\custom.xsl just like the doc (almost) says (I say "almost" because the v8 doc is out-of-date and still refers to the deprecated demo directory).

So if I try:

<!-- file: [FO_CUSTOM]\fo\attrs\custom.xsl -->
<xsl:attribute-set name="__body__odd__footer">
<xsl:attribute name="text-align">right</xsl:attribute>
<xsl:attribute name="margin-right">10pt</xsl:attribute>
<xsl:attribute name="margin-bottom">10pt</xsl:attribute>
<xsl:attribute name="font-style">italic</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="__body__odd__footer__pagenum">
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="color">red</xsl:attribute>
<xsl:attribute name="font-style">normal</xsl:attribute>
</xsl:attribute-set>

It does nothing. The page number does not render in red. Nothing is in italics. Which makes me wonder what I am doing wrong.

I don't think a book will help with this, IMHO.

Thanks
Logged
severin.foreman
Member

Posts: 47



« Reply #6 on: March 19, 2014, 02:30:53 PM »

Assuming you are using the XMetaL Enhanced PDF deliverable type, then your modifications should have some type of effect. I wonder if the attrs\custom.xsl file you are modifying is being used by the output transforms. You can test that by attempting to break the output generation process by saving some malformed XML in the .xsl file. For example, I omitted the closing angle bracket on the attribute-set tag below.

<xsl:attribute-set name="__body__odd__footer"
<xsl:attribute name="text-align">right</xsl:attribute>
<xsl:attribute name="margin-right">10pt</xsl:attribute>
<xsl:attribute name="margin-bottom">10pt</xsl:attribute>
<xsl:attribute name="font-style">italic</xsl:attribute>
</xsl:attribute-set>

If the .xsl is being used, it will cause a fatal error when you build output. If there's no fatal error, then you need to look elsewhere.

Regards,
Severin
Logged
s. anderson
Member

Posts: 10


« Reply #7 on: March 19, 2014, 02:57:51 PM »

I am (see my original post for what I'm using).

I know that that file is being used because I made a change on the title page to use a background image, and that took.  I also purposely made an error (as you suggested), and the generation failed.

It's just the header and footer modifications that don't seem to be taking.
Logged
severin.foreman
Member

Posts: 47



« Reply #8 on: March 19, 2014, 03:00:42 PM »

If you want to add an image, you'll need to do it in the static-content.xsl. As for why your changes are not taking effect, you might want to look at the stage3.xml file in the temp directory. There you can see all the fo objects that are applied to your text. Perhaps your changes are being applied, but are being overridden by another attribute set.

Severin
Logged
IF
Member

Posts: 80


« Reply #9 on: March 19, 2014, 03:53:06 PM »

My recommendation is to get Leigh White's book Dita for Print. She has an example to do exactly that and it works perfectly. It's an excellent book well worth the $ and time investment.

Regarding the attribute sets for headers that don't seem to be used, you could try to create separate attribute files and importing them into the custom.xsl file, e.g.,:
....
<xsl:import href="xm_bookmarks.xsl" />   

    <!-- IF 19Feb2013 - import customization files for OPMANUAL      -->
<xsl:import href="OPMANUAL_headers.xsl"/> 
....

And this is inside my OPMANUAL_headers.xsl file:
<xsl:attribute-set name="__body__odd__header">
        <xsl:attribute name="margin-top">20pt</xsl:attribute>
       <xsl:attribute name="border-bottom">solid</xsl:attribute>
        <xsl:attribute name="border-bottom-color">orange</xsl:attribute>
       </xsl:attribute-set>
Logged
s. anderson
Member

Posts: 10


« Reply #10 on: March 20, 2014, 08:10:24 AM »

My recommendation is to get Leigh White's book Dita for Print. She has an example to do exactly that and it works perfectly. It's an excellent book well worth the $ and time investment.

Given that I need to do this sooner rather than later, and that you apparently know that this actually works, can you by any chance tell me how to do this?

Thanks
Logged
s. anderson
Member

Posts: 10


« Reply #11 on: March 20, 2014, 08:19:35 AM »

If you want to add an image, you'll need to do it in the static-content.xsl. As for why your changes are not taking effect, you might want to look at the stage3.xml file in the temp directory. There you can see all the fo objects that are applied to your text. Perhaps your changes are being applied, but are being overridden by another attribute set.

I did it in custom.xsl because the XMetal doc specifically says to modify that doc rather than the other xsl files. In fact, the attribute where the background image is added is in static-content.xsl, but the override is located in custom.xsl, and it gets picked up perfectly well. If I make an error in custom.xsl, then the entire thing goes south. So I know custom.xsl is being read and used.

I tried checking for Stage3.xml, and there was none. I have stage1.xml, but stage3.fo. Maybe this is the issue?
Logged
severin.foreman
Member

Posts: 47



« Reply #12 on: March 20, 2014, 08:36:41 AM »

Sorry, I meant stage3.fo. That is the second to the last file in the processing chain and will show you almost exactly what it being passed to RenderX. If you look in that file, you can check for the color and font-style properties on your static content sections.

And you are right to make your changes in custom.xsl. My team has so many customizations our custom.xsl file is used only to import other custom stylesheets.
Logged
s. anderson
Member

Posts: 10


« Reply #13 on: March 21, 2014, 02:16:50 PM »

After looking at the xsl files, it looks like the default header should show the product name and the page number. This isn't happening. I've eliminated all customizations and the doc has no header (it never had a header).

I think something must be broken in my installation.
Logged
shepPettibone
Member

Posts: 1



« Reply #14 on: June 18, 2018, 05:18:36 AM »

It seems like no chance to me to do so when it was the 8, they did a lot of improvements on that in the 10th release. Back then, I tried to do this and that for several times ended up with the soft turned to garbage 3 days after. So I called it a day and edited that PDF through this tool https://w9.pdffiller.com just because I don't know, you upload it, put your media where you want and it's done
Logged
cloudkickball
Member

Posts: 2


« Reply #15 on: October 07, 2018, 08:21:46 AM »

Hi Sandra,

You would need to customize the DITA Open Toolkit that is included with XMetaL to do that. Someone has likely asked a similar question on the DITA Users group.
https://groups.yahoo.com/neo/groups/dita-users/info

Also, this document has a section on updating headers and footers that might help get you started.
http://www.scriptorium.com/whitepapers/ditaotpdf/DITA-PDF-tweaks.pdf

Regards,
Severin

Thanks for the link.
Logged
Pages: 1
Print
Jump to:  

email us