StartDoc & EndDoc change ExtEscape return results

Home Forums PDF24 Creator General StartDoc & EndDoc change ExtEscape return results

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #921
    bruceh
    Participant

    As a follow up to this post, I have found that if I uncheck the "Enable advanced printing features" in the PDF24 print driver advanced properties, this issue does not occur. It would be greatly appreciated if this could be explained by PDF24 developers.

    We are trying to use PDF24 as the output of a customized program to create a PDF. Inside our program we use the Microsoft printer escape API ExtEscape extensively to control the print job. I have found that the return value for setting the PSIDENT_PSCENTRIC parameter for the PDF24 driver is affected by the Microsoft API call to StartDoc.

    In order to show the problem easier, a simple example is shown below. If you comment out the StartDoc line, then the setting of the PSIDENT_PSCENTRIC returns a successful ret_val of one. Otherwise, it returns zero meaning it fails.

    Is there a way I can avoid this? We need to use the StartDoc/EndDoc functions to control the print job. We do not see this problem when we use Adobe's PDF writer.

    PRINTDLGW printDialog;

    // Initialize the PRINTDLG structure.
    memset(&printDialog, 0, sizeof(printDialog));
    printDialog.lStructSize = sizeof(printDialog);

    // request a Device Context be returned
    printDialog.Flags = PD_RETURNDC;

    // Invoke the printer dialog box.
    PrintDlgW(&printDialog);

    DOCINFO dInfo;
    memset(&dInfo, 0, sizeof(dInfo));
    dInfo.cbSize = sizeof(dInfo);
    dInfo.lpszDocName = L"MyPrintJob";
    dInfo.fwType = 0;
    dInfo.lpszOutput = NULL;
    dInfo.lpszDatatype = NULL;

    // save the returned DC
    HDC hDCprint = printDialog.hDC;

    // start the job
    // comment this out to see the issue
    ::StartDoc(hDCprint, &dInfo);

    long ret_val;
    int queryEscape;
    int Escape;

    // query request to see if possible to use this parameter
    // returns success (1) in both cases of whether StartDoc is present or not
    queryEscape = POSTSCRIPT_IDENTIFY;
    ret_val = ExtEscape(hDCprint, QUERYESCSUPPORT, sizeof(queryEscape),
    (LPCSTR)&queryEscape, 0, NULL);

    // try to change the driver to PS centric mode
    // this is the issue
    // ret_val is zero if StartDoc code is present
    Escape = PSIDENT_PSCENTRIC;
    ret_val = ExtEscape(hDCprint, POSTSCRIPT_IDENTIFY, sizeof(Escape),
    (LPCSTR)&Escape, 0, NULL);

    ::EndDoc(hDCprint);

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.