Persits Software, Inc. Knowledge Base Articles

Rotate value must be a multiple of 90 / Unable to cast COM object error

Problem Description

When using AspPDF under .NET via an interop assembly, the following error is generated, although the Page.Rotate property is not being used:

Exception Details: System.Runtime.InteropServices.COMException: Rotate value must be a multiple of 90.

In other cases, the error message may be as follows:

Exception Details: System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'ASPPDFLib.IPdfCanvas'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{03363077-DF13-4224-A67F-67B0387B0E36}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).


These errors usually means there is a version mismatch between the component itself (asppdf.dll or asppdf64.dll) and the .NET interop assembly (ASPPDFLib.dll). For example, the server has version 2.8 of AspPDF installed, but the application uses the interop assembly shipped with version 2.9.

The problem can be fixed as follows:

Method 1 (recommended): Download the latest version of AspPDF from and install it on your server. The component and interop assembly DLLs included in the installer are guaranteed to match each other.

The interop assembly ASPPDFLib.dll can be found in the \Samples\Bin subdirectory of the AspPDF installation. It needs to be copied to the /Bin directory of your .NET application.

Method 2: If reinstallation of AspPDF is not possible, you should create a new interop assembly from the currently installed version of asppdf.dll or asppdf64.dll using the command-line utility TLBIMP, and then use that assembly in your .NET application by placing it in the /Bin subdirectory:

c:\>TLBIMP c:\path\asppdf.dll