Errors: Accessing Aspose.PDF for .Net via COM Interop

Hi,

When I try to register the Aspose.Pdf for .Net library using the regasm tool, I get the following warning (in red below).

After this when I try to compile my code, which imports this library, I get the errors shown in blue below.

All these errors refer to the block of code, shown in green below, starting on line 7447 of the "aspose.pdf.tlh" generated by the first regasm.

Can you please tell me what is causing these warnings and errors to occur, and how I can resolve these?

Thanks,

Saif Faruqui

--------------------------------------------------------------------------------------------------------------------

C:>regasm "C:\Program Files (x86)\Aspose\Aspose.Pdf for .NET\Bin\net4.0\Aspose.Pdf.dll" /tlb: "C:\Program Files (x86)\Aspose\Aspose.Pdf for .NET\Bin\net4.0\Aspose.Pdf.tlb" /codebase
Microsoft (R) .NET Framework Assembly Registration Utility 4.0.30319.1
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.

Types registered successfully
Type library exporter warning processing 'Aspose.Pdf.Watermark.☺, Aspose.Pdf'. W
arning: The public struct contains one or more non-public fields that will be ex
ported.
Assembly exported to 'C:\Program Files (x86)\Aspose\Aspose.Pdf for .NET\Bin\net4
.0\Aspose.Pdf.tlb', and the type library was registered successfully

C:>

--------------------------------------------------------------------------------------------------------------------

Error 1 error C2018: unknown character '0x1' c:\users\sfaruqui\documents\visual studio 2010\projects\testasposedotnetwin32console\testasposedotnetwin32console\debug\aspose.pdf.tlh 7452
Error 2 error C2059: syntax error : ';' c:\users\sfaruqui\documents\visual studio 2010\projects\testasposedotnetwin32console\testasposedotnetwin32console\debug\aspose.pdf.tlh 7452
Error 3 error C2238: unexpected token(s) preceding ';' c:\users\sfaruqui\documents\visual studio 2010\projects\testasposedotnetwin32console\testasposedotnetwin32console\debug\aspose.pdf.tlh 7452
Error 4 error C2018: unknown character '0x1' c:\users\sfaruqui\documents\visual studio 2010\projects\testasposedotnetwin32console\testasposedotnetwin32console\debug\aspose.pdf.tlh 7453
5 IntelliSense: unrecognized token c:\users\sfaruqui\documents\visual studio 2010\projects\testasposedotnetwin32console\testasposedotnetwin32console\debug\aspose.pdf.tlh 7452
6 IntelliSense: unrecognized token c:\users\sfaruqui\documents\visual studio 2010\projects\testasposedotnetwin32console\testasposedotnetwin32console\debug\aspose.pdf.tlh 7453
v

-------------------------------------------------------------------------------------

#pragma

pack(push, 4)

struct

__declspec(uuid(“fc4e4413-45d7-3834-808a-ac83875cfc5a”))


Watermark


{


struct _Image * ;


struct _Aspose_Pdf_Rectangle * _2;


};

#pragma

pack(pop)

#pragma

pack(push, 4)

struct

__declspec(uuid(“fc4e4413-45d7-3834-808a-ac83875cfc5a”))


Watermark


{


struct _Image * ;


struct _Aspose_Pdf_Rectangle * _2;


};

#pragma

pack(pop)

I pasted the code (in green), twice, by mistake.

sfar:
When I try to register the Aspose.Pdf for .Net library using the regasm tool, I get the following warning (in red below).
Hi Saif,

Thanks for contacting support. I have been able to reproduce the above specified issue and for the sake of correction, I have logged this problem as PDFNEWNET-34375 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction.

sfar:
After this when I try to compile my code, which imports this library, I get the errors shown in blue below.

All these errors refer to the block of code, shown in green below, starting on line 7447 of the "aspose.pdf.tlh" generated by the first regasm.

Can you please tell me what is causing these warnings and errors to occur, and how I can resolve these?

Can you please share some sample application which can help us in replicating this issue. We are sorry for this inconvenience.

Hi Nayyer,

I was not able to write any code using this library because of the error. When I import the Aspose.Pdf.tlb, it doesn't even compile correctly right now.

Actually, my follow up question is about that...in C++, using the Aspose.Pdf for .Net library's COM Interop, how can I load an existing PDF file. For e.g., I used the following code to lead a doc file using the COM Interop in Aspose.Words for .Net:

Aspose_Words::_ComHelperPtr ptr;

Aspose_Words::_DocumentPtr docPtr;// Initialize all COM Components

CoInitialize(NULL);

ptr.CreateInstance(

"Aspose.Words.ComHelper");

// Initialize all COM Components

CoInitialize(NULL);

ptr.CreateInstance(

"Aspose.Words.ComHelper");//conversion from DOCX to other formats

// read the docx file to convert

docPtr = ptr->Open(_bstr_t(

"C:\\Projects\\license.docx"));

Hi Saif,


Sorry for replying you late.

Please find attached the sample VC++ project (it will give you an idea on how you can use Aspose.Pdf for .NET via COM Interop) in which I have used Aspose.Pdf.Generator namespace to create a HelloWorld PDF document. Please note that Aspose.Pdf for .NET should be installed over system before executing/compiling this project.

In case you encounter any issue, please feel free to contact.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan