Hello,
I am evaluating PDFTron and from my first test, it seems to be a powerful library.
I looked on Goolge, website, SDK documentation... but I didn't find anything regarding my problem...
The aim of my test is to identify and object from a property, modify its streamdata and save the file.
The first part is OK, I am able to :
- identify my object,
- get the decoded stream data
- replace a part of the string
But I am not able to set the new stream data. I always get an error message :
"Output stream is corrupt Conditional expression: false Filename : FilterWriter.cpp Function : trn::Filters::FilterWriter::WriteBuffer Linenumber : 59"
This is my code :
If System.Text.ASCIIEncoding.ASCII.GetString(o.GetBuffer()) = "[jobname 0]" Then
o = doc.GetObj(i)
Dim f As Filter = o.GetDecodedStream()
Dim fr As New pdftron.Filters.FilterReader(f)
Dim buff(f.Size) As Byte
Dim nb As Integer = fr.Read(buff)
Dim str As String = System.Text.ASCIIEncoding.ASCII.GetString(buff)
str = str.Replace(txt_ancienne_valeur.Text, txt_nouvelle_valeur.Text)
o.SetStreamData(System.Text.Encoding.ASCII.GetBytes(str), f)
End If
Do you have any idea ?
Thanks in advance,
Frederic