Convert Dynamic XFA to Standard Acroform using Aspose.PDF - Memory stream is not expandable error message

Hi ,

I am gettign the following error while doing multiple hits for validation

<Message>Memory stream is not expandable.</Message>
<CallStack>at System.IO.MemoryStream.set_Capacity(Int32 value) at System.IO.MemoryStream.EnsureCapacity(Int32 value) at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count) at “a.›a.Write(Byte ) at .ƒ.Save(•a , ‹a ) at ‚a.ŸŒ.Save(Stream ) at Aspose.Pdf.Document.Save(Stream output) at Mercer.DocProd.WebParts.RecipientDeliveryDetails.OnNextClick(Object sender, EventArgs e)</CallStack>


Please suggest

I have used the following code
foreach (Aspose.Pdf.Page page in pdfDocument.Pages)
{
if (page.Resources.Fonts != null)
{
foreach (Aspose.Pdf.Text.Font pageFont in page.Resources.Fonts)
{
//Check if font is already embedded
if (!pageFont.IsEmbedded)
{
pdfEmbeddedFonts = pdfEmbeddedFonts + 1;
pageFont.IsEmbedded = true;
}
}
}
//Check for the Form objects
foreach (XForm form in page.Resources.Forms)
{
if (form.Resources.Fonts != null)
{
foreach (Aspose.Pdf.Text.Font formFont in form.Resources.Fonts)
{
//Check if the font is embedded
if (!formFont.IsEmbedded)
{
pdfEmbeddedFonts = pdfEmbeddedFonts + 1;
formFont.IsEmbedded = true;
}
}
}
}
}
if (pdfEmbeddedFonts > 0)
{
pdfDocument.Save(((inputStream)));
}

// Convert the document to byte form.
byte[] docBytes = inputStream.ToArray();
docProdRequest.ThinDocRequest.ManDocumentContent = docBytes;

Hi Yogesh,

Thanks for contacting support.

It appears that you are trying to convert XFA form to Standard Acroform and facing an issue. Can you please share your input file, so that we can test the scenario in our environment. We are sorry for this inconvenience.