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");
    }
}
convertメソッドは、ストリーム、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.