From 2431f9fe34ac61a1a5928e00657a8cca81f10d11 Mon Sep 17 00:00:00 2001 From: Desislava Yordanova Date: Fri, 4 Sep 2026 17:46:12 +0300 Subject: [PATCH 1/2] AI Search Gap: Supported MIME Types for embedding files Expanded the "Specifying the MIME Type" section with: Clarification that EmbeddedFile.MimeType accepts any standard IANA MIME type string and defaults to "application/octet-stream". A reference table of common MIME types (.pdf, .docx, .doc, .xlsx, .xls, .txt, .xml, .csv, .png, .jpeg). Important distinction between modern OpenXML types (.docx as application/vnd.openxmlformats-officedocument.wordprocessingml.document, .xlsx as application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) and legacy Office binary types (.doc as application/msword, .xls as application/vnd.ms-excel). A complete C# code example demonstrating embedding multiple files with their respective file names and MIME types. --- .../embedded-file-streams.md | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md b/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md index cd9f0974..010eae45 100644 --- a/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md +++ b/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md @@ -50,12 +50,58 @@ RadPdfProcessing allows you to embed file streams into the document. The content |Minimum Version|Q1 2026| |----|----| -RadPdfProcessing allows you to set the correct MIME type when embedding the file into the PDF. This is especially important for standards like PDF/A-3 and Factur-X, which require strict metadata and MIME type declarations for embedded files. +RadPdfProcessing allows you to set the MIME type when embedding a file into a PDF document via the `MimeType` property of `EmbeddedFile`. The `MimeType` property accepts any standard IANA MIME type string. If not explicitly specified, the default value is `"application/octet-stream"`. + +Declaring the correct MIME type along with the proper file extension in the `Name` property ensures that PDF viewers (such as Adobe Acrobat) correctly identify the attachment format, associate it with the right host application, and meet requirements for standards like PDF/A-3 and Factur-X. **Set the MIME Type** +#### Common Supported MIME Types + +The following table lists common MIME types used when embedding attachments: + +| File Format | File Extension | MIME Type | +|---|---|---| +| PDF Document | `.pdf` | `application/pdf` | +| OpenXML Word Document | `.docx` | `application/vnd.openxmlformats-officedocument.wordprocessingml.document` | +| Microsoft Word 97–2003 | `.doc` | `application/msword` | +| OpenXML Excel Spreadsheet | `.xlsx` | `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` | +| Microsoft Excel 97–2003 | `.xls` | `application/vnd.ms-excel` | +| Plain Text | `.txt` | `text/plain` | +| XML Document | `.xml` | `application/xml` or `text/xml` | +| CSV Spreadsheet | `.csv` | `text/csv` | +| PNG Image | `.png` | `image/png` | +| JPEG Image | `.jpg`, `.jpeg` | `image/jpeg` | +| Generic Binary Data (Default) | *any* | `application/octet-stream` | + +>important Notice the distinction between Office Open XML formats and legacy binary formats: +>* `.docx` uses `application/vnd.openxmlformats-officedocument.wordprocessingml.document`, while legacy `.doc` uses `application/msword`. +>* `.xlsx` uses `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`, while legacy `.xls` uses `application/vnd.ms-excel`. +>Assigning `application/msword` to a `.docx` file or omitting the extension in the `Name` property may cause PDF viewers to fail when launching the attachment. + +**Example: Embedding Files with Different MIME Types** + +```csharp +RadFixedDocument document = new RadFixedDocument(); + +// Embed a PDF file +byte[] pdfBytes = File.ReadAllBytes("sample.pdf"); +EmbeddedFile pdfAttachment = document.EmbeddedFiles.Add("sample.pdf", pdfBytes); +pdfAttachment.MimeType = "application/pdf"; + +// Embed a DOCX file +byte[] docxBytes = File.ReadAllBytes("report.docx"); +EmbeddedFile docxAttachment = document.EmbeddedFiles.Add("report.docx", docxBytes); +docxAttachment.MimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; + +// Embed a TXT file +byte[] txtBytes = File.ReadAllBytes("notes.txt"); +EmbeddedFile txtAttachment = document.EmbeddedFiles.Add("notes.txt", txtBytes); +txtAttachment.MimeType = "text/plain"; +``` + ### Creating an Embedded Electronic (ZUGFeRD) Invoice RadPdfProcessing supports embedding [ZUGFeRD invoices]({%slug radpdfprocessing-embedded-file-streams-zugferd-invoices%}). From 1fc6c19ed8f169e9858bfd89d6edc74a010f4762 Mon Sep 17 00:00:00 2001 From: "PROGRESS\\ykaraman" Date: Wed, 9 Sep 2026 13:44:43 +0300 Subject: [PATCH 2/2] Extracted code snippet --- .../embedded-file-streams.md | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md b/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md index 010eae45..77350751 100644 --- a/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md +++ b/libraries/radpdfprocessing/features/embedded-file-streams/embedded-file-streams.md @@ -54,10 +54,6 @@ RadPdfProcessing allows you to set the MIME type when embedding a file into a PD Declaring the correct MIME type along with the proper file extension in the `Name` property ensures that PDF viewers (such as Adobe Acrobat) correctly identify the attachment format, associate it with the right host application, and meet requirements for standards like PDF/A-3 and Factur-X. -**Set the MIME Type** - - - #### Common Supported MIME Types The following table lists common MIME types used when embedding attachments: @@ -83,24 +79,7 @@ The following table lists common MIME types used when embedding attachments: **Example: Embedding Files with Different MIME Types** -```csharp -RadFixedDocument document = new RadFixedDocument(); - -// Embed a PDF file -byte[] pdfBytes = File.ReadAllBytes("sample.pdf"); -EmbeddedFile pdfAttachment = document.EmbeddedFiles.Add("sample.pdf", pdfBytes); -pdfAttachment.MimeType = "application/pdf"; - -// Embed a DOCX file -byte[] docxBytes = File.ReadAllBytes("report.docx"); -EmbeddedFile docxAttachment = document.EmbeddedFiles.Add("report.docx", docxBytes); -docxAttachment.MimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; - -// Embed a TXT file -byte[] txtBytes = File.ReadAllBytes("notes.txt"); -EmbeddedFile txtAttachment = document.EmbeddedFiles.Add("notes.txt", txtBytes); -txtAttachment.MimeType = "text/plain"; -``` + ### Creating an Embedded Electronic (ZUGFeRD) Invoice