PDFCreator in code-behind class library project (C#)

The PDF Creator .NET Library enables you to create secure PDF documents on the fly and to view, print and process existing PDF documents. If you have any questions about PDF Creator .Net, please post them here.
Post Reply
haldirII
Posts: 1
Joined: Wed Mar 05 2008

PDFCreator in code-behind class library project (C#)

Post by haldirII »

Hi,

I'm using PDFCreator in a c# class library project (which outputs a single dll-file) which again is a part of a bigger solution that also contains a web application. The web application uses the class library to access functions like the PDFCreator.

I've followed the .Net guide on how to use PDFCreator and I've imported both 'acPDFCreator.Net' and 'acPDFCreatorLib.Net' and I've placed 'using Amyuni.PDFCreator' in my code to use PDFCreator.

First, I get an error saying PDFCreator requires the System.Windows.Forms dll in my project. Why is this needed? I'm using the creator in code-behind, not in the aspx-page. If this was a GUI c# project I'd understand, but it's a web application code-behind that uses PDFCreator.

Secondly, perhaps because of this usage of the forms-components, the instantiation of the PDFCreator often throws "Error creating windows handle"-exception, even though I'm disposing the pdfcreator-object.

Am I using the correct PDFCreator component for usage in code-behind?

Any suggestions would be sweet.
Devteam
Posts: 119
Joined: Fri Oct 14 2005
Location: Montreal
Contact:

Re: PDFCreator in code-behind class library project (C#)

Post by Devteam »

In this situation, 'acPDFCreator.Net' should not be imported. This DLL contains the UI components which cannot be used in your code-behind application. You need to import 'acPDFCreatorLib.Net' only and use the classes and methods provided by this library.
Amyuni Development Team

Efficient and accurate conversion to PDF, XPS, PDF/A and more. Free trials at - https://www.amyuni.com
Post Reply