Render PDF with JSReport via vb.net server side HTTP POST api request



  • I am looking for a little bit of information on how to render PDF from JSReport when sending the information via HTTP Post, below is how I am making this request locally using vb.net. (jsonString = formatted json that is expected). JSReport handles the request when sending information needed on the template and saves files pertaining to the request locally (one of these files is the pdf that I am looking to render from my web site (this is not an web application as there is no .sln or .proj files as sites is driven off .aspx pages).

    The PDF stream is returned from JSReport but is encoded, is there a specific client/dll that is needed to render these pdfs from vb.net and not javascript as this processing is done server side?

    Dim uri As New Uri("http://localhost:4000/api/report")

    Dim client As New Net.WebClient
    client.Headers.Set("Content-Type", "application/json")
    Dim result = client.UploadString(uri, jsonString)


  • administrators

    hmm maybe this answer could help (it is in c# but it can be easily used with vb too), there you can see how to get a stream from the http response, then you can save the stream content to a file and send it to end your request.



  • Thanks @bjrmatos

    I am all set with the link you provided and a few modifications in the process, I didn't use the last 2 lines of the accepted answer as there seemed to be a overload conversion error (var sr = new SteamReader(steam)). I saved the stream to a pdf file and then opened the file during the web request


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.