Level 1
Level 2
Melden Sie sich an, um alle Badges zu sehen
Hi ,
I am able to get the PDF file path as /content/dam/folder1/folder2/pdf.pdf, not I want to read the pdf data and convert it into the byteArray.
I am not able to read the PDF file from DAM asset as we read it simple from local system. kindly revert.
Thank You
Gelöst! Gehe zu Lösung.
Anhand von Themen werden Community-Inhalte kategorisiert und Sie können so relevanten Inhalt besser finden.
Zugriffe
Antworten
Likes gesamt
Hi,
You could follow the next steps:
- Get the asset rendition
- From the rendition, you get the InputStream
- Then you convert your InputStream to ByteArray
Something like this:
Resource rr = resourceResolver.getResource(pathToYourAsset);
Asset asset = rr.adaptTo(Asset.class);
Rendition originalRendition = asset.getOriginal();
InputStream is = originalRendition.getStream();
byte[] bytes = IOUtils.toByteArray(is);
Please check these links for more details:
https://stackoverflow.com/questions/1264709/convert-inputstream-to-byte-array-in-java
https://www.baeldung.com/convert-input-stream-to-array-of-bytes
Hope this helps
Hi,
You could follow the next steps:
- Get the asset rendition
- From the rendition, you get the InputStream
- Then you convert your InputStream to ByteArray
Something like this:
Resource rr = resourceResolver.getResource(pathToYourAsset);
Asset asset = rr.adaptTo(Asset.class);
Rendition originalRendition = asset.getOriginal();
InputStream is = originalRendition.getStream();
byte[] bytes = IOUtils.toByteArray(is);
Please check these links for more details:
https://stackoverflow.com/questions/1264709/convert-inputstream-to-byte-array-in-java
https://www.baeldung.com/convert-input-stream-to-array-of-bytes
Hope this helps
Thank You so much , it's working.
Zugriffe
Antworten
Likes gesamt
Zugriffe
Likes
Antworten
Zugriffe
Likes
Antworten