'Spring boot email pdf attachment receiving as blank
In my spring boot application I need to send pdf file as attachment. I am using below code
InputStream resource = new ClassPathResource("MyPdfFile").getInputStream();
byte [] encodedByte = Base64.getEncoder().encode(resource.readAllBytes());
if (encodedByte != null) {
String encodedString = new String(encodedByte, StandardCharsets.UTF_8);
myPdf.setValue(encodedString);
myPdf.setName("MyPdfFile");
}
attachmentsList.add(myPdf);
While receiving email, I am receiving the pdf as all pages as blank page. Am I missing anything in this code. I spent lot of time on this analysis Can any one please help me on this
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
