Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
以下代码片段也适用于 Aspose.PDF.Drawing 库。
我们建议按照以下步骤将 ZUGFeRD 附加到 PDF:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AttachZUGFeRD()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "ZUGFeRD-testInput.pdf"))
{
// Setup new file to be added as attachment
var description = "Invoice metadata conforming to ZUGFeRD standard";
var fileSpecification = new Aspose.Pdf.FileSpecification(dataDir + "ZUGFeRD-testXmlInput.xml", description)
{
Description = "Zugferd",
MIMEType = "text/xml",
Name = "factur-x.xml"
};
// Add attachment to document's attachment collection
document.EmbeddedFiles.Add(fileSpecification);
document.Convert(new MemoryStream(), Aspose.Pdf.PdfFormat.ZUGFeRD, Aspose.Pdf.ConvertErrorAction.Delete);
// Save PDF document
document.Save(dataDir + "AttachZUGFeRD_out.pdf");
}
}
转换方法接受一个流、一个 PDF 格式和一个转换错误操作作为参数。流参数可用于保存转换日志。转换错误操作参数指定在转换过程中发生任何错误时该怎么办。在这种情况下,它被设置为 “Delete”,这意味着任何不符合 PDF/A-3B 格式的元素将从文档中删除。
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.