DynaPDF.SetXFAStream
--------------------

Replaces the contents of an XFA stream with new contents.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [9.5](newinversion95.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.SetXFAStream"; PDF; Index; XML ) 

**MBS**( **"DynaPDF.SetXFAStream";** /\* Replaces the contents of an XFA stream with new contents. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Index**; /\* The index for the stream.  
From 0 to [DynaPDF.GetXFAStreamCount](DynaPDFGetXFAStreamCount.md)-1.e.g. 0 \*/   
**$XML**) /\* The XML to use. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| Index | The index for the stream.   From 0 to [DynaPDF.GetXFAStreamCount](DynaPDFGetXFAStreamCount.md)-1. | 0 |
| XML | The XML to use. |  |

### Result

Returns OK or error.

### Description

Replaces the contents of an XFA stream with new contents.   
Index must be a valid XFA resource index. XFA streams can be enumerated with [DynaPDF.GetXFAStream](DynaPDFGetXFAStream.md) / [DynaPDF.GetXFAStreamCount](DynaPDFGetXFAStreamCount.md).   
The function does not check whether the provided XFA buffer is valid. The buffer is written to the stream as is.   
  
To edit a XFA form, you may use [DynaPDF.GetXFAStream](DynaPDFGetXFAStream.md) first to query the data, use our [XML](component_XML.md) functions to edit the form values and then use this function to write it back.  
See also [SetXFAStream](https://www.monkeybreadsoftware.com/DynaPDF-Manual/SetXFAStream.shtml) function in DynaPDF manual.

### See also

- [DynaPDF.CreateXFAStream](DynaPDFCreateXFAStream.md)
- [DynaPDF.GetXFAStream](DynaPDFGetXFAStream.md)
- [DynaPDF.GetXFAStreamCount](DynaPDFGetXFAStreamCount.md)
- [DynaPDF.New](DynaPDFNew.md)

### Release notes

- **Version 9.5**
    - Added [DynaPDF.CreateXFAStream](http://www.mbsplugins.eu/DynaPDFCreateXFAStream.shtml) and [DynaPDF.SetXFAStream](http://www.mbsplugins.eu/DynaPDFSetXFAStream.shtml) functions.

### Blog Entries

- [MBS FileMaker Plugin, version 9.5pr4](https://www.mbsplugins.de/archive/2019-10-21/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 20th October 2019 , last changed 8th February 2021

  
[DynaPDF.SetWordSpacing](DynaPDFSetWordSpacing.md) - [DynaPDF.ShowDifferences](DynaPDFShowDifferences.md)

[HTML Version](DynaPDFSetXFAStream.shtml)