Hi, I am trying to create to convert base64 encoded pdf document to com.adobe.aemfd.docmanager.Document object by using below line of code. But it throwing error. Any suggestion please.
Document document = new Document(Base64.decodeBase64(base64));
Errors:
Exception in thread "main" java.lang.NoClassDefFoundError: com/adobe/aemfd/docmanager/source/DocumentSourceHandler
at com.aemproject.core.workflows.ConvertBase64ToDocument.main(ConvertBase64ToDocument.java:76)
Caused by: java.lang.ClassNotFoundException: com.adobe.aemfd.docmanager.source.DocumentSourceHandler
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 1 more
I don't know how to resolve this problem.
-Sri
Views
Replies
Total Likes
There is no constructor to create document from base64 in AEM forms OSGi
@GirishBedekar he is decoding it in the call.
But I wonder which Base64 class that is. The Oracle JDK class is defined here https://docs.oracle.com/javase/8/docs/api/java/util/Base64.html
Are you sure that a byte array is passed? Sure that the base64 variable decodes to a proper PDF?
Did you try to have the decoding separate like
byte [] thePdfDocument = Base64.decodeBase64(base64);
Document document = new Document(thePdfDocument);
-Kosta
I am using Java Util package. Yes, Byte array passing to as a parameter.
I am getting same error message when using below code as you recommended. Thanks
String baseDoc = "......";
Base64.Decoder decoder = Base64.getDecoder();
// Decoding string String dStr = new String(decoder.decode(baseDoc));
Document document = new Document(dStr.getBytes());
I see you posted also in another thread.
I tested this with AEM Forms 6.5.7 using
<dependency>
<groupId>com.adobe.aemfd</groupId>
<artifactId>aemfd-client-sdk</artifactId>
<version>6.3.0</version>
</dependency>
and it did work.
What version of AEM Forms are you using?
Views
Likes
Replies
Views
Likes
Replies