Hi,
I'm trying to migrate our app to use the PDF converter 3.03 (we're currently at 2.5) and am having some problems getting it to work. I am able to successfully call DriverInit, set all of the default options, and calling EnablePrinter works fine. When I go to call StartDoc to start printing a document though, it always returns SP_ERROR. If I pick a real printer in the printer dialog, my page prints fine.
I made a sample app where I do all of my own printing and have been able to reproduce my problem. Here is the whole app, please tell me what I'm doing wrong:
HANDLE m_PrinterHandle = DriverInit("Amyuni PDF Suite");
ASSERT(m_PrinterHandle != NULL);
if (m_PrinterHandle != NULL)
{
int result;
result = SetFileNameOptions(m_PrinterHandle, NoPrompt + UseFileName);
ASSERT(result == 1);
result = SetDefaultFileName(m_PrinterHandle, "C:\\DataFiles\\test.pdf");
ASSERT(result == 1);
CPrintDialog pd(TRUE, PD_RETURNDC | PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_HIDEPRINTTOFILE | PD_NOSELECTION, this);
if (pd.DoModal() == IDOK)
{
HDC printer_dc = pd.GetPrinterDC();
ASSERT(printer_dc != NULL);
if (printer_dc != NULL)
{
long enable_result = EnablePrinter(m_PrinterHandle, "<our company name>", "<our companies license key>");
ASSERT(enable_result != 0);
DOCINFO di;
di.cbSize = sizeof(DOCINFO);
di.lpszDatatype = NULL;
di.fwType = 0;
di.lpszDocName = _T("test document");
di.lpszOutput = NULL;
int result = StartDoc(printer_dc, &di);
ASSERT(result != SP_ERROR); // Always throws assertion here.
result = StartPage(printer_dc);
ASSERT(result != SP_ERROR);
CRect text_rect(100, 100, 1200, 1200);
result = DrawText(printer_dc, _T("Test Page"), 9, &text_rect, DT_CENTER);
result = EndPage(printer_dc);
result = EndDoc(printer_dc);
DeleteDC(printer_dc);
}
}
DriverEnd(m_PrinterHandle);
}
Can't call StartDoc with Printer Driver 3.03
Re: Can't call StartDoc with Printer Driver 3.03
Hello,
I believe that your issue maybe caused by the EnablePrinter() function?
Please make sure that you are using "License to" and "Activation code" values that have version 3.0.x enabled?
Thanks
I believe that your issue maybe caused by the EnablePrinter() function?
Please make sure that you are using "License to" and "Activation code" values that have version 3.0.x enabled?
Thanks
Get PDF Suite, the expert .NET developer toolkit for PDF conversion, creation and editing - www.amyuni.com/pdfsuite
Re: Can't call StartDoc with Printer Driver 3.03
Ok. I have a valid activation code that we got when we originally purchased this for 2.5. We have purchased the 30% maintenance for each year since then, so are we supposed to get new codes for the different versions of the dll? I was able to download the latest version by logging into the developer section of the site, but I didn't see where I could get a new code. I assumed the 2.5 code would work fine.Jose wrote:Hello,
I believe that your issue maybe caused by the EnablePrinter() function?
Please make sure that you are using "License to" and "Activation code" values that have version 3.0.x enabled?
Thanks
Also when I call
long enable_result = EnablePrinter(m_PrinterHandle, "<our company name>", "<our companies license key>");
using our existing activation code, the return value is 1 which means that it succeeded, so I didn't suspect the code to be wrong for this version.
Re: Can't call StartDoc with Printer Driver 3.03
Hello,
The EnablePrinter() function basically returns true if you provided the function with the appropriate parameters (ie: handle, string, string). It does not indicate whether the "License to" and "Activation code" values are valid.
You can not enable the PDF Converter with version 2/5x licensing codes.
Please contact support@amyuni.com with your company information and they will assist you.
Thanks
The EnablePrinter() function basically returns true if you provided the function with the appropriate parameters (ie: handle, string, string). It does not indicate whether the "License to" and "Activation code" values are valid.
You can not enable the PDF Converter with version 2/5x licensing codes.
Please contact support@amyuni.com with your company information and they will assist you.
Thanks
Get PDF Suite, the expert .NET developer toolkit for PDF conversion, creation and editing - www.amyuni.com/pdfsuite