Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

supplying filename to PDF printer driver

edited July 2002 in General
We have complex reports done in Report Builder. Now we have the PDF printer driver
and we can select this printer driver within the printerSettings of ppReport
component. When printing comes, the printer dialog always pops up and ask for the
PDF filename to write the output to. Is there a way to supply this PDF filename
programmatically? Thanks.

Comments

  • edited July 2002

    here's more tech info:
    I have some docs, and told me to use the WIndows Printer Escape Function. Using the
    Windows API | ExtEscape, I don't know how to call these from Delphi. Is there anyone
    here who have done so?

    The printer escape passed to ExtEscape is PDFFILENAME. If successful, Escape returns
    with PDFINPUT_OK, otherwise it returns with PDFINPUT_FAIL.

    PDFINPUT pdfInput;
    PDFDocInfo pdfdocinfo;
    /* Fill PDFINPUT structure */
    memset (&pdfdocinfo,0,sizeof(PDFDocInfo);

    strcpy(pdfInput.outputfilename,"c:\MyFileName.pdf");

    strcpy(pdfdocinfo.title,"MyTitle");
    strcpy(pdfdocinfo.author,"ThatsMoi");
    strcpy(pdfdocinfo.subject,"CrazyPDF");
    strcpy(pdfdocinfo.keywords,"MyKeyWords");

    pdfInput.docinfo = pdfdocinfo;

    /* Send PDFFILENAME printer escape. it is assumed that */
    /* hDC represents a device context for PDFWriter */

    if (ExtEscape(hDC, PDFFILENAME, sizeof(pdfInput),
    (LPSTR) &pdfInput, NULL) == PDFINPUT_OK) {
    /* escape successful, now start print job */
    }
    else {
    /* handle the Escape failed */
    }

    The PDFFILENAME printer escape should be sent prior to calling the Windows API
    StartDoc function or using the STARTDOC printer escape to start a PDFWriter print
    job.

    Please somebody help me who to transalate and call the above within Delphi.

    THanks
  • edited July 2002
    The ExtEscape function is accessible via Delphi with the same parameter
    list, it is defined in the Windows unit. You can, however, try doing it
    before calling Report.Print. You can get the device handle via Report.DC.
    The rest of your code would translate almost directly. memset becomes
    FillChar, strcpy becomes StrCopy, etc.

    Also, the below demo might be helpful:

    http://www.digital-metaphors.com/tips/SavePrinterDevMode.zip

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited July 2002

    Thanks, Yo da man!

    In article <3d454896$1@dm500.>, "Alexander Kramnik \(Digital Metaphors\)"
    says...
    |The ExtEscape function is accessible via Delphi with the same parameter
    |list, it is defined in the Windows unit. You can, however, try doing it
    |before calling Report.Print. You can get the device handle via Report.DC.
    |The rest of your code would translate almost directly. memset becomes
    |FillChar, strcpy becomes StrCopy, etc.
    |
    |Also, the below demo might be helpful:
    |
    |http://www.digital-metaphors.com/tips/SavePrinterDevMode.zip
This discussion has been closed.