Home Server

Is it possible? Archiving and Pdf

edited September 2007 in Server
Is it possible with the Server to call a report but not return it to the
client - just write out directly to a pdf or archive file? This would be
written out to a file on the machine where the server resides. To be viewed
later using the client viewing the archive directory.

We are trying to use the Server to handle scheduled reports and would not
need an immediate viewing of the report output.

Just need to know if this is possible.

Bill Brittain

Comments

  • edited September 2007
    Just thinking.

    Since we were thinking of calling some processes as webservices from the
    scheduler.

    Possibly we could utililize the webtier component to use in an asp.net
    webservice to generate a report with "content=pdf" but not return as a
    response. The output created of the pdf for the response is what we need,
    just not an actually html response.

    This thinking is based on your example of calling in an aspx page - the
    webtiercomserver.ocx example.

    Has anyone done something along this lines.

    And this would be good for allocating in a round robin server farm
    arrangement.

    What do you think?

    Bill Brittain






  • edited September 2007

    - You can use ClientReport to generate a PDF. The ClientReport, Report and
    ArchiveReader descend from a common anscestor, Producer. They share many of
    the same properties, methods, and events. (As a first step towards a
    solution, try placing a ClientReport on a form, configure it to communicate
    with your server and try writing some code to generate a PDF file. )

    - The WebTier internally uses ClientReport to communicate with the Server.
    You can call the WebTier.CreateClientReport method to create a ClientReport
    that is configured to communicate with the server. After you are done, free
    the ClientReport.

    - To extend the ASP.NET example, you can add methods to the COM object and
    then call them from ASP.NET.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2007
    I found that using an http call from our scheduler area to call the reports
    thru the webtier component works.

    I removed the Response.Content to not return the report to our calling
    process.

    Our Request is calling the report with content=pdf and the pdf is being
    created without problem.

    Our next problem is assigning the report to the appropriate directory that
    we need it in to allow the report to be viewed after being created.

    This probably goes back to what you were saying about using the
    CreateClientReport method.

    How should that be done. Could you give me a brief code example of how to
    just create and call the report in the webtier action item to replace the
    ProcessWebRequest.

    Thanks for all your help.

    Bill Brittain
  • edited September 2007

    I think this will help you accomplish what you need...

    -------------------------------------------------------
    Tech Tips: RB Server and Custom Parameters
    -------------------------------------------------------

    The RBServer Custom Parameter demos show how to define custom session and
    report level parameters that can be used to implement security and other
    types of custom processing.

    The are three projects that work together. Each project includes a
    ReadMe.doc and commented code.

    1. RBServer\Demos\Servers\Custom Parameters
    2. RBServer\Demos\WebTier\Custom Parameters
    3. RBServer\Demos\Clients\Custom Parameters


    The demos include examples of how to...

    1. Define Custom Session parameters.

    A custom login form is displayed. Based upon the login, the catalog of
    reports available to the user is filtered.

    2. Define Custom Report parameters

    A custom parameter form is displayed. The parameters are used by the report.

    3. Custom AutoSearch form

    A custom autosearch form is displayed. The parameter values are used by the
    autosearch criteria.





    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2007
    Thank you Nard.

    These look quite promising.

    Bill Brittain

  • edited March 2008
    Nard Moseley (Digital Metaphors) wrote:
    I am trying to do this but with no success...
    I tried

    rsClientReport1.AllowPrintToFile := true;
    rsClientReport1.DeviceType := 'PDF';
    rsClientReport1.PrintToDevices; // even tried .print
    ShowMessage('FileName:'+rsClientReport1.TextFileName);

    or in this way:

    rsClientReport1.AllowPrintToFile := true;
    rsClientReport1.SessionParameters['content'].Value := 'PDF';
    rsClientReport1.PrintToDevices; // even tried .Print
    ShowMessage('FileName:'+rsClientReport1.TextFileName);

    What I want to achieve is :
    1. tell rb server to print on pdf
    2. be able to get the path in the cache of the pdf generated at step #1

    I could achieve this parsing the output of ProcessWebRequest (isolating
    the pdf path from:
    ..

    ..

    but it not seems to me a good approach ...
    I am using RB 9.03 and D7
    Thanks in advance for any help
    bye
    Nicola
  • edited March 2008

    - I don't a see problem with parsing out the web response - that is just as
    good approach as any other. It will let the webtier do what it already it
    does - process the requests.

    - I researched this and came with an example:

    uses
    rsWebRequest,
    rsWebSessionManager,
    rsWebSession,
    rsWebCacheReportFile;

    procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
    Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
    var
    lWebRequest: TrsWebRequest;
    lWebSession: TrsWebSession;
    lWebCacheReportFile: TrsWebCacheReportFile;
    begin

    // create a WebRequestObject
    lWebRequest := rsWebTier1.CreateWebRequest(Request.QueryFields,
    Request.Content);

    // check whether request is for a pdf
    if (lWebRequest.ContentType = 'pdf') and
    (rsWebTier1.SessionExists(lWebRequest)) then
    begin
    // get the web session
    lWebSession := gWebSessionManager.GetSessionForRequest(lWebRequest);

    // get the cache
    lWebCacheReportFile := TrsWebCacheReportFile.Create(lWebSession,
    lWebRequest);

    lWebCacheReportFile.FileExtension := 'pdf';


    // the report file will be this value
    ShowMessage(lWebCacheReportFile.ReportFileQualifiedName);

    lWebCacheReportFile.Free;

    end;


    Response.Content := rsWebTier1.ProcessWebRequest(lWebRequest);

    lWebRequest.Free;

    end;

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2008
    Nard Moseley (Digital Metaphors) wrote:
    My only concern is if the output of ProcessWebRequest could change for
    some reason ...


    I tried and it works but it returns the local path while
    ProcessWebRequest returns the web version (starting with "http://....").
    So I'll stay with the first option if you can tell me that the output
    will stay the same. By the way, are the functions/classes you used in
    this example documented somewhere ?
    I searched the help and didn't find the TrsWebCacheReportFile class.

    Many thanks, really appreciate your help
    Bye
    Nicola
  • edited March 2008

    Those are implementation classes that are not currently documented.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.