Page 1 of 1

Path to image from Cover Page for PDF

Posted: Tue Jul 03, 2018 7:27 pm
by shudson310
Hi,

In our PDFs for every product we have different product logo on the cover page. How can I set the path to these images so that whenever I generate PDF out the correct logo is picked?

In the XML we have:

Code: Select all

<image id="image_Project_icon" keyref="fg_Icon"
align="right">
<alt>Project icon</alt>
</image>
In the merged HTML, it seems the path to the keyref is not resolved properly:

Code: Select all

<div name="cover-image" class="- topic/data data">

<div align="right" audience="CA" format="png" href="oxy_ex-1/media/JPse/fg_Icon.png" id="_Connect_42_image_Project_icon" keyref="fg_Icon" placement="inline" class="- topic/image image">
<div class="- topic/alt alt">Project icon</div>
</div>
</div>
And in the CSS, we have:

Code: Select all


:root {
string-set:
coverImage oxy_xpath("//*[contains(@class, 'topic/data')][@name='cover-image']/div/@href");

@page front-page {
@top-left {
content: url("../../images/logo.print.png");
max-width: 0.5in;
padding-top: 20pt;
}

@bottom-right {
content: url(string(coverImage));
}
}
How can we get the project icon to display on the cover?

Re: Path to image from Cover Page for PDF

Posted: Thu Jul 05, 2018 3:02 pm
by Costin
Hi Scott,

Unfortunately, it is not very clear what is the specific context where you insert the image reference into your source DITA document.
I am asking this as I find it a bit weird that the image you refer in your document ends up inside a <div/> element in the merged HTML document, instead of an <img/> element with an ID attribute.
Could you please provide more details?

Have you tried using the oxy_xpath function directly in "content: " instead of using the string-set variable and see if this changes anything?
We will investigate to see if building content over a URL with string-set could also be possible.

Meanwhile, as a workaround you should create multiple transformation scenarios using different publishing templates - each product should have its own publishing template file.
For example, you could have a template that would include the basic CSS and different templates referring product-specific CSS files.

Regards,
Costin

Re: Path to image from Cover Page for PDF

Posted: Fri Jul 20, 2018 11:55 pm
by shudson310
Each of our projects has a logo that is specified in the bookmap:
<data name="cover-image"><image id="project_icon" keyref="project_icon" align="right">
<alt>Project icon</alt>
</image></data>
</metadata>

That keyref gets resolved to an href in the merged.html:
<div name="cover-image" class="- topic/data data"><div align="right" format="png" href="media/project_icon.png" id="_Connect_42_project_icon" keyref="project_icon" placement="inline" class="- topic/image image">
<div class="- topic/alt alt">Project icon</div>
</div></div>
</div>

But I’m not able to get the logo to display. I’ve tried:
@page front-page {
@top-left { image-resolution: 300dpi;
content: url("../../images/companylogo.print.png");
max-width: 0.5in;
padding-top: 20pt;
}

@bottom-right {
background-image:url("oxy_xpath('//*[contains(@class, "topic/data")][@name="cover-image"]/div/@href')");
background-repeat:no-repeat;
}

And

@page front-page {
@top-left { image-resolution: 300dpi;
content: url("../../images/companylogo.print.png");
max-width: 0.5in;
padding-top: 20pt;
}

@bottom-right {
image-resolution: 300dpi;
content: url("oxy_xpath('//div[parent::div[@name="cover-image"]]/@href')");
}
}

It looks like the image is copied during processing in the log, but the image still won't display.

Re: Path to image from Cover Page for PDF

Posted: Mon Jul 23, 2018 1:56 pm
by Costin
Hi Scott,

We looked into this and unfortunately the the oxy_xpath function does not work for the page-margin box.
It should though, so an improvement request was added internally.

Therefore, this will be implemented in a future version of oXygen, but until then I'm afraid the only workaround is to work with multiple transformation scenarios using their own different CSS, like I suggested previously.

Regards,
Costin

Re: Path to image from Cover Page for PDF

Posted: Mon Jul 23, 2018 5:29 pm
by shudson310
We follow the best practice from topic5247.html

The bookmeta contains a data element with the keyref to the image. We have a separate sub map that resolves that keyref to in image in the project directory.

I don't want to maintain separate stylesheets for every project, so we eagerly wait for this feature to be supported.

Thanks,

--Scott