Hi Guys,
I am generating one word report using script.
I have few models and I want to print the graphic image of one model in word document.
currently I am using this code for printing the image:-
var modelPicture = obj_conn_model[0].Graphic(false,false,locale); output.OutGraphic(modelPicture,50,200,385);//output is reference of createOutputObjects()
here I am giving a fix size of image.
I don't want to do that. because if image size exceeds the page size then it wont give me a proper image.
So I want to print the image in auto adjustable size according to page width and height.
Please help if you can.
Thanks,
Ankit
Hi Ankit,
While you are creating the setup for the output file, you can also specify the dimensions.
What you can do is define a set of variables such as:
var outputWidth var outputHeight var outputMarginLeft var outputMarginRight var outputMarginTop var outputMarginBottom
This particularly will help you in defining your pictureWidth and pictureHeight:
var pictureWidth = (outputWidth - outputMarginLeft - outputMarginRight); var pictureHeight = ((outputHeight)/2 - outputMarginTop - outputMarginBottom); // half a page height var zoomLevel = -1; // zoomlevel is determined to match pictureWidth or pictureHeight, whichever is fitting output.OutGraphic(modelPicture,zoomLevel,pictureWidth,pictureHeight);
Or, alternatively, you can use the OutGrapicAbsolute(picture, int, int, int, int, boolean) function to get absolute control on the size and position.
/** From the helpfile: Report class StandardOutputAPI - Method OutGraphicAbsolute OutGraphicAbsolute ( Picture p_sPicture, int p_iX1, int p_iY1, int p_iPicWidthMM, int p_iPicHeightMM, boolean p_bBackground ) Insert a graphic at an absolute position. Example **/ var File = Context.createOutputObject(); var image = Context.createPicture("picture.jpg"); File.OutGraphicAbsolute(image,10, 10, 100, 100, true);