Hi
I am able to generate the PDF at specific location when I am hitting the api, but after PDF is getting generated I want to deploy it to publisher instance without publishing it manually.
Thank You
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @Dear_AT ,
1. Once you generate the PDF post hitting the API, get the path lets say at /content/somelocation/generatedPdf.pdf, save the path/resource using session.save() if you are using Node API or resourceResolver.commit() if you want to use Resource API.
2. Then simply publish the same path using com.day.cq.replication.Replicator API
public void replicateAsset(ResourceResolver resourceResolver, String assetPath) throws ReplicationException {
replicator.replicate(resourceResolver.adaptTo(Session.class), ReplicationActionType.ACTIVATE, pathToGeneratedPdf);
}
Hi @Dear_AT ,
1. Once you generate the PDF post hitting the API, get the path lets say at /content/somelocation/generatedPdf.pdf, save the path/resource using session.save() if you are using Node API or resourceResolver.commit() if you want to use Resource API.
2. Then simply publish the same path using com.day.cq.replication.Replicator API
public void replicateAsset(ResourceResolver resourceResolver, String assetPath) throws ReplicationException {
replicator.replicate(resourceResolver.adaptTo(Session.class), ReplicationActionType.ACTIVATE, pathToGeneratedPdf);
}
Hi,
As explained @anupampat you need to use the Replicator API to achieve that. You can try something like below
@Reference
private Replicator replicator;
..
..
replicator.replicate(session, ReplicationActionType.ACTIVATE, assetPath);
You can learn more here:
https://dev.to/jerinraj55551/replication-api-in-aem-adobe-experience-manager-405n
Hope this helps
Views
Likes
Replies