Resolving 'BadImageFormatException' when using PDFNet on 64-bit web server.

263 views
Skip to first unread message

Support

unread,
Apr 9, 2012, 4:03:25 PM4/9/12
to PDFTron WebViewer
Q: I am currently testing out your new PDFNet WebViewer Sample project
from PDFNet SDK. I'm running into some issues with the following
project: WebViewerStreamingCS_2008.

1. I've setup visual studio to use CassiniDev as suggested.
o When running the project in VS 2008 using CassiniDev I get an error
(see attached CassiniDev_Error.png)
2. I’ve tried using IIS and have setup virtual directory, and
converted the virtual directory to an application
o With this setup I get an asp.net stack trace (see attached
IIS_Application_Error.jpg)

Looks like I need some additional help setting up this project.

Any help would be appreciated,

-----------------
A: The problem is that PDFNet DLL and the web server process are
incompatible (32 vs 64 bit).

According to:
https://groups.google.com/group/pdfnet-sdk/t/3a9e66fb6547db0c/7858192b1f10493a

you could use 32 bit version of PDFNet with IIS as follows…

... in your IIS 2008 R2 Web Server application pool, set the Identity
to "LocalSystem" (for both .NET 2.0 and .NET 4.0). Also, make sure to
set the "Enable 32-Bit Applications" to "True".

Support

unread,
Apr 10, 2012, 1:38:13 PM4/10/12
to pdfnet-w...@googlegroups.com
Q:
I've made the changes and PDFNet now works on the web server, however 
I am now getting the following js error/alert message: 
 
"Wrong signature in local header: 1836345404"
-----------------
A:
You are getting the error in JavaScript because the URL for the document request is not correct. The WebViewerStreaming sample is written so that it can run from Visual Studio without any modifications whatsoever. In your case however, because you are running the sample at "http://localhost/PdfWebViewer/", the correct URL for the document conversion request will be: "http://localhost/PdfWebViewer/ConvertAndStream.aspx". As mentioned, our samples are designed to ran out of the box, thus (without modifications), the sample sends requests to "http://localhost/ConvertAndStream.aspx".

What you can do in this case is to open the Index.aspx file, and modify the URL for the document conversion request (the initialDoc parameter) accordingly - in your case, you may want to change it to "/PdfWebViewer/ConvertAndStream.aspx".
Reply all
Reply to author
Forward
0 new messages