This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

BoundedTextVObject) error

Object
ExceptionType
:
"System.InvalidOperationException"
Message
:
"TextRenderer cannot write a text bitmap because it is empty"
StackTrace
:
" at Aurigma.GraphicsMill.AjaxControls.VectorObjects.TextRenderer.GetTextBitmap(BaseTextVObject vObject, Single dpi, Point location, Boolean extendBitmap, String& id)
↵ at Aurigma.GraphicsMill.AjaxControls.VectorObjects.TextRenderer.RenderToFile(BaseTextVObject vObject, Single dpi)
↵ at Aurigma.GraphicsMill.AjaxControls.VectorObjects.Service.UpdateTextVObject(BaseTextVObject vObject, ICanvas canvas)
↵ at Aurigma.GraphicsMill.AjaxControls.VectorObjects.Service.UpdateByBoundedTextVObjectData(String canvasData, String vObjectData)"
Could you post a small code sample to reproduce the problem?
var text = new Aurigma.GraphicsMill.AjaxControls.VectorObjects.BoundedTextVObject();

			    var objectName = 'text' + uniqueId;
			    var sameNameObjectCount = canvasViewer.get_canvas().get_layers().getVObjectsByName(objectName)[0];
			
			    if (sameNameObjectCount)
			    {
				    alert("The field has already been inserted into the business card.");
			    }
			    else
			    {
                 text .set_text("AJAX Vector Objects");
                 text .set_rectangle(new Aurigma.GraphicsMill.AjaxControls.VectorObjects.Math.RotatedRectangleF(200, 100, 150, 100));
               
                 text .set_alignment(Aurigma.GraphicsMill.AjaxControls.VectorObjects.TextAlignment.Center);
			        text.set_borderWidth(0);			       
				    text.set_name(objectName);
				    layer.get_vObjects().add(text);
				    var index = text.get_index();

				    if (index > 0)
				    {
				        canvasViewer.get_canvas().CurrentVObjectIndex=index;
				        canvasViewer.get_canvas().get_currentVObject();
				    }
			    }



error occurs on the layer.get_vObjects().add(text); and
text.set_fontname function is not defined , so i use text.get_font().set_PostscriptName("Tahoma'); instead. So as the
text .set_fontSize(20); function is not defined

Hey,

To fix the problem you shouldn't use the constructor without parameters:

var text = new Aurigma.GraphicsMill.AjaxControls.VectorObjects.BoundedTextVObject("AJAX Vector Objects", new Aurigma.GraphicsMill.AjaxControls.VectorObjects.Math.RectangleF(200, 100, 150, 100), "Tahoma", 20);