Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Not able to open few Attachments in PDF

$
0
0
hi Support,

           I have created a PDF and attached documents to it. And few random documents are not opening. Can you please advise on this? Below is the code snippet, where reading a directory with file names.

public Document addDocAttachments(Document doc, String destDir,
List<String> filenames) throws Exception {

FileSpecification filespecifications = null;

try {
for (String document : filenames) {
filespecifications = new FileSpecification(destDir
+ File.separator + document, document);

/* Adding attachments to PDF happens here */
doc.getEmbeddedFiles().add(filespecifications);
}
// Logger.info("File Attachments embedded to PDF");
} catch (Exception e) {
e.printStackTrace();
throw new Exception(
"Error occured while attaching documents to email PDF template. ",
e);
}
return doc;

}

Attaching the output document.

Thanking You
Rajesh

Viewing all articles
Browse latest Browse all 3131

Trending Articles