'Pdf' is not defined?


#1

ERROR:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30002: Type ‘Pdf’ is not defined.

Source Error:
Line 1: <%
Line 2: Dim pdf1 As Pdf = New Pdf()
Line 3:
Line 4: pdf1.PageSetup.PageHeight = PageSize.A2Height

Source File: C:\drive-h!gor\webmall3\tests\pdf.aspx Line: 2


CODE:
Dim pdf1 As Pdf = New Pdf()

pdf1.PageSetup.PageHeight = PageSize.A2Height

Dim sec1 As Section = pdf1.Sections.Add()

Dim text1 As Text = New Text(sec1, “this is text content”)
text1.Margin.Top = 30
sec1.Paragraphs.Add(text1)

pdf1.Save(“C:\drive-h!gor\webmall3\Tests\blah.pdf”)


#2

Dear stiki,

Thank you for considering Aspose.

Please make sure you have add the Aspose.Pdf.dll into your references and used namespace Aspose.Pdf (Imports Aspose.Pdf).



#3

Don’t laugh, but can you explain the details about adding ‘the Aspose.Pdf.dll into your references’ as it relates to the .NET framework? I’ve added the Imports Aspose.Pdf at the top of my code, but I’m not sure how to enable .NET to “see” the dll.


#4

I got it - added it to the Visual Studio .NET 2003 solution - Project / Add Reference menu


#5

I’m still not sure how to add a reference to the dll file…

I’m using classic asp, is it even possible to user aspose PDF with classic asp?


#6

Imports Aspose.pdf

I’ve added that to the first line of my .aspx file


But I still get the error message:
Type ‘Pdf’ is not defined.

Line that is causing the error:
Dim pdf1 As Pdf = New Pdf()


#7

I have finaly figured out how to register the component… but

I am getting an error message:
aspose.pdf.dll was loaded, but the DllRegisterServer entry point was not found. The file can not be registered.


Where should I place the dll files? In system32 folder, or just leave them in the aspose directory in program files?

I would really apreciate if you can help me get it working…


#8

Dear stiki,

Thank you for considering Aspose.

You said you use classic ASP. Do you mean you use ASP in COM application but not ASP.NET? If so, you should register the component for COM manually:

regasm (AsposePdfPath)\Bin\Aspose.Pdf.dll /codebase


#9

Thank you for your reply… but I was unable to make it work…

Here is the error that I got:

Windows cannot find ‘regasm’. Make sure you typed the name correctly… blah blah blah…

If its any help I am workin on WinXp…


#10

Dear stiki,

Thank you for considering Aspose.

In WinXP, the regasm.exe should be in “C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705”. Please change the disk and version number according to your system and add this path to your system’s “PATH” environment variable.


#11

Thank you for taking your time to help me… this seems to be taking alot longer then it should…

I’ve managed to register the dll using regasm.exe… but its still not working and i’m getting the exact same error message:

Type 'PDF" is not defined…



This is how i ran the command to register the dll:
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322>regasm C:\Progra~1\Aspose\Aspose.Pd
f\bin\aspose.pdf.dll /codebase
Microsoft ® .NET Framework Assembly Registration Utility 1.1.4322.573
Copyright © Microsoft Corporation 1998-2002. All rights reserved.

Types registered successfully


#12

Dear stiki,

Thank you for considering Aspose.

If you are using classic ASP, you should not write code like Aspose.Pdf examples. The examples in Aspose.Pdf work in ASP.NET. Here is an example for using Aspose.Pdf in ASP:

<%

SUB GeneratePdf

Set pdf1 = server.CreateObject(“Aspose.Pdf.Pdf”)

set sec1 = server.CreateObject(“Aspose.Pdf.Section”)

pdf1.Sections.Add(sec1)

set t1 = server.CreateObject(“Aspose.Pdf.Text”)

set s1 = server.CreateObject(“Aspose.Pdf.Segment”)

s1.Content = “hello”

t1.Segments.Add(s1)

sec1.Paragraphs.Add(t1)


pdf1.Save(“test.Pdf”)


%>