AEM 表单(PDF 类型)文件附件 [英] AEM Forms (PDF Type) File Attachments

查看:23
本文介绍了AEM 表单(PDF 类型)文件附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将文件附件添加到我的 AEM 表单.这个想法是将附件嵌入到 PDF 中;提交 PDF 后,后端系统将能够从 PDF 中提取附件.

I am trying to implement file attachment to my AEM Form. The idea is to embed the attachment to the PDF; Upon submission of the PDF, the backend system will be able to extract the attached file from the PDF.

我似乎找不到任何关于如何去做的例子,这让我想知道这是一个限制.但是,在下面的 adobe 站点上,实际上声明了所有 AEM 表单类型的支持文件附件".

I can't seem to find any example on how I can go about doing it, which make me wonder is it a limitation. However, on adobe site below, it is actually stated "Support for file attachments" for all AEM form types.

https://helpx.adobe.com/aem-forms/6/introduction-aem-forms.html

请指教!谢谢!

推荐答案

下面是添加附件"按钮的代码.

Below is the code for "Add Attachment" button.

var oDoc = event.target;
var doccount = parseInt(colhead.attcount.rawValue);
colhead.attcount.rawValue = doccount + 1;
Trusted_ImportDataObject(oDoc, doccount);
var oAttachment = oDoc.getDataObject("attachment_" + doccount);
var DOsize = oAttachment.size;
var DOmimeType = oAttachment.MIMEType;
if (DOmimeType == null) DOmimeType = "reject";
if ((DOsize > 1100000) || (DOmimeType.indexOf("image/") != 0)) {
    xfa.host.messageBox("Attachemtns must be an image and smaller than 1 Megabyte");
    oDoc.removeDataObject("attachment_" + doccount);
} else {    
    var attachPath = oAttachment.path;
    AttachFileName.rawValue = attachPath;
    AttachMIMEType.rawValue = oAttachment.MIMEType;
    AttachHref.rawValue = oAttachment.name;
}

请注意,需要 Reader Extension 才能启用文件附件.否则你会得到这个错误:

Do note that Reader Extension is needed to enable file attachment. Else you will be getting this error:

NotAllowedError: Security settings prevent access to this property or method.
Doc.importDataObject:6:XFA:CTR[0]:Page6[0]:part6[0]:body[0]:attachitem[0]:AddAttachment[0]:click

这篇关于AEM 表单(PDF 类型)文件附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