Q: Our development server uses Windows 2008 32 bit and our production server uses Windows 2008 64 bit. Our solution has been working fine on our development server using latest PDFNet (5.8) and using it’s 32bit version. But when I setup my machine on LIVE, it starts throwing exceptions:
This is the code:
PDFNet.Initialize(“our key”);
if (pdftron.PDF.Convert.Printer.IsInstalled(“PDFTron Creator”))
{
pdftron.PDF.Convert.Printer.SetPrinterName(“PDFTron Creator”);
}
else if (!pdftron.PDF.Convert.Printer.IsInstalled())
{
pdftron.PDF.Convert.Printer.Install();
}
The line pdftron.PDF.Convert.Printer.Install(); throws the SEHException error. The message is External component threw an exception. We already have “Enable 32bit applications” set to True on production server as stated in one of the thread: https://groups.google.com/forum/#!msg/pdfnet-sdk/CUB00hs7wkc/sseTVZOk7DQJ But this solution doesn’t seem to work. Even our application pool is running under elevated privileges so that is not an issue.
I had to manually copy the 64 bit version to the bin directory of my “Asp.Net Website project” to make it work. We are using .Net 4.0. This is very cumbersome and error prone because with each publish we have to remember to copy the PDFNet DLL and there are no build events because we are using website project and not webapplication project in Visual Studio 2010.
Please suggest why is this happening and why wouldn’t just “Enable 32 bit application” work?
A:
You are encountering an error because when you deploy your 32-bit application (which uses 32-bit PDFNet) on a 64-bit machine, your code attempts to install the 32-bit printer drivers. 32-bit PDFNet ships with the 32-bit printer drivers only. Likewise, 64-bit PDFNet ships only with the 64-bit printer drivers. The 32-bit This is the reason why toggling the “Enable 32-bit Application” option in IIS will not work.
To help you solve your problem, you have a couple of options:
- You can use the generic printer driver installer found here: https://www.pdftron.com/downloads/pdfnetDrivers.zip After installing the printer driver, you can comment out the following lines:
if (pdftron.PDF.Convert.Printer.IsInstalled(“PDFTron Creator”))
{
pdftron.PDF.Convert.Printer.SetPrinterName(“PDFTron Creator”);
}
else if (!pdftron.PDF.Convert.Printer.IsInstalled())
{
pdftron.PDF.Convert.Printer.Install();
}
- Migrate your development environment to 64-bit. This way when you prepare your development package for deployment, it is guaranteed to contain 64-bit PDFNet (including the 64-bit printer drivers) and you will not need to manually replace it.