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 : Friday, March 3, 2006 11:10:45 AM(UTC)

travich  
travich

Groups: Registered
Posts: 14


Okay, so I'm simply trying to load PDF images into the viewer.  The PDF engine is installed:

_codecs.Options.Pdf.IsEngineInstalled == true

I have a dual-threaded application that uses RasterCodecs twice.  Once to load the PDF image into a hashtable, and another to laod the PDF image in case it has not yet been loaded into the hashtable.  It appears that the RasterCodecs path is only valid in one of two threads, depending on who uses the codec first.  How can I make sure that both threads have access to the RasterCodecs object???  Can I set the property for the engine in the codecs object after I declare it???  If that's the case, then I can simply point to the engine on both objects and it should solve my issue.  Here's the error:

{"Either the files required for initializing the PDF engine were not found or they were found but they are incorrect"}

Sorry for the updates, but I wanted to make sure everyone knows what I've narrowed the issue down to be.  Finally, I'm currently looking for a synchronization call for the codecs if anyone knows where I could find this.

 

Travis

 

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 : Monday, March 6, 2006 3:07:56 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello Travis,

Are you sure that the PDF runtime DLLs are installed correctly onto your machine?

Please download and install the latest PDF Runtime DLLs by using the following URL:
Http://www.leadtools.com/releasedownloads/v14/leadtoolspdfruntime.exe
After downloading the setup, install the PDF Runtime DLLs to the Redist\PDF path on your LEADTOOLS v14.5, as follows:
- Make sure in your registry "regedit" in this path "KEY_LOCAL_MACHINE\SOFTWARE\LEAD Technologies, Inc.\Pdf" the GS_LIB indicates and point to the PDF folder, for example in my machine it points to:
"J:\Program Files\LEAD Technologies, Inc\LEADTOOLS14\Redist\PDF\Lib;J:\Program Files\LEAD Technologies, Inc\LEADTOOLS14\Redist\PDF\Fonts;J:\Program Files\LEAD Technologies, Inc\LEADTOOLS14\Redist\PDF\RESOURCE"
(Please change the above path to match the LEADTOOLS v14.5 path on your machine)

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Monday, March 6, 2006 4:40:20 AM(UTC)

travich  
travich

Groups: Registered
Posts: 14


Thanks for the suggestion, I will try it and get back to you.  FYI, yes I do have the PDF engine downloaded, but I'll check the regisitry settings. 

Again, it works for a single thread, but fails for multi-threading.

 
#4 Posted : Monday, March 6, 2006 1:30:27 PM(UTC)

travich  
travich

Groups: Registered
Posts: 14


C:\Program Files\LEAD Technologies, Inc.\LEADTOOLS EVAL 14.5\REDIST\PDF\LIB;C:\Program Files\LEAD Technologies, Inc.\LEADTOOLS EVAL 14.5\REDIST\PDF\FONTS;C:\Program Files\LEAD Technologies, Inc.\LEADTOOLS EVAL 14.5\REDIST\PDF\RESOURCE

 

It all appears to be functioning normally.  Again, it's a problem with multiple threads, but works fine with single threads.

 
#5 Posted : Tuesday, March 7, 2006 1:07:14 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

Can you please provide us with a small sample project that shows the problem?

Thanks,
Maen Badwan
 
#6 Posted : Tuesday, March 7, 2006 5:24:53 AM(UTC)

travich  
travich

Groups: Registered
Posts: 14


Okay here the code that matters...  On the btnFolder_Click event starts everything off.  BTW, I hate the text editor on these forums.

private void btnFolder_Click(object sender, EventArgs e)
{
   
folderBrowserDialog.ShowDialog();
   Path = folderBrowserDialog.SelectedPath.ToString();
   this
.lblFileLocation.Text = Path.ToString();
   if (Path == "") { return
; }
   Files = Directory.GetFiles(Path);

   CacheImages();

   CurrentIndex = 0;
   btnBack.Enabled = false
;

   LoadImage(Files[0].ToString());

}

 

private void LoadImage(string fileName)
{

   IRasterImage Image;
   int
idx;
   int
total;
   string
LoadTime;
   bool IsHashed = false
;
   RasterCodecs c = new RasterCodecs();
 

try
{

   if (imageHash.ContainsKey(fileName))
   {
      Image = ((IRasterImage
)imageHash[fileName]);
      IsHashed = true
;
   }
   
else
   
{
      
Image = c.Load(fileName);
      //Image = codecs.Load(fileName);

      IsHashed = false;

   }

   if (Image != null)
   {
      Viewer.Image = Image;
   }

   }
   
catch (Exception
e)
   {
      MessageBox.Show(e.Message.ToString(), "Error Loading Image"
);
   }

}

}

 

private void CacheImages()
{
   
//Create new thread that will load images into
   
//a hash table for quick retreival.
   //LoadHash is the "entry point"

   entryPoint = new ThreadStart(LoadHash);
   th1 = new Thread
(entryPoint);
   th1.IsBackground = true
;
   th1.Name = "Image Caching Thread"
;
   th1.Start();
}

private void LoadHash()
{

   //Loads the images into a hashtable in the background.
   IRasterImage
img;
   RasterCodecs c = new RasterCodecs
();
   //RasterCodecs.CodecsPath = @"C:\Program Files\LEAD Technologies, Inc\LEADTOOLS EVAL 14.5\Bin\Dotnet\v20";

   foreach (string f in Files)
   {
      
img = c.Load(f.ToString());
      
imageHash.Add(f.ToString(), img);
   }

   return;
}

private void frmViewer_Load(object sender, EventArgs e)
{
   RasterCodecs.CodecsPath = @"C:\Program Files\LEAD Technologies, Inc\LEADTOOLS EVAL 14.5\Bin\Dotnet\v20"
;
}

 

 
#7 Posted : Tuesday, March 21, 2006 6:10:24 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

I investigated more about this issue.

LEADTOOLS uses a third-party engine called GhostScript to support loading PDF file format. This third party is not thread safe. You will need to make sure that only one thread at a time calls load when loading PDF.

Thanks
Maen Badwan
LEADTOOLS Technical Support
 
#8 Posted : Thursday, April 20, 2006 5:55:05 AM(UTC)
Apathetic

Groups: Registered
Posts: 1


So are you telling me that when I call .Load from the RasterCodecs class it isn't thread safe if the file I'm loading is a PDF?  (I'm running version 14.0 and using the .NET libraries).

 

 Maen Hasan wrote:Hello,

I investigated more about this issue.

LEADTOOLS uses a third-party engine called GhostScript to support loading PDF file format. This third party is not thread safe. You will need to make sure that only one thread at a time calls load when loading PDF.

Thanks
Maen Badwan
LEADTOOLS Technical Support

 
#9 Posted : Sunday, April 23, 2006 2:22:31 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,
     
Yes, you need to make sure that only one thread at a time calls load when loading PDF.
As I told in my previous email, LEADTOOLS uses a third-party engine called GhostScript to support loading PDF file format. This third party module is not thread safe.

Thanks
Maen Badwan
LEADTOOLS Technical Support
 
#10 Posted : Monday, November 20, 2006 2:11:32 PM(UTC)
AllanOne

Groups: Registered
Posts: 5


Does the LEADTOOLS PDF Plug-in (Write) have the same issue as Read?

Is LEADTOOLS PDF Plug-in (Write) thread safe, or does it also rely on GhostScript?

TIA!
 
#11 Posted : Monday, November 20, 2006 11:14:09 PM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

LEADTOOLS PDF Plug-in (write) is thread safe.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
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.166 seconds.