Stream was not writable - Invalid PDF

I am using the demo version of PDF.Kit for .NET. I am having a problem ("Stream was not writable") when hitting ReplaceText the second time through this loop:

Dim db As New DBServices(s/c@d, True)

Dim ds As DataSet

Dim ed As New PdfContentEditor

Dim str As New MemoryStream

ed.BindPdf("c:\temp\w.pdf")

ds = db.GetDataSet("SELECT * FROM DOC_CUST_ADDR_VW WHERE KEYOID = 6244")

If Not IsNothing(ds) Then

For x As Int32 = 0 To ds.Tables(0).Columns.Count - 1

If ds.Tables(0).Columns(x).ColumnName.ToLower <> "keyoid" Then

ed.ReplaceText("<<" & ds.Tables(0).Columns(x).ColumnName & ">>", ds.Tables(0).Rows(0).Item(x))

End If

Next

End If

ed.Save("c:\temp\testnew.pdf")

Then I noticed that if I just called .BindPDF and then .Save immediately after I got some invalid PDF error due to something in the head section.

Can you take a look at the attached document and tell me if something is wrong with it? It was created from an RTF file using Adobe's FileMaker AddIn for Word. Also, is there any limitations to calling ReplaceText more than once on a file?

Thanks,

Chris Garland

Dear cgarland,

Thank you for considering Aspose.

We have tested the code with attachment pdf file and found the problem is that we does't support to call multiple ReplaceText() methods between BindPdf and Save() now. It could only be called once. We are now trying to support calling ReplaceText() multiple, We hope it could be available in a week.

Thanks for your efforts! Can you send me an email when you have the new version?

Chris Garland

chris.garland@vfsco.com

Fine. You will receive a notification when new version is ready.

Has there been any progress made on this?

Thanks for considering Aspose.

We will provide support for this requirement in next release soon.

Sorry for the delay.

The latest version of Aspose.Pdf.Kit 2.1.0 has been released and your requirements have been implemented. Please refer to File Format APIs for .NET Core, Java, Python, C++, Android | products.aspose.com

Best regards.