Native PDF: Cover Page: Cover image: Dynamically pick-up and display | Community
Skip to main content
Level 2
October 4, 2024

Native PDF: Cover Page: Cover image: Dynamically pick-up and display

  • October 4, 2024
  • 3 replies
  • 1580 views

I've read the help on page templates and can see that we can hardcode a logo, other image, of background image into the design.

 

I know that we can define text variables and display these on the page template.

 

But what do we do if we have images that vary by publication, and we want to display one of those dynamic images on a location on the page?

 

For example, a cover image of the product or additional symbols or logos specific to the publication.

 

Is it possible to define an image variable that can be placed on the page layout design?

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

sschnelbach
Level 5
October 4, 2024

I am also interested in the answer to this question.

DivrajSingh
Adobe Employee
Adobe Employee
October 4, 2024

@mike-e : there could be two possible solutions to this: 

 

Option 1: if you know that all the maps are of type bookmap, then generally the images that should go on front page can be under frontmatter or some xpath under the bookmap xml

In this case, you can create a metadata field and use the xpath to the image and use it in the template page layout - check this document to know more about metadata fields

 

Option 2: if the map can be ditamap or bookmap, and lets say the image cannot be defined in the map xml then you may use User variable - defining the image path as variable in the output preset, steps as given below

  • create user variable on the output preset and 
  • define the img tag with src path as value of the variable (as of today: path should be relative to the map prefixed with "contents/" - this will be handled in future release) 
  • and use that variable in the template layout
  • the language variables sets are selectable on the output preset "Advanced" tab
This approach is also documented - check this page on Experience League (refer section "Use variables in the Native PDF templates")
 
 
I hope this helps.
 
rkody
Level 3
October 25, 2024

@mike-e @sschnelbach 

The img tag you define in the variable has to literally be the tag. I was confused at first about this so I thought I would write a comment.

i.e.

kautuk_sahni
Community Manager
Community Manager
October 16, 2024

@mike-e Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Kautuk Sahni
sschnelbach
Level 5
February 24, 2025

I'm sorry, but these explanations and examples aren't explicit enough for me. The screenshot above looks like it would work for a specific, unchanging image, but not for an image variable that would change for every map. It seems like there should be a way to define a keydef/keyref in the map for a cover_image and use that, but nothing I'm trying is working. I know how to define text as a language variable, but not the specific format for an image that would be defined within either a map or bookmap.

sschnelbach
Level 5
February 25, 2025

Thanks @rkody 

Adding to it 
I am attaching screenshot with the step-by-step approach and sample variable set and PDF template to get started .

Step 1: Create your variable sets 

Step 2: Add desired variable in your page layout ( I used "logo" variable")

 Step 3 : While publishing select desired variable set in your preset and publish!

The attached Sample contains a sample template (where the variable is used ) , a Variable set, and images.

@sschnelbach  Let me know how it goes for you 





Thank you for the detailed answer. I'm still not getting it to work, but the Variable is selectable in the maps configuration. (It's just not appearing in the Native PDF Publishing PDF output.)

 

Unless I'm doing this incorrectly, which is entirely possible, this type of variable seems to be a global variable and not specific to each map in our system. We have hundreds of maps/product docs that would require different covers. A global cover image variable would work for fewer than a dozen different covers, but not for hundreds. 

 

Please let me know if I completely misunderstood how to define this, but the variable I set up does appear as selectable in any map I opened in the XML Editor.