PDF Cover Image

Having trouble installing Oxygen? Got a bug to report? Post it all here.
jcollins
Posts: 5
Joined: Mon Jan 07, 2019 8:39 pm

PDF Cover Image

Post by jcollins »

I'm trying to add an image to the cover of PDF output. I've followed the instructions in the https://www.oxygenxml.com/doc/versions/ ... aid-title4 topic, have added the background-image setting to the @page front-page parameter in my custom CSS, but it's not working. I've been perusing the default p-front-page.css stylesheet to see if there's anything I'm missing, but can't find anything so far. Here's my current, custom code:

@page front-page {
size: letter;
margin-top: 1in;
background-image: url('../img/AWS_logo_RGB_letter-cover.svg');
background-repeat: no-repeat;
background-position: center;
}

Among a variety of other options, I've also tried this:

*[class~="front-page/front-page"] {
page: front-page;
}

@page front-page {
@top-center { content: url('../img/AWS_logo_RGB_letter-cover.png'); }
}

which didn't work either.

Any ideas?
Costin
Posts: 828
Joined: Mon Dec 05, 2011 6:04 pm

Re: PDF Cover Image

Post by Costin »

Hi,

What version and build of oXygen XML are you using? You can check this in the oXygen's Help > About menu.
Have you tried using a different SVG image?

I have just tried with oXygen XML Editor 20.1, build 2018122403 the latest official release of oXygen publicly available in the Download section from our website, using the bundled DITA OT 2.x (you can see what DITA OT oXygen is using in the menu Options > Preferences > DITA, under the "DITA Open Toolkit" section).
I used the example SVG from the User-Guide page you mention and applied it as a custom background for the front page of the output obtained for the flowers.ditamap sample DITA Map from the sample project in oXygen. It worked as it should - I obtained a green gradient for the "Growing Flowers" front page.
I tested the CSS customization with both CSS-based PDF transformations ("DITA Map PDF - based on DITA & CSS (WYSIWYG)" and "DITA Map PDF - based on HTML5 & CSS") and succeeded in both cases.

I should mention that I just used the first @page CSS at-rule

Code: Select all

@page front-page {
size: letter;
margin-top: 1in;
background-image: url('../img/AWS_logo_RGB_letter-cover.svg');
background-repeat: no-repeat;
background-position: center;
}
and that did the trick, without being necessary to use any other selectors.

Most probably you have other rules in your CSS that overwrite this ones (probably in your custom CSS you are using selectors with higher specificity).
You should try using a customization CSS that contains only the above rule and see if it works.

If anything else fails, you could send us a sample DITA Map, in an as minimal form as possible, together with your customization CSS and the SVG that you could reproduce the issue with and we will try having a look to see what is wrong with your customization.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
jcollins
Posts: 5
Joined: Mon Jan 07, 2019 8:39 pm

Re: PDF Cover Image

Post by jcollins »

Hi Costin — Thanks for your response.

Apologies for not including my Oxygen info to begin with. I'm running v20.1 and I have selected the default bundled DITA OT 2.x option.

I have tried using a different SVG image, including a new image that uses the sample SVG info included in the Help topic you mentioned. That didn't work.

I also tried other image formats (PNG, JPG), which also didn't make a difference.

I tried creating a new OPT that references a CSS that only includes the @page front-page style definition, as you suggested. That also didn't add the image to the front page.

I went through my CSS to see if there were any conflicting styles and removed anything that could have even remotely posed a problem. There wasn't anything in there that I could find that could be causing a conflict, and it didn't yield a different result.

I'll take another look at the sample project and see if there's anything else I can find.

Other ideas (before I create a new project for you to look at)? Could there be some setting in the Oxygen preferences that I'm missing? Something in my OPT or DTD? Any other files that I might have missed configuring that could contribute?

Thanks so much for your help!
Julie
jcollins
Posts: 5
Joined: Mon Jan 07, 2019 8:39 pm

Re: PDF Cover Image

Post by jcollins »

Hi Costin — After lots of additional testing, it looks like the image file is the issue. For some reason, Oxygen wouldn't parse the image I assigned to the front-page. I created it a different way and now it's appearing. It doesn't really make any sense, given that the file works fine in other programs, including those that generate PDFs, but there it is.

Thanks for all your efforts on this.

Julie
Post Reply