a5_ink_to_png Function


a5_ink_to_png(C ink, N heightInPoints, N widthInPoints, C filename [, L flagUseViewBox [, C backgroundColor]])



the Ink data to be converted


the height of the PNG image in points (72 points = 1 inch)


the width of the PNG image in points


the filename of the PNG image


Default = .F.. If .F., image will be sized to fit the ink drawing with a 20px border. If .T., the image will be sized to fit the entire ink page.


The RGB code for the background color (#R,G,B), or an Alpha Anywhere color name. If blank (the default value) the background will be transparent.


Generate a PNG image from Ink data.


The Ink control (in the UX component) uses a special syntax for the Ink data. The a5_ink_to_png() function converts the ink data to a PNG image.

Example: Sizing the Image to the Ink Page

This function has a new parameter that lets you control how the image is created from the ink. By default, the image was bound to the size of the ink with a 20px border. You can set the flagUseViewBox parameter to .T. to size the image to the entire ink page, not just the bounds of the ink drawing. For example:

dim flagUseViewBox as L
flagUseViewBox = .t.

' Include the whole ink page in the generated png:

Example: Setting the Background color

This example demonstrates setting the background color for the png image:

' An Ajax Callback example
' Get ink data from INK1 control in UX Component
dim ink as C = e.dataSubmitted.INK1

dim height as N = 300
dim width as N = 500
dim filename as C = "C:/temp/ink.png"

' Red:
dim backgroundColor as C = "#255,0,0"

' Also Red:
' backgroundColor = "red"

dim flagUseViewBox as L = .t.

' Convert ink to a PNG with a background color of "red"