Dim cmds As List
cmds.Initialize
' "init" should be the first action
' The image from imageurl is loaded as basis for the future actions
cmds.Add(CreateMap("action": "init", "imageurl": "http://pdf.basic4android.de/20140126_100310.jpg","type":"jpg"))
'
' SetText writes a text into the pdf.
' border can be one OR more chars out of L, B, T, R (resp. Left, Bottom, Top, Right)
' x, y, w and h are the position and width/height of textbox
' r, g, b are the color for this text in RGB-format
' align can be L,C,R (leftjustify, center, rightjustify
cmds.Add(CreateMap("action": "SetText", "text": "Zora", "angle": 0,"x": 650, "y": 700, "r": 255,"g": 0,"b": 0,"size": 50,"font":"arial.ttf"))
cmds.Add(CreateMap("action": "SetText", "text": "Lucky", "angle": 260,"x": 700, "y": 210, "r": 255,"g": 255,"b": 255,"size": 50,"font":"arial.ttf"))
cmds.Add(CreateMap("action": "SetText", "text": "Charly", "angle": 30,"x": 250, "y": 500, "r": 255,"g": 255,"b": 255,"size": 50,"font":"arial.ttf"))
'
' SetImage copy a image into the basis-image
' imgurl = url of the image
' dst_x and dst_y is the position in basis-image where the part of the image in imageurl
' at position src_x and src_y with the dimension src_w, src_h would be copied
' type can be jpg or png
cmds.Add(CreateMap("action": "SetImage", "imageurl": "http://www.b4x.com/new_images/b4a_logo.png", "dst_x": 450, "dst_y": 550, "src_x": 0, "src_y": 0,"src_w": 155,"src_h": 84,"type":"png"))
Dim json As JSONGenerator
json.Initialize2(cmds)
Log(json.ToString)
Dim job As HttpJob
Dim p As PhoneId
job.Initialize("createjpg", Me)
job.download2("http://pdf.basic4android.de/createimage.php", Array As String( _
"json", json.ToString, _
"DeviceID", p.GetDeviceId _
))