We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Using Aspose.Pdf.dll as COM

Hello, I’m going to use this component within asp code as COM. Does anybody use that?
Code samples(Specially with using images)?


Please refer to Use Aspose.Pdf in COM Applications.

You can follow the same way to use Image.

If you have any further questions when dealing with image, please let me know.

Sorry, but I can’t use this as the code gives an error.
I have trial version so I haven’t “Aspose.Pdf.lic” as mentioned within code.
Anyhow it’s not important as the first error appear above

"Set lic = CreateObject(“Aspose.Pdf.License”)
lic.SetLicense (“D:\CSharp\customer\Aspose.Pdf.lic”)"

The first exception I have at “Set Pdf1 = CreateObject(“Aspose.Pdf.Pdf”)”

Are you sure that you are able to use that code?
btw, I have all Framework.net installed on my computer,
Can it be the reason for my problem?


The SetLicense method just shows the way how to license Aspose.Pdf. You can comment those lines for trial version.

I do not know what is the first error you mentioned. Please give more info about it.

btw, the version of .Net dll is Assembly Aspose.Pdf, Version

the error text “Microsoft VBScript runtime error: ActiveX component can’t create object: ‘Aspose.Pdf.Pdf’”

'Create a Pdf document

Dim Pdf1
Set Pdf1 = CreateObject(“Aspose.Pdf.Pdf”)

btw, I have checked “Aspose.Pdf.Pdf” in registry
and there is no such wording.

Please regist the dll with “regasm \Aspose.Pdf.dll /codebase” and try again.

Thanks, I reg the assembly as COM manually and it helps to use it via COM.
So I have started using it in my ASP application. But there is another error I faced while using the demos you provide msi install package with. It’s hard to understand the reason as it happen random.
Did you face such error before?

Server Error in ‘/Aspose.Pdf.Demos.VisualBasic’ Application.

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Access is denied: ‘Aspose.Pdf’.

Source Error:

Line 196:
Line 197:
Line 198:
Line 199:
Line 200:

Is it possible to save pdf file via “Response.BinaryWrite” within ASP environment.
I rememeber having a chance to see that in sample of code for ASP with using Aspose.Excel.dll.

The demo code can’t run directly in ASP. I am not very familiar with ASP. You can search other examples about how to use .Net component in ASP on the net. You can also refer to the document of Aspose.Words (https://docs.aspose.com/words/net/) and Aspose.Cells (https://docs.aspose.com/cells/net/).

Does anybody know how can I set top margin for my Pdf document?
I mean that I need the top margin through all pages.

Please refer to Set Page Size and Margins.

Btw, I can set “left, right, bottom” margin via section.PageInfo.Margin.
Somehow, I can’t set top margin.
I mean that I have set top margin but it’s ignored by pdf document.
Did I do something wrong? or I have to handle it another way?
Please, advise.

Thank you for link, but I still can’t figure out why top margin is ignored in pdf output.

Dim objSection : set objSection = server.CreateObject(“Aspose.Pdf.Section”)
objSection.PageInfo.Margin.Top = 70
objSection.PageInfo.Margin.Left = 10
objSection.PageInfo.Margin.Right = 10
objSection.PageInfo.Margin.Bottom = 70

This is the code I have.

Hi, I have another problem.
How can I use Color class within ASP environment?
In both cases below I have black background color intead of disired color.
I know that there are many samples in Docs added in install package but none of them is fit to use within ASP.
My question is, do anyone try to use color class within asp?

The .NET code.
Dim footerPart As Table = New Table
Dim bcColorFooterPart As Color = New Color
bcColorFooterPart.CmykColorSpace = New CmykColorSpace
bcColorFooterPart.CmykColorSpace.C = 86
bcColorFooterPart.CmykColorSpace.M = 62
bcColorFooterPart.CmykColorSpace.Y = 21
bcColorFooterPart.CmykColorSpace.K = 4
footerPart.BackgroundColor = bcColorFooterPart
footerPart.ColumnWidths = "100%"
The ASP code

Dim objHeaderTable : set objHeaderTable = server.CreateObject(“Aspose.Pdf.Table”)
Dim objColor : set objColor = server.CreateObject(“Aspose.Pdf.Color”)
Dim objCmykColorSpace : set objCmykColorSpace = server.CreateObject(“Aspose.Pdf.CmykColorSpace”)

objCmykColorSpace.C = 5
objCmykColorSpace.M = 0
objCmykColorSpace.K = 0
objCmykColorSpace.Y = 0

objColor.CmykColorSpace = objCmykColorSpace
objHeaderTable.BackGroundColor = objColor
objHeaderTable.ColumnWidths = “10% 90%”

Does anybody here know how to init color class within ASP?

1. The ColorSpaceType should also be set.

2. I found the background color for table does not work. We will fix this bug soon. You can set background color for cell instead.

There is another issue to Abobe Acrobat Professional 7.0.
It’s a bit strange to me.

When you generate pdf via ASP and save it via CreateObject(“System.IO.MemoryStream”) then Response.BinaryWrite(bytes) to the browser. The pdf file can’t be open via Abobe 7 but it can be opened by another pdf reader. Having installed it recently, I notice that.
Note: it’s only for ASP environment.
Is it bug or it’s something new because of new feature of Abobe 7.
Please advice.

Firstly, please check Web Browser Options of your Abobe Acrobat Professional 7.0 preferences.

Edit->Preferences->Internet->Web Browser Options, make sure if <Display PDF in browser> is checked.

If it does, then try one of our online demoes to find if this issue still sticks.

Demos URL: https://github.com/aspose-pdf/Aspose.PDF-for-.NET.

Another question.
I have a images to be inserted into pdf file. All images have diff height and width.
The question is, can use Aspose.Pdf API to scale them all to page?
I mean that I need to do scaling to image that it is fit to page.
I think that I would be able to do this in ASP.NET because of ASP.NET API.
But I have to do this in ASP .
Is it possible?