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

RB with ExtraDevices: How to open pdf after creation?

edited March 2004 in End User
Hi! I'm using RB with Extradevices to create PDF-files. What is the best way
to open pdf automatically just after it was created from printer setup?

Comments

  • edited March 2004
    Hi Kari,

    I'm not sure if the latest release of ExtraDevices has this functionality
    built in. The ReportBuilder server uses the Windows API call ShellExecute
    to automatically open newly created files. Check out the ShellExecute topic
    in the Windows SDK help for more information. You will want to create a
    method similar to the one below...

    uses
    Windows,
    SysUtils;

    function TForm1.ShellExec(const aPathStr, aCmdStr, aDirStr: string; aShow:
    Word): Boolean;
    var
    lhInst: THandle;
    lpOperation: array[0..5] of Char;
    begin

    StrPCopy(lpOperation, 'open');

    lhInst := ShellExecute(0, lpOperation, PChar(aPathStr), PChar(aCmdStr),
    PChar(aDirStr), aShow);

    { If 32 or less, an error occurred }
    Result := (lhInst > 32);

    end;

    and call it like so...

    ShellExec(FileName, '', ExtractFilePath(FileName), SW_SHOWNORMAL);

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.