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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to send pdf as attachment using CQ Code

Avatar

Level 1

How to send pdf as attachment using CQ Code

1 Reply

Avatar

Level 1

               String fileName = "/content/dam/cnc/ui/pdfs/retail/test.pdf";

                resource = resolver.getResource(fileName);

                Node imageNode = resource.adaptTo(Node.class);

                Node contentNode = imageNode.getNode("jcr:content");

                Binary imageBinary = contentNode.getProperty("jcr:data")

                        .getBinary();

                InputStream imageStream = imageBinary.getStream();

i am getting the exception as

javax.jcr.PathNotFoundException: jcr:data not found on /content/dam/cnc/ui/pdfs/retail/test.pdf/jcr:content