How to create/update Page according to the create PDF ouput in Adobe CQ | Community
Skip to main content
October 16, 2015
Solved

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

  • October 16, 2015
  • 3 replies
  • 777 views

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.

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

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

3 replies

smacdonald2008
Level 10
October 16, 2015

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.

October 16, 2015

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
smacdonald2008Accepted solution
Level 10
October 16, 2015

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