Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

How to create/update Page according to the create PDF ouput in Adobe CQ

Anonymous
Not applicable

When you author in Adobe CQ, you may need to create a pdf version of the page. And PDF pages would be translate to another language like Chinese. Is there possibly a way or read-to-use solution could create new language page or update the page according to the PDF file?

Thanks in advance.

1 Accepted Solution
smacdonald2008
Correct answer by
Level 10
Level 10

To update the JCR - i would not use Session.importXML:

 Deserializes an XML document and adds the resulting item subtree as a child of the node at parentAbsPath.

Instead - write a custom method that uses the JCR API to update the JCR directly. Get the values that you want to update then use JCR API to update the JCR. If the values are in XML, read the XML using W3C DOM APIs.

See this community article as an example of using the JCR API to udate the JCR API:

http://helpx.adobe.com/experience-manager/using/persisting-cq-data-java-content1.html

Hope this helps

View solution in original post

3 Replies
smacdonald2008
Level 10
Level 10

From my understanding, are you asking if you can feed AEM a PDF an AEM updates an AEM page based on data located in the PDF. If that is correct- then the answer is no - AEM does not support this functionality out of the box. You would have to write a custom service and use a API Java lib to read the PDF (ie - PDFBox) and the service can update the AEM JCR accordingly.

Anonymous
Not applicable

Thanks for your reply. Yes, you get my mean exactly. Also i just mean to use JAVA API to do that.

Right now i change the XML version of a page replace PDF. snippet code like following:

private static void exportSystemView(Session session, Node page) { try { // page at "content/geometrixx/en/services/banking"; File outputFile = new File(page.getName() + ".xml"); FileOutputStream out = new FileOutputStream(outputFile); session.exportSystemView(page.getPath(), out, false, false); } catch (PathNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RepositoryException e) { // TODO Auto-generated catch block e.printStackTrace(); } }

 

And then i modify it's text part in the export XML, use following code to import so that to update the page but fail:

private static void importSystemView(Session session, File file, String path) { try { System.out.println("path: " + path); FileInputStream fs = new FileInputStream(file); // the XML File content changed. e.g., modify the page title session.importXML(path, fs, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING); } catch (Exception ex){ } }

 

I refresh the page ,double click the page, but content don't happen update.

Anyone know the reason?

smacdonald2008
Correct answer by
Level 10
Level 10

To update the JCR - i would not use Session.importXML:

 Deserializes an XML document and adds the resulting item subtree as a child of the node at parentAbsPath.

Instead - write a custom method that uses the JCR API to update the JCR directly. Get the values that you want to update then use JCR API to update the JCR. If the values are in XML, read the XML using W3C DOM APIs.

See this community article as an example of using the JCR API to udate the JCR API:

http://helpx.adobe.com/experience-manager/using/persisting-cq-data-java-content1.html

Hope this helps

View solution in original post