Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, October 11, 2007 10:16:13 AM(UTC)

jctran  
jctran

Groups: Registered
Posts: 4


I got images coming in the fax servers that are up-side down. I would like to use Leadtools 15 to write a VB app that automatically turn them rightside up if they are upside down. Please email me a sample code if you have them. Thank you very much in advance for your help.

Edited by moderator Friday, October 21, 2016 2:03:53 PM(UTC)  | Reason: Not specified

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, October 11, 2007 11:52:13 AM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Hello,


I sent you a reply to the email that you sent.  I'm just reposting it here so others can have a look at it.



The basic concept is, you load an image using the RasterCodecs class.
 You add that loaded image to the RasterDocumentEngine object.  Then
you call the AutoOrientPage() method, specifying the page you would
like to auto orient.  Next, you export the oriented page to a
RasterImage object.  Finally, you call the Save() method in the RasterCodecs to save it to the disk.



SAMPLE CODE FOLLOWS:



Imports Leadtools

Imports Leadtools.Codecs

Imports Leadtools.Document



Public Sub AutoOrientPageExample()

  ' Note that this is a sample key, which will not work in your toolkit

  ' Change it to the key that you were given.

  RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey")



  ' We have to start the codecs engine before creating a new instance

  RasterCodecs.Startup()



  ' Create instance of the class.

  Dim rasterCodecs as RasterCodecs = new RasterCodecs()



  ' Create an instance of the document engine and start the engine.

  Dim rasterDocument As RasterDocumentEngine

  rasterDocument = RasterDocumentEngine.Instance

  rasterDocument.Startup()



  ' Adding a page here.

  Dim tempImage as RasterImage = codecs.Load("C:\faxpage.tif")

  rasterDocument.AddPage(tempImage, 0)



  Try

     rasterDocument.AutoOrientPage(0)

  Catch ex As Exception

     MessageBox.Show(ex.Message)

  End Try



  ' Export the page to a RasterImage object and save.

  Dim rotatedPage as RasterImage = rasterDocument.ExportPage(0)

  codecs.Save(rotatedPage, "C:\rotatedPage.tif", RasterImageFormat.TifLzw, 0)



  ' Shutdown the engines.

  RasterCodecs.Shutdown()

  rasterDocument.Shutdown()


End Sub
 
#3 Posted : Friday, October 12, 2007 2:59:29 AM(UTC)

jctran  
jctran

Groups: Registered
Posts: 4


Thank you very much for the codes. I got an error on this line

Dim tempImage as RasterImage = codecs.Load("C:\faxpage.tif")
 it gave me a Invalid file format. I will try different tif files and continue to look into the .NET documentation and see how far I can go. I'll update you what I find out. Thanks again.

Once I added the leadtools.codecs.tif reference, it works.

 

 
#4 Posted : Friday, October 12, 2007 5:49:24 AM(UTC)

jigar  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Usually when it throws "Invalid File Format" exception, that means the file could not be read by any of the codec files referenced.  So you need to add the reference to the codec file that will be able to read it.  The tif file may have an uncommon compression format, so even though you have Leadtools.Codecs.Tif.dll, it will need a reference to the codecs file with the corresponding compression format.  Sometimes they can be JPEG.  In that case you also have to make a reference to Leadtools.Codecs.Cmp.dll.  CMP is LEADTOOLS special format, which is similar to JPG so we have both of them in a single assembly.  Let me know what happens.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.098 seconds.