Free Support Forum - aspose.com

PDFNEWNET-30669- any another appoach?

Hi, All

Due to that the code block [Note 1] that creates a too large pdf (input 2 MB; output 80 MB), you have created a track id as : PDFNEWNET-30669. Do you have any other approach to replace a text with regex of "[0-9.]*[A-Z.]*[a-z.]*[ ]*Page [0-9]+ of [0-9]+"? Because we can not wait too long. I tried another approach [Note 2], it won't work and you created another track id as PDFNEWNET-30674.

The problem is that if output pdf is too large, the code [Note 1] can not be executed repeatedly. System got "OutOfMemory" error. And strange thing is that system needs to "wait" for a while (10 - 20 minutes) to let [Note 1] run successfully again. As analysis goes, a small pdf created by Aspose works fine so far for LBB, but a large one.

My system is Intel(R) Core(TM)2 Duo CPU E8400 3.00GHz RAM 4GB Visual Studio 2008 Framwork 3.5.

Do you have another code that replace a text in pdf without creating a too large pdf?

Thanks.

Samuel Xia

[Note 1]

Dim contentEditor As New Aspose.Pdf.Facades.PdfContentEditor()
contentEditor.BindPdf(outPutFile)
contentEditor.ReplaceTextStrategy.IsRegularExpressionUsed = True
contentEditor.ReplaceTextStrategy.ReplaceScope = Aspose.Pdf.Facades.ReplaceTextStrategy.Scope.REPLACE_ALL
contentEditor.ReplaceText("[0-9.]*[A-Z.]*[a-z.]*[ ]*Page [0-9]+ of [0-9]+", String.Empty)
contentEditor.Save(outPutFile)

[Note 2]

Dim pdfDocument As New Document(outPutFile)
Dim textFragmentAbsorber As New TextFragmentAbsorber("[0-9.]*[A-Z.]*[a-z.]*[ ]*Page [0-9]+ of [0-9]+")
Dim textSearchOptions As New TextSearchOptions(True)
textFragmentAbsorber.TextSearchOptions = textSearchOptions
pdfDocument.Pages.Accept(textFragmentAbsorber)
Dim textFragmentCollection As TextFragmentCollection = textFragmentAbsorber.TextFragments
For Each textFragment As TextFragment In textFragmentCollection
textFragment.Text = String.Empty
Next textFragment
pdfDocument.Save("output.pdf")

Hi Samuel,

Our development team is working hard to get these issues fixed but I am afraid these issues are not yet completely resolved. However I have requested the development team to share the ETA regarding their resolution. Please be patient and spare us little time.

PS, We already have tested both approaches i.e. New Dom API and
Aspose.Pdf.Facades approach and I am afraid both approaches are causing
issues
.