Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Nivel 1
Nivel 2
Iniciar sesión en la comunidad
Iniciar sesión para ver todas las insignias
Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Hello team,
I am trying to utilize the DocAssuranceService to encrypt PDFs. I have created a class using the Sample 1 under the Securing Documents section here:
https://experienceleague.adobe.com/docs/experience-manager-64/forms/use-document-services/aem-docume...
Additionally, I have a servlet identical to the below link, which calls the above class in order to retrieve a certified PDF.
I have put a snippet of the class I have created to use the DocAssurance.
public class PassEncryptCertifyExtend {
@reference
private DocAssuranceService docAssuranceService;
@reference
private SlingRepository slingRepository;
@reference
private ResourceResolverFactory jcrResourceResolverFactory ;
/**
*
* @Param inputFile - path to the pdf document stored at disk
* @Param outputFile - path to the pdf document where the output needs to be stored
* @throws Exception
*/
Document outDoc;
Logger logger = Logger.getLogger("classname");
public Document SecureDocument(Document inDoc) throws Exception{
try {
logger.info("***** CALLING ENCRYPTION OPTIONS *****");
outDoc = null;
outDoc = docAssuranceService.secureDocument(inDoc, getPassEncryptionOptions(), null, null, null);
logger.info("***** EXITING ENCRYPTION OPTIONS *****");
} catch(Exception e) {
logger.error(e);
}
return outDoc;
}
outDoc = docAssuranceService.secureDocument(inDoc, getPassEncryptionOptions(), null, null, null);
This line is providing a nullpointer exception when run. I can verify that the inDoc being passed is without any issues. In addition, thegetPassEncryptionOptions() method is being run successfully. I have tried various options such as just passing inDoc with other parameters as null, passing in with all other parameters, yet all variations return a nullPointer exception. The logger indicating the exit of the docAssuranceService.secureDocument does not run and the code returns back to the servlet. I was wondering if I could receive any guidance in this regard.
Error:
05.10.2021 15:30:09.987 *INFO* [0:0:0:0:0:0:0:1 [1633462209985] POST /bin/mergedataWithAcroform HTTP/1.1] classname ***** CALLING ENCRYPTION OPTIONS *****
05.10.2021 15:30:10.007 *ERROR* [0:0:0:0:0:0:0:1 [1633462209985] POST /bin/mergedataWithAcroform HTTP/1.1] classname java.lang.NullPointerException
¡Resuelto! Ir a solución.
Los temas ayudan a categorizar el contenido de la comunidad e incrementan la posibilidad de encontrar contenido relevante.
Vistas
Respuestas
Total de me gusta
public InputStream certifyDocument(com.adobe.aemfd.docmanager.Document documentToCertify, String credentialAlias,
String fieldName) {
this.credentialAlias = credentialAlias;
this.fieldName = fieldName;
ResourceResolver resourceResolver = null;
com.adobe.aemfd.docmanager.Document certifiedDocument = null;
try {
try {
resourceResolver = getResolver.getFormsServiceResolver();
certifiedDocument = docAssuranceService.secureDocument(documentToCertify, null,
getCertificationOptions(resourceResolver), null, null);
log.info("Certified the document");
System.out.println("Certified document");
certifiedDocument.copyToFile(new File("c:\\scrap\\abc.pdf"));
} catch (Exception e) {
e.printStackTrace();
}
} finally {
try {
return certifiedDocument.getInputStream();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
you can get the sample resolver from this link. You will have to deploy the bundle and add the user mapper settings as shown in the document
Vistas
Respuestas
Total de me gusta
hmmm
one last option - can you create your own developingWithServiceUser bundle and use it. The entire code is listed here
Vistas
Respuestas
Total de me gusta
Hello,
Thanks for your comment. I had also tried this but it uses the same import which is providing the "import cannot be resolved" errors. The example code similarly uses the
com.mergeandfuse.getserviceuserresolver.GetResolver
This uses the GetResolver which comes from the zip file attachment from Step 1 in that link (the zip file is the same DevelopingWithServiceUser bundle.
Vistas
Respuestas
Total de me gusta
lets do a web session
Vistas
Respuestas
Total de me gusta
Hello,
Thank you for your response. I was wondering if you had some availability today for a web session?
Vistas
Respuestas
Total de me gusta
Yes, send me a private message and the link
we can do the web session at 10 am pst today
In 2 hours from now
Vistas
Respuestas
Total de me gusta
Ok let’s do the web session at 12:15 PM pst
send me the link via private message
Vistas
Respuestas
Total de me gusta
Vistas
Respuestas
Total de me gusta
Is it about the resource resolver?
Vistas
Respuestas
Total de me gusta
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas