Images not displaying in pdf-css transform

Post here questions and problems related to editing and publishing DITA content.
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Images not displaying in pdf-css transform

Post by dmotiosaia »

I'm using Oxygen Editor 19.1 with the default DITA-OT and (a clone of) the 'DITAMAP PDF - WYSIWYG' transformation scenario. I'm evaluating 19.1 because of its ability to use CSS as an alternative to XPATH for styling PDF output. I've made some progress but have run into a few issues.

I was able to use an external graphic of cover art by adding a couple of custom CSS sheets, but I'm having two issues with it:

1) I can overlay text (mainbooktitle and booktitle alt) atop the external graphic and can place it using absolute positioning, However, I cannot change the color of the text. I need to make it white, to show up against a colored background in the cover art graphic, but no matter where I put the 'color: white;' attribute, it doesn't seem to apply.

2) Now that I've added the external graphic, all other images are not displaying. Here are my two CSS sheets:

1) First, the smaller, product-specific CSS, which calls the larger, default PDF:

Code: Select all


@import url("./Topics/Reuse/MainReuse/motiopdfs.css");

@page front-page {
size:us-letter;
margin-top:1in;
background-image:url("./Topics/Images/MotioPI_USER_GUIDE.tif");
background-position: top 76px;
background-repeat:no-repeat;
}

div.cover {
page: cover;
}
2) And here is the larger, global stylesheet imported by the above:

Code: Select all


@font-face{
font-family:"Myriad Pro",sans-serif;
src: url(./fonts/Myriad-Pro_31655.ttf);
}

@font-face{
font-family:"Myriad Pro-Italic",sans-serif;
src: url(./fonts/Myriad-Pro-Italic_31634.ttf)
}

@font-face{
font-family:"Myriad Pro-Bold",sans-serif;
src: url(./fonts/Myriad-Pro-Bold_31631.ttf)
}

@font-face{
font-family:"Myriad Pro-Semibold",sans-serif;
src: url(./fonts/Myriad-Pro-Semibold_31650.ttf)
}

@font-face {
font-family:"Chalet Book",sans-serif;
src: url(./fonts/ChaletBook_10032.ttf);
}

@font-face {
font-family:"Chalet Book-Bold",sans-serif;
src: url(./fonts/ChaletBook-Bold_10028.ttf);
}

front-page-title {
color: white!important;
display:block;
position:absolute;
top:447pt;
left:200pt;
}

booktitle {
color: white!important;
}

mainbooktitle { /* For ex.: "User Guide"*/
color: white!important;
font-family:"Chalet Book",sans-serif;
font-size:29pt;
line-height:29pt;
margin-bottom:0pt;
padding-bottom:0pt;

/* fwiw, this is the XPATH class: "- topic/ph bookmap/mainbooktitle" */
}

booktitlealt {
display:block;
text-align: right;
position:absolute;
top:40px;
left:-123pt;
width:4.6in;
font-family:"Chalet Book",sans-serif;
font-size:12pt;
color: white!important;
/* border: 1px solid white;*/
}


body { font-family: "Myriad Pro", arial, helvetica, sans-serif
}

bodydiv.notices {
font-family: "Myriad Pro", arial, helvetica, sans-serif;
border-left: 0.25pt solid;
margin-left:21.5em;
padding-left:1.5em;
}

section.notices {
font-family: "Myriad Pro", arial, helvetica, sans-serif;
border-left: 0.25pt solid;
margin-left:21.5em;
padding-left:1.5em;
}

shortdesc {
display: block;
font-family: "Myriad Pro-Italic",arial, helvetica, sens-serif;
margin-bottom:6pt;
}

ul {
display:block;
margin-top:6pt;
}

li {
display:list-item;
list-style-type: disc;
margin-left: 5pt;
padding-left:8pt;
padding-bottom:2pt;
}

wintitle {
font-family: "Myriad Pro-Semibold",arial, helvetica, sans-serif;
}

article, title, p {
display: block;
}

title {
font-size:24pt;
border-bottom: 1.5pt solid #ccc;
font-family:"Myriad Pro-Bold", sans-serif;
text-align:right;
font-style:bold;
padding-bottom:-8px;
letter-spacing: 0px;
line-height:24pt;
margin-bottom:18pt;
}

title.h2 {
font-size:24pt;
font-family:"Myriad Pro-Bold", sans-serif;
text-align:right;
font-style:bold;
padding-bottom:-8px;
letter-spacing: 0px;
line-height:24pt;
margin-bottom:18pt;
}

