Hi there.
I was trying to use the existing PdfExporterService available through Confluence PDF Export. Looking at the plugin on UPM, shows that is exporting services under:
- com.atlassian.confluence.extra.flyingpdf
- com.atlassian.confluence.extra.flyingpdf.rpc
According to the interface definition there is a method that in theory suits nice to our needs:
File createPdfForPage(User var1, AbstractPage var2, String var3, PageExportMetrics var4);
I correctly import the component using @ComponentImport on my plugin, but when I tried to instantiate a new object of PageExportMetrics, a ClassNotFoundException is thrown.
I wonder if I’m doing something wrong or it’s just the package where the class belongs (com.atlassian.confluence.extra.flyingpdf.analytics) is not exported. In that case, why export some services like PdfExportService if at the end we cannot use it?
I will appreciate any kind of answer on this topic. I was gonna open a support ticket but before that, better ask the community :-).
Kind regards,
David Herrera
1 Like
Well, just in case someone in the future reach to this topic. I also put here the link to the support ticket with Atlassian: Jira Service Management
Hello @DavidHerreraAlonso
From what I see , Confluence Pdf Exporter Plugin only exports the following packages
com.atlassian.confluence.extra.flyingpdf,
com.atlassian.confluence.extra.flyingpdf.rpc
However, the PageExportMetrics is actually under com.atlassian.confluence.extra.flyingpdf.analytic.PageExportMetrics
, so you should be noticing something like this in the logs
Caused by: org.osgi.framework.BundleException:
Unable to resolve org.viqueen.atlassian.confluence-devbox-plugin [320](R 320.0):
missing requirement [org.viqueen.atlassian.confluence-devbox-plugin [320](R 320.0)]
osgi.wiring.package; (osgi.wiring.package=com.atlassian.confluence.extra.flyingpdf.analytic)
Unresolved requirements: [[org.viqueen.atlassian.confluence-devbox-plugin [320](R 320.0)]
osgi.wiring.package; (osgi.wiring.package=com.atlassian.confluence.extra.flyingpdf.analytic)]
I can’t think of a decent workaround
, the Confluence team will need to release a new version of the plugin and export the packages that PdfExporterService
uses
I hope this helps
Hasnae R.
former Confluence person
1 Like
Hi @viqueen-hasnae , thanks for your reply, it’s appreciated 
Yep, seems like only direct classes under those packages are exported. But exposing a service and then not able to use it because some subpackages are not exported, its a bit contradictory.
Let’s hope we have some good news on the support ticket 
Cheers!
1 Like
Hi @DavidHerreraAlonso
Indeed, it’s not perfect, but I know the team has done tremendous efforts over the year to catch and fix these API discrepancies.
I am quite familiar with the pdf-export plugin actually , but I don’t have direct code access anymore , I can perhaps loop in my old friend @ggautam , maybe this is something worth fixing as part of 8.0 ?
1 Like
Thanks for your feedback @viqueen-hasnae . Yep, sure, I really appreciate developer team. I discussed with some of them during some support ticket with xstream 1.4, and I liked the chat :).
Hopefully good news are coming 
Updates: They have created a bug ticket, so there is hope of incoming versions with a fix. Feel free to vote!! 
https://jira.atlassian.com/browse/CONFSERVER-79556
1 Like