Page 1 of 1

Missing header image on some pages

Posted: Mon Aug 19, 2019 5:39 am
by dbutch
Hi,

Our headers include our company logo in the top right corner of our PDF transformations. For some reason, on some of the pages, the logo is missing from the header. There doesn't appear to be particular pattern for the pages missing the logo, but when it does happen, it seems to be on a page that starts with a new chapter. There are no issues with the maptitle.
The customised CSS used for the headers in the body of the document is below:

Code: Select all

@page :left:right{

    padding-top: 4pt;

    @top-right {
        content: '\A0\A0\A0';
        background-image: url('Logo Inverted CMYK resized.png') !important;
        background-repeat:no-repeat;
        background-position:100% 50%;  
        border-bottom: 0.75pt solid red;
        vertical-align: bottom;
    }

    @top-center {
        content: string(maptitle)!important;
        color: black;
        border-bottom: 0.75pt solid red;
        vertical-align: bottom;
  }

     @top-left{
        content: " ";
        border-bottom: 0.75pt solid red;
        vertical-align: bottom;
  }

}
Any ideas why this could be occurring and how it can be solved?

Thanks.

Re: Missing header image on some pages

Posted: Mon Aug 19, 2019 11:43 am
by Costin
Hi dbutch,

Besides the general @page selector that you are already using in the CSS, you should also add the @page chapter:left:right:first selector into your customization CSS and use the same properties on it.
Like:

Code: Select all

@page chapter:left:right:first{

    padding-top: 4pt;

    @top-right {
        content: '\A0\A0\A0';
        background-image: url('oxygen.jpg') !important;
        background-repeat:no-repeat;
        background-position:100% 50%;  
        border-bottom: 0.75pt solid red;
        vertical-align: bottom;
    }

    @top-center {
        content: string(maptitle)!important;
        color: black;
        border-bottom: 0.75pt solid red;
        vertical-align: bottom;
  }

     @top-left{
        content: " ";
        border-bottom: 0.75pt solid red;
        vertical-align: bottom;
  }

}
I tested this on the "flowers" sample DITA Map from the oXygen sample project and the logo is displayed correctly on all of the matched pages.

Regards,
Costin

Re: Missing header image on some pages

Posted: Wed Aug 21, 2019 1:52 am
by dbutch
Hi Costin,

Thanks for your response and for highlighting the need to include chapter.

For reference, I ended up with the following CSS which appears to work:

Code: Select all

@page :left:right, chapter:first:left:right {

    @top-right{
        content: '\A0\A0\A0';
        background-image: url('Logo Inverted CMYK resized.png') !important;
        background-repeat:no-repeat;
        background-position:100% 50%;  
        border-bottom: 0.75pt solid red;
        vertical-align: bottom;
    }
For some reason (they were previously outputting as expected) I then had to also update the page selectors for wide pages to:

Code: Select all

@page wide-page, chapter:left:right
and also the TOC/tablelist/figurelist page selectors to:

Code: Select all

@page :first:left:right, table-of-contents:first:left:right {
All appears to be outputting as planned, other than a topic in the frontmatter booklists, which contains some revision details - this has no header or footer at all. Any suggestions how I can apply the same header/footer style to all content within frontmatter?

Many thanks.

Re: Missing header image on some pages

Posted: Wed Aug 21, 2019 6:52 am
by dbutch
Further to the above, are there any recommended methods to troubleshoot header/footer issues with DITA PDF processing? I have previously used this: https://www.oxygenxml.com/doc/versions/ ... ng_the_css for troubleshooting CSS for general issues, but would like to understand if there is a better method for troubleshooting page related issues.

Thanks.

Re: Missing header image on some pages

Posted: Wed Aug 21, 2019 11:56 am
by Costin
Hi,

In order to style the frontmatter / backmatter, you should also add the "matter-page" selector.
The "Debugging the CSS" section you already found is the best reference you should use when you need to identify the right selectors to customize the output. I just want to make you aware that you could find that section also in the more specific DITA-OT CSS Publishing to PDF Plugin User-Guide.

If you use your internet browser's CSS inspector, as advised in the Debugging CSS section, you should be able to see that for the 1st article that immediately follows the TOC (corresponding to the beginning of the Bookmap's front-matter), there is a CSS rule:

Code: Select all

[class~="map/map"] > [class~="topic/topic"]:not([is-chapter]) {
	page: matter-page;
	page-break-before: always;
}
From the declarations in that rule, it becomes pretty clear that there is a dedicated named-page (page: matter-page;) that sets the style for the topics in the frontmatter.

Given this, the selector in your customization CSS should become:
@page :left:right, chapter:first:left:right, wide-page, chapter:left:right, table-of-contents:first:left:right, matter-page{

Besides the "Debugging the CSS" section that you are already aware of, there is also the "Default Page Definitions" section in the User-Guide, that mentions all the default dedicated named-pages. It might worth taking a look over it as well, as ti could help you in identifying which page selectors you could use to apply styling through the customization CSS.

I hope this helps.

Regards,
Costin

Re: Missing header image on some pages

Posted: Mon Aug 26, 2019 4:04 am
by dbutch
Thanks Costin, that resolved the issue - all headers and footers throughout the document are styled as intended now.

Thanks for your support.