Access violation with a service version 2.1

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
jacaley
Posts: 4
Joined: Mon Jun 02 2003

Access violation with a service version 2.1

Post by jacaley »

I'm attempting to create pdfs within a service. This worked fine under version 1.59. When we moved to version 2.1 I'm getting an Access violation when the BeginDoc is called. When the service is created I create a PDF printer using PDFDriverInit. In separate threads when a report is requested I attach to the PDF printer using DriverInit. I'm calling EnablePrinter and SetLicenseKeyA immediately before calling BeginDoc.

Sample of code: (Delphi 5.01)

Code: Select all

PDFHandle := DriverInit(PChar(cPDF_PRINTER));

if PDFHandle <> 0 then begin
   SetPrinter(PChar(cPDF_PRINTER), '', '', 0);
   SetDefaultFileName(PDFHandle, PChar(FileName));
   SetFileNameOptions(PDFHandle, NoPromt + UseFileName);
   EnablePrinter(PDFHandle, 'xxxx', 'xxxxxx');
   SetLicenseKeyA('xxxx', 'xxxxxx');
   Printer.Title := 'xxxx';
   Printer.BeginDoc;
   ....
   ....
   Printer.EndDoc;
end;
Do you have any idea of why this would work under version 1.59 but not under 2.1? The code is the same except for the calls to EnablePrinter and SetLicenseKeyA.

Thanks in advance for your help.

John
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello John,

You need to call EnablePrinter right after PDFDriverInit and right before each Printout or in the EnablePre event.
The call to SetLicenseKey is not needed in this case, please remove it.

Hope this helps.
Post Reply