h1 {
bookmark-label: content(before) " / " content(text);
font-family:"Myriad Pro",sans-serif;
font-size: 24pt;
text-align:right;
border:none;
}

h1:before{
content: counter(chapter);
counter-increment:chapter;
}

h2 {
font-family:"Myriad Pro-Bold",sans-serif;
font-size:18pt;
bookmark-label: content(before) " / " content(text);
border-bottom: 1pt solid #ccc;
text-align: right;
}

h2 {
font-family:"Myriad Pro",sans-serif;
font-size:16pt;
bookmark-label: content(before) " / " content(text);
border-bottom: 1pt solid #ccc;
text-align: right;
}

p {
font-family:"Myriad Pro", sans-serif;
font-style:normal;
line-height:1.2;
margin-bottom:1em;
}
Do yo see anything there that might account for either issue?
Last edited by dmotiosaia on Wed Jan 10, 2018 1:16 am, edited 1 time in total.
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: Images not displaying in pdf-css transform

Post by Costin »

Hi dmotiosaia,

I tested the behavior based on the sample snippets you provided, but could not reproduce the second issue you reported.

What I did specifically: I created two custom CSS files - "custom.css" (as the 1st - product specific CSS) and "motiopdfs.css" (as the larger, global stylesheet, called by "custom.css"). Then I duplicated the DITA Map > PDF WYSIWYG scenario and set "custom.css" as a custom css parameter in the scenario configuration dialog. After configuring the scenario, I just applied it over the sample "taskbook.ditamap" map, from the "it-book" folder of the sample oXygen project, which I also modified first by adding some .jpeg and .tiff images prior to applying the scenario.
The .tiff background-image I set for the front-page element in the smaller CSS was a all-red .tiff image and that was successfully used as a front-page background, altogether with the other images that I previously added in some of the "it-book" topics.

Could you please also test your stylesheets on the taskbook.ditamap as and see if it works? If it does, then the problem could be specific to your specific source DITA Map. In that case, to investigate further, we would need you to send us a sample DITA Map brought to an as minimal as possible form, which would still reproduce the images issue.

Regarding the 1st problem (white not applied as the color for mainbooktitle and booktitle alt), this is indeed a known issue that we already have logged in our internal tracking system and which was already fixed in our development stream. The fix will be included in the next version of oXygen.
As this seems to happen only for the "white" color, the workaround would be to use a different color for the titles. It would suffice to use:

Code: Select all

@media print {
front-page-title {
color: #fffffe;
display:block;
position:absolute;
top:447pt;
left:200pt;
}
}
in your motiopdfs.css sheet, as both "mainbooktitle" and "booktitlealt" are children of the "front-page-title", so they will inherit the color set on their parent. Notice that the declarations should be enclosed in a "@media print {}" property. That is mandatory as it tells the CSS processor that the declarations should be styled as print media types.
Also, the "#fffffe" is the code of the color closest to white.

I hope you'll find this helpful.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

