Adding dynamic content while PDF/HTML export from Confluence ?
Asked by Anil Gupta:

Is there any way to add dynamic content to exported pages in confluence(for all PDF/HTML/XML export) if someone want to implement for own plugin ?

I understand there are possibilities regarding formatting, which is kind of static not dynamic


Answers:
author: Stephen Sifers
body: Hello Anil,

This is an interesting idea, having dynamic content within Confluence that follows the page via a PDF export.

The difficult aspects to this would be what type of Dynamic content you want to store within Confluence that you want available within a PDF export. The issue would be how would the content stay linked while exported and more so control of sensitive data.

To understand a bit more about what type of content you're wanting, could you provide additional information or examples into what you're looking for? Any examples of what others have done or screenshots would be helpful.

We look forward to your response along with any information you can share to help give you direction.

Regards,  
Stephen Sifers

comments: author: Anil Gupta
body: Hi Stephen,

Thanks for responding!!

For scenario something like,

"**Any web-item(in some section of confluence space/page) which displays some information and same can be available while export!!**"

Is there any component which is be available(I looked available component but none seems useful or handy) to inject?

If available then we can inject value/values and same can be retrieve dynamically in customized(Available in space tool) HTML/PDF layout ?

Regards,

Anil


author: Stephen Sifers
body: Hello Anil,

Thanks for the response along with additional clarification.

Without having an example to test this, I am not sure if the PDF export built into Confluence will export the content in the way you want (keeping the content connected and dynamic). With this said, there is further information on PDF exports at:

* [Export Content to Word, PDF, HTML and XML](https://confluence.atlassian.com/doc/export-content-to-word-pdf-html-and-xml-139475.html)
* [Customize Exports to PDF](https://confluence.atlassian.com/doc/customize-exports-to-pdf-190480945.html)

Along with this, it sounds like an alternative would be to explore marketplace add-ons which may bring in more PDF functionality that you're looking for. We would suggest you review the Atlassian Marketplace to see what is available. Here is a preset search for the marketplace for [Atlassian Marketplace \| PDF export](https://marketplace.atlassian.com/search?product=confluence&query=PDF%20export).

I hope this proves helpful and provides some additional options into what you want to do with PDF exports.

Regards,  
Stephen Sifers


author: Anil Gupta
body: Hi Stephen,

I have gone through all above links already but seems less help for adding dynamic content to confluence exporter.

But in very basic example can we call **Macro** in HTML/PDF header layout(customize) somehow ?

**Macro** i can create to include dynamic value!

Regards,

Anil Gupta


author: Stephen Sifers
body: Hello Anil,

Thanks for the follow-up.

With the default Confluence PDF exporter, any macro that includes content on the page will be exported as an image within the PDF and will not be dynamic. This is due to the macros using content within Confluence to render anything within themselves. The same would apply for an HTML export which would make any content that was within a Confluence page flat and no longer integrated with Confluence or other systems. In short, you can not call upon Confluence Macros within an HTML or PDF export and expect them to render results.

If you're to create a macro which controls how a PDF is exported along with how the content within said PDF is managed, you may be able to turn some content into dynamic. As far as steps to accommodate this, you may want to consider asking in the developer community. You may find that community at [Atlassian Developer Community](https://community.developer.atlassian.com/).

I hope this clarifies why you can't call a macro within a PDF export.

Regards,  
Stephen Sifers


Tags: atl-adm