This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Exception of type 'pdfcrowd.Error' was thrown.

rptechrider wrote on 2015-06-29:
Anyone can resolve this error. I didn't get the reason why this error occur. I coding according to instruction to generate pdf from URL.
Here is my code below in Vb.net.

Dim client As New pdfcrowd.Client("asdasd", "02fasdaasdacfsdadc1764easda01cd2f2c1")

            ' convert a web page and write the generated PDF to a memory stream
            Dim Stream As New MemoryStream
            client.convertURI("http://localhost:881/print/mypage/125", Stream) //Here I'm getting error, error detail you can found in attachment.

            ' set HTTP response headers
            Response.Clear()
            Response.AddHeader("Content-Type", "application/pdf")
            Response.AddHeader("Cache-Control", "no-cache")
            Response.AddHeader("Accept-Ranges", "none")
            Response.AddHeader("Content-Disposition", "attachment; filename=" & name& ".pdf")

            ' send the generated PDF
            Stream.WriteTo(Response.OutputStream)
support wrote on 2015-06-30:
Hello,

This is because you are converting a web page that is hosted on your localhost. Pdfcrowd is a web service, PDFs are generated on our servers. It can't access your localhost, it can convert web pages that are accessible on the public Internet only.

In order to resolve the issue, you need to pass a public URL to the convertURI function.