Hey, it worked!! (the #fffffe thing). Thanks very much! If I can configure it so that text elements on the cover page are done in the DITA (as opposed to being part of a product-specific graphic), it will save us a lot of time.

I will look into the other issue now.
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

Hello, I followed your suggestion, and as soon as the it-book ditamap started using my stylesheets, the images disappeared.

I will include complete copies of both stylesheets. Maybe you can find something in there that's causing images to not display?

First stylesheet:

Code: Select all


/*This is the CSS specific to MotioPI 101 UG*/


@import url("./Topics/Reuse/MainReuse/motiopdfs.css");


@media print {
@page front-page {
size:us-letter;
margin-top:1in;
background-image:url("./Topics/Images/All-Motio-USER_GUIDE_COVERs.tif");
background-position: top 76px;
background-repeat:no-repeat;
}
}

/*@media print {
div.cover {
page: cover;
}
}*/
The second stylesheet:

Code: Select all


/*This is the globabl stylesheet for all Motio PDFs*/

@font-face{
font-family:"Myriad Pro",sans-serif;
src: url(./fonts/Myriad-Pro_31655.ttf);
}

@font-face{
font-family:"Myriad Pro-Italic",sans-serif;
src: url(./fonts/Myriad-Pro-Italic_31634.ttf)
}

@font-face{
font-family:"Myriad Pro-Bold",sans-serif;
src: url(./fonts/Myriad-Pro-Bold_31631.ttf)
}

@font-face{
font-family:"Myriad Pro-Semibold",sans-serif;
src: url(./fonts/Myriad-Pro-Semibold_31650.ttf)
}

@font-face {
font-family:"Chalet Book",sans-serif;
src: url(./fonts/ChaletBook_10032.ttf);
}

@font-face {
font-family:"Chalet Book-Bold",sans-serif;
src: url(./fonts/ChaletBook-Bold_10028.ttf);
}

@media print {
front-page-title {
display:block;
position:absolute;
top:447pt;
left:200pt;
}
}

@media print {
booktitle {
color: #fffffe;
}
}

@media print {
mainbooktitle { /* For ex.: "User Guide"*/

font-family:"Chalet Book",sans-serif;
font-size:29pt;
line-height:29pt;
margin-bottom:0pt;
padding-bottom:0pt;
/* fwiw, this is the XPATH class: "- topic/ph bookmap/mainbooktitle" */
}
}

@media print {
booktitlealt {
color: #F0FFFF;
display:block;
text-align: right;
position:absolute;
top:40px;
left:-123pt;
width:4.6in;
font-family:"Chalet Book",sans-serif;
font-size:12pt;
font-weight:100;
}
}

@media print {
body { font-family: "Myriad Pro", arial, helvetica, sans-serif
}
}

@media print {
bodydiv.notices {
font-family: "Myriad Pro", arial, helvetica, sans-serif;
border-left: 0.25pt solid;
margin-left:21.5em;
padding-left:1.5em;
}
}

@media print {
section.notices {
font-family: "Myriad Pro", arial, helvetica, sans-serif;
border-left: 0.25pt solid;
margin-left:21.5em;
padding-left:1.5em;
}
}

@media print {
shortdesc {
display: block;
font-family: "Myriad Pro-Italic",arial, helvetica, sens-serif;
margin-bottom:6pt;
}
}

@media print {
ul {
display:block;
margin-top:6pt;
}
}

@media print {
li {
display:list-item;
list-style-type: disc;
margin-left: 5pt;
padding-left:8pt;
padding-bottom:2pt;
}
}

@media print {
wintitle {
font-family: "Myriad Pro-Semibold",arial, helvetica, sans-serif;
}
}

@media print {
article, title, p {
display: block;
}
}

@media print {
title {
font-size:24pt;
border-bottom: 1.5pt solid #ccc;
font-family:"Myriad Pro-Bold", sans-serif;
text-align:right;
font-style:bold;
padding-bottom:-8px;
letter-spacing: 0px;
line-height:24pt;
margin-bottom:18pt;
}
}

@media print {
title.h2 {
font-size:24pt;
font-family:"Myriad Pro-Bold", sans-serif;
text-align:right;
font-style:bold;
padding-bottom:-8px;
letter-spacing: 0px;
line-height:24pt;
margin-bottom:18pt;
}
}

@media print {
h1 {
bookmark-label: content(before) " / " content(text);
font-family:"Myriad Pro",sans-serif;
font-size: 24pt;
text-align:right;
border:none;
}
}

@media print {
h1:before{
content: counter(chapter);
counter-increment:chapter;
}
}

@media print {
h2 {
font-family:"Myriad Pro-Bold",sans-serif;
font-size:18pt;
bookmark-label: content(before) " / " content(text);
border-bottom: 1pt solid #ccc;
text-align: right;
}
}

@media print {
h2 {
font-family:"Myriad Pro",sans-serif;
src: url(./fonts/ChaletBook_10032.ttf);
font-size:16pt;
bookmark-label: content(before) " / " content(text);
border-bottom: 1pt solid #ccc;
src: url(./fonts/ChaletBook_10032.ttf);
text-align: right;
}
}

@media print {
p {
font-family:"Myriad Pro", sans-serif;
font-style:normal;
line-height:1.2;
margin-bottom:1em;
}
}

/*p.notices {
font-family:"Myriad Pro", sans-serif;
font-style:normal;
line-height:1.2;
margin-bottom:1em;
border-left: 0.5pt solid;
margin-left:18em;
padding-left:2em;
}*/
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

Please note that I've been adding my CSS via the dita.css.list parameter. I don't know whether that has contributed to the problem.

I can't figure out how to include more than one URL, so I had to resort to importing the 2nd CSS file into the first. How do you provide more than one CSS? I tried listing the urls in a plain-text file, but that didn't work.
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: Images not displaying in pdf-css transform

Post by Costin »

Hi again,
Please note that I've been adding my CSS via the dita.css.list parameter. I don't know whether that has contributed to the problem.
Yes, this is what causes the issue.

You should use the "argss.css" parameter instead, to pass the smaller CSS of yours, as this is what I did and worked (all other images were present and correctly displayed).
This is also the parameter suggested in our User-Guide.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

Thanks, I don't see that parameter listed. I'm using a clone of the DITA Map - PDF WYSIWYG scenario, and the args.css parameter isn't available, at least in what I'm looking at. I'm using that scenario so that I can use CSS to style PDF elements instead of XPATH -- is it necessary that I use that scenario to do that in 19.1? Or can I accomplish the same thing using a standard DITA scenario (clone of 'DITA Map PDF')?

I'd attach a screenshot, but I don't see how.
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

This is also the parameter suggested in our User-Guide
Yes, I read that page, but it refers to webhelp scenarios. I'm working on PDF output.
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: Images not displaying in pdf-css transform

Post by Costin »

You are right, sorry for providing the wrong link. The right User-Guide page is this one. The "args.css" parameter should be present also for the DITA Map PDF - WYSIWYG scenario, as you can notice from that page.

The issue could be related to some broken scenario, or even a broken framework. Could you please try starting from the default (clean) "DITA Map PDF - WYSIWYG" scenario, create a fresh duplicate, then edit the duplicate scenario and see if the "args.css" is present in the list of parameters?
Costin Sandoi
oXygen XML Editor and Author Support
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

Thanks -- I followed your instruction and started from a clean DITA Map PDF - WYSIWYG duplicate, but still no agrs.css. I tried setting the DITA -OT folder to the following, in addition to the default:

/home/david/Oxygen%20XML%20Editor%2019/frameworks/dita/DITA-OT/plugins/
/home/david/Oxygen%20XML%20Editor%2019/frameworks/dita/DITA-OT2.x/plugins/

(/home/david being where I installed Oxygen 19.1)

Note that this is a Linux install, not Windows -- could that have something to do with it?
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: Images not displaying in pdf-css transform

Post by Costin »

Hello,

Voluntary or involuntary, you might have tinkered with the default frameworks that come bundled with oXygen in the past and, somehow, you might have ended-up with a broken DITA OT 2.x framework. If I correctly understand, you wen in oXygen Options > Preferences > DITA and set a custom DITA OT folder to /home/david/Oxygen%20XML%20Editor%2019/frameworks/dita/DITA-OT2.x/plugins/. This is not correct, as the "plugins" is just a subfolder of the main DITA-OT2.x framework, so there is no DITA framework could find in either /home/david/Oxygen%20XML%20Editor%2019/frameworks/dita/DITA-OT/plugins/ or /home/david/Oxygen%20XML%20Editor%2019/frameworks/dita/DITA-OT2.x/plugins/ subfolders.

The args.css parameters must be available in the default DITA-OT (DITA-OT2.x) DITA frameworks that come with oXygen XML, so you should stick with the default DITA OT location (in the Options > Preferneces > DITA, under the "DITA Open Toolkit", you should have "Built-in DITA OT 2.x" enabled, as this is the default).

What may happen is that you could have changed your default frameworks folder to a custom location. To check that, you should go into Options > Preferences > Document Type Association > Location and check that you have the default option enabled.

Otherwise, like I specified, you might have modified the default frameworks (including DITA) in oXygen, so I suggest downloading and installing a fresh copy of oXygen XML v19.1 from our website, then install it in a separate location and use the default settings.

Then retry starting from the predefined DITA Map > PDF scenario from the transformation scenarios list.

Best Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

Yes, finally I see it! It was as you described (Options > Preferneces > DITA > DITA Open Toolkit > Built-in DITA OT 2.x). I restored the default, and now I see args.css. The funny thing is that I did recently download a trial version of 19.1 and installed it in a different location from my older, 18.1 install. I think that at some point, either automatically or when I imported my 18.1 settings, that setting was also imported and changed the above setting.

At any rate, I can see args.css now and will set the smaller of the two (which imports the larger) CSS files there and see how it goes.

Thanks very much for your help!
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

OK, I added the smaller of the two CSS files as the args.css parameter, but unfortunately, it's not importing the second CSS. I can tell because none of the font styles are being used, and t hey're all set in the second CSS. Are you sure that the second CSS was being used when you tried the same?
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: Images not displaying in pdf-css transform

Post by Costin »

Hi David,

I'm totally sure that the 2nd CSS (the "motiopdfs.css", imported by the main "custom.css" file) was used in the process.
If it would not have been used, then neither the white color would have been applied, as you performed "the #fffffe thing" over the "front-page-title" element - which is present in the "motiopdfs.css".

Given this, the font issue is most probably related to some missing fonts from your system.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

I'm not sure how to finish troubleshooting this. The two options I've tried:

A) Include the smaller CSS file as the value for "args.css", AND the larger CSS as the value for "dita.css.list,"
Result: the PDF generates with the correct fonts but without any images.

B) Include the smaller CSS file for 'args.css' but remove the 'dita.css.list' parameter.
Result: the PDF generates without the correct fonts but with all images.

I tried to include the build output for both options, but it was way too large for this form. I will send a text file via attachment in your Support email form.

I will work on this as much as I can tomorrow, as there are only 5 days left in my 19.1 trial period, and I need to resolve this before I can recommend upgrading to 19.1.
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

One clarification: in the version where it generates with images, the fonts for the following elements ARE correct:
- body
- bodydiv.notices
- section.notices
- shortdesc
- ul
- li
- wintitle

and the following fonts are wrong:
- front-page-title
- booktitle
- mainbooktitle
- booktitlealt
- topic:title
- title
- title.h2
- h1
- h2

I don't know whether that helps or not.
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: Images not displaying in pdf-css transform

Post by Costin »

David,

Both the fonts and the images seems to be working OK, when passing the main .css file (the one that imports "motiopdfs.css") through the args.css parameter (not involving the dita.css.list parameter that supersedes the default DITA topics/maps CSS rules in oXygen - which is not the case).
To test, I downloaded the "ChaletBook_10032.ttf" font and I noticed that the "mainbooktitle" font was changed also in the PDF output.

However, I noticed that in the sample snippets you provided, you explicitly set the font only for some elements and for others you did not.

Therefore, make sure that you have the fonts installed in the operating system and that the name and path to the specific font is correctly specified in CSS for the elements you need. Double check if the font associated to an element is actually present in the specified location.

If it still does not work, please provide some sample files to reproduce the issue, together with the font .ttf files you are using.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

Thanks for your help. I was hopeful re: including the "src" line everywhere I used a font, but that didn't help.

I will attache the DITA folder and the fonts folder as zipped archives, using the other Support Contact Us form.

Since I only have 2 days left in my 30-day trial, would it be possible to extend the trial, so that we can resolve this issue?

I think I've included all the files that you need in order to troubleshoot; if not, please let me know which additional files you need.

Note that the "MainReuse" folder is an OS-level redirect (symbolic link) that points the "Reuse" folder elsewhere in the system. But I have confirmed that all referenced fonts are installed. Remember that the fonts that are missing when generating using option B are present when generating using option A.

It occurred to me that if I'm using option B, then only one CSS file is being used, right? (that is, motiopdfs.css, because the dita.css.list parameter completely overwrites whatever is in the args.css parameter? I had been assuming that when using the dita.css.list parameter, the scenario had access to both values. So I tried copying all CSS declarations into the 'smaller' of the two CSS files (MotioPI-pdf.css) and generated. The result was the same as if I used option B.

At any rate, I will send the two zips now, via the other form.

Thanks again for your help.
dmotiosaia
Posts: 15
Joined: Mon Nov 09, 2015 10:42 pm

Re: Images not displaying in pdf-css transform

Post by dmotiosaia »

I see that, when I use only the args.css parameter (and not the dita.css.list parameter) in the transformation scenario, the dita.css.list parameter is still used, and it references one css file (profiling.css) three times:

[echo] dita.css.list=file\:/home/david/Oxygen%20XML%20Editor%2019/frameworks/dita/css/edit/style-basic.css;file\:/home/david/Oxygen%20XML%20Editor%2019/frameworks/dita/css/webauthor/profiling.css;file\:/home/david/Oxygen%20XML%20Editor%2019/frameworks/dita/css/webauthor/profiling.css;/home/david/dev-projects/MotioPI/docs/DITA/MotioPI-pdf.css;file\:/home/david/Oxygen%20XML%20Editor%2019/frameworks/dita/css/webauthor/profiling.css;file\:/home/david/dev-projects/MotioPI/docs/DITA/Topics/Reuse/MainReuse/motiopdfs.css;

Why is that?
Post Reply