Link Search Menu Expand Document


Generate a png, jpg or webp images from your terminal with VB.NET

Live demo Get an API Key

Table of contents

Generate an image with VB.NET

The API takes your HTML/CSS and runs it in an instance of Google Chrome to convert your html into an image. Use VB.NET to send the API your HTML/CSS. You’ll get back the URL to your generated image.

For more details on how this works, see Creating an image.

Example code

This code creates a WebClient, sets credentials and POSTS the HTML & CSS as values to the API. The response will be json with the URL to the generated image.

Imports System
Imports System.Net
Public Module htciExample

    Sub Main()
        Dim result As Byte()
        Dim html As String = "<div class='ping'>Pong ✅</div>"
            Dim css As String = ".ping {padding: 20px; font-family:'sans-serif'; }"
            Using client = New WebClient
            client.Credentials = New NetworkCredential("user_id", "api_key")
            result = client.UploadValues(
                    New Specialized.NameValueCollection() From {
                                             {"html", html}, {"css", css}
            End Using
            Dim resultString = System.Text.Encoding.UTF8.GetString(result)
    End Sub

End Module

Need help?

Talk to a human. Please email us with any questions and we’ll gladly help you get started.

Back to top

Built with extensive integration tests and serious care for developer happiness.
© 2018-2024 Code Happy, LLC.

Page last modified: Apr 9 2024 at 11:04 PM.

Edit this page on GitHub.