How to execute VeryPDF Cloud API from .aspx language or .NET language?

Hi

I'm looking at your pdf API from a URL, e.g.:

http://online.verypdf.com/api/?apikey=XXXX-XXXX-XXXXXXXX
&app=html2pdf&infile=http://www.verypdf.com&outfile=verypdf.pdf

The response file in your test example come back as, e.g.:

http://online.verypdf.com/u/public/api/20131017-061805-1722272062-verypdf.pdf

1. Is there a way in the call to stipulate where the link to the output url back to in the URL string?

Or

2. Can the response render/display the pdf rather provide the output link?

Or

3. Is there a way for the call to send back the pdf file rather than a stored copy on your server?

Customer
------------------------------------------------
Thanks for your message, you can use PHP or C# to retrieve this URL first, download it to your local server, and delete it from VeryPDF Cloud API server, then its fine. For example,

1. Execute following URL to convert a web page to PDF file,

http://online.verypdf.com/api/?apikey=XXXX-XXXX-XXXXXXXX
&app=html2pdf&infile=http://www.verypdf.com&outfile=verypdf.pdf

2. Download PDF file to your local server,

wget http://online.verypdf.com/u/public/api/20131017-061805-1722272062-verypdf.pdf

3. Delete PDF file from VeryPDF Cloud API server,

http://online.verypdf.com/api/?apikey=XXXX&app=deletefile
&infile=http://online.verypdf.com/u/public/api/20131017-061805-1722272062-verypdf.pdf

We hoping above steps will work fine to you.

VeryPDF
------------------------------------------------
Thanks for the update and the delete is useful.

I had an error when my conversion html page url also had parameters eg "&". How can I separate my url from your parameters

How can I read the output string location dynamically. Can the include a url to return the output location string.

Do you also support https?

Customer
------------------------------------------------
>>I had an error when my conversion html page url also had parameters eg "&". How can I separate my url from your parameters

You can use urlencode() function to replace "&" with a special string, please refer to the details about urlencode() at below,

http://php.net/manual/en/function.urlencode.php

>>How can I read the output string location dynamically. Can the include a url to return the output location string.

You can simple use strstr() to find the "[Output] " string from output HTML content, the real HTTP URL is at the after of "[Output] " string, e.g.,

[Output] http://online.verypdf.com/u/public/api/20131017-061805-1722272062-verypdf.pdf

>>Do you also support https?

Not support https yet, we are planning support https in the future.

VeryPDF
------------------------------------------------
Thanks

Can you explain this one further

>>How can I read the output string location dynamically. Can the include a url to return the output location string. You can simple use strstr() to find the "[Output] " string from output HTML content, the real HTTP URL is at the after of "[Output] " string, e.g.,[Output] http://online.verypdf.com/u/public/api/20131017-061805-1722272062-verypdf.pdf

I am still unsure how the service pass’s back this Output URL, can you provide an example?

If I call the URL from html, I have a URL ready to receive the Output. How does the call know to pass this variable back to me receiver URL?

At the moment it only displays it as text in the browser window.

Customer
------------------------------------------------
Please refer to PHP example at below web page,

http://www.verypdf.com/online/cloud-api/user-guide.html

You can use following PHP code to execute URL easily,

<?php
        //The Code
        /* gets the data from a URL */
        function get_data($url)
        {
                $ch = curl_init();
                $timeout = 5;
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
                $data = curl_exec($ch);
                curl_close($ch);
                return $data;
        }

        //The Usage
        $returned_content = get_data(
        'http://online.verypdf.com/api/?apikey=XXXX-XXXX-XXXX-XXXX
        &app=html2image&infile=http://www.verypdf.com&outfile=verypdf.jpg'
);
        echo $returned_content;
?>

VeryPDF
------------------------------------------------
Hi There,

My site is cloud hosted application using .aspx.

Is there a JavaScript method for the below?

Customer
------------------------------------------------
In ASPX language, you can use WebRequest to GET the result of a URL, please refer to following sample code,

var webRequest = WebRequest.Create(
"http://online.verypdf.com/api/?apikey=XXXX-XXXX-XXXX-XXXX&app=html2image&infile=http://www.verypdf.com&outfile=verypdf.jpg");
var webResponse = webRequest.GetResponse();
if (webResponse != null)
{
        var responseStream = webResponse.GetResponseStream();
        if (responseStream != null)
        {
                var streamReader = new StreamReader(responseStream);
                var pageSource = streamReader.ReadToEnd();
                OtherContent.Text = pageSource;
        }
}

VeryPDF

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in VeryPDF Cloud API and tagged . Bookmark the permalink.

One Response to How to execute VeryPDF Cloud API from .aspx language or .NET language?

  1. VeryPDF says:

    >>How to call VeryPDF Cloud API from ASP code? Help Please / API & Classic ASP Integration

    Please register an account on http://online.verypdf.com using your Paypal email address, you will get a new APIKEY, please use this APIKEY, you will able to remove demo watermark,

    XXXX-XXXX-XXXX-XXXX

    e.g.,

    set objHttp = Server.CreateObject(“Microsoft.XMLHTTP”)
    objHttp.open “POST”, “http://online.verypdf.com/api/?apikey=XXXX-XXXX-XXXX-XXXX&app=html2pdf&infile=http://www.verydoc.com/&outfile=out.pdf&-O=landscape”, false
    objHttp.setRequestHeader “Content-type”, “application/x-www-form-urlencoded”
    objHttp.Send

    sQuerystring = objHttp.responseText

    sQuerystring = replace(sQuerystring,”[Output] “,””)
    sQuerystring = replace(sQuerystring, “”, “”)

    response.write(“Reply = LINK”)

    VN:F [1.9.20_1166]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.20_1166]
    Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!