Automate office document imaging 2003

  • Thread starter Thread starter Jean-Marc Boedt
  • Start date Start date
J

Jean-Marc Boedt

hi,

I automate office document imaging in a vb.net application
in order to obtain the ocr's result on a given tiff file.
Everything is ok except that after my subroutine I got a
lock on my tiff file and I can't move or delete the file.

thanks for your help
this is the code I use :

Private Sub scannerFichierTIF(ByVal fichierTiff As String)
Dim doc As MODI.Document
Dim img As MODI.Image
Dim buffer As StreamWriter

'Création du fichier qui recevra le texte
résultant de l'OCR
buffer = File.CreateText("resultatocr.txt")

doc = CType(CreateObject("MODI.Document"),
MODI.Document)
doc.Create(fichierTiff)
doc.OCR(MODI.MiLANGUAGES.miLANG_FRENCH, True, True)
For i As Integer = 0 To doc.Images.Count - 1
img = CType(doc.Images.Item(i), MODI.Image)
Buffer.WriteLine(img.Layout.Text())
Next

'Fermeture des différents fichiers
buffer.Flush()
buffer.Close()
doc.Save()
doc.Close()
doc = Nothing
End Sub
 
Back
Top