Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
The following code snippet also work with Aspose.PDF.Drawing library.
We recommend following steps to attach ZUGFeRD to 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");
}
}
The convert method takes a stream, a PDF format, and a convert error action as parameters. The stream parameter can be used to save the conversion log. The convert error action parameter specifies what to do if any errors occur during the conversion. In this case, it is set to “Delete”, which means that any elements that are not compliant with the PDF/A-3B format will be deleted from the document.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.