Table of Contents

Method printToImageData

Namespace
vdWebLibrary
Assembly
JsPropertiesExtractor.dll

printToImageData(int, int, object, object, object, int, int)

Returns an array of data that can be used in an image in order to help the user print the drawing using the given parameters.

public string printToImageData(int windowFlag, int ScaleFlag, object papersizeHINCH, object MarginHINCH, object bkcolor, int frameWidth, int resolution)

Parameters

windowFlag int

Defines what part of the displayed drawing will be selected for printing. Possible parameters are PRINT_WINDOW_FLAG_EXTENTS, PRINT_WINDOW_FLAG_VIEW, PRINT_WINDOW_FLAG_ORIGINAL.

ScaleFlag int

Defines the scale of the area that will be printed on the paper. Possible parameters are PRINT_SCALE_FLAG_FIT, PRINT_SCALE_FLAG_ORIGINAL.

papersizeHINCH object

A two sized array defining the width and height of the paper to be used for the print job in hundreds of inches.

MarginHINCH object

A number defining the printer's margin on every side of the paper in hundreds of inches.

bkcolor object

A four sized array defining the background's color. The first element if for Red, second for Green, third for Blue and fourth for Alpha.

frameWidth int

The width of the border defining the paper size in the resulted image data, in pixels.If it is greater than zero(0) then a border will be drawn around the paper with forground color.

resolution int

The resolution to be used for the image export. It overrides the printer's resolution.

Returns

string

An array of image data in string format.

Examples

See also our print dialog example on http://vdraw.com/javascript-examples/print-dialog/

var dataUrl = vdcanvas.printToImageData(vdConst.PRINT_WINDOW_FLAG_VIEW, vdConst.PRINT_SCALE_FLAG_FIT, new Array(830, 1170), 10, Array(255, 255, 255, 255), 2);
  var windowContent = '<!DOCTYPE html>';
  windowContent += '<html>'
  windowContent += '<head><title>Print canvas</title></head>';
  windowContent += '<body>'
  windowContent += '<img src="' + dataUrl + '">';
  windowContent += '</body>';
  windowContent += '</html>';
  var printWin = window.open('', '', 'width=830,height=600,scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes');
  printWin.document.open();
  printWin.document.write(windowContent);
  printWin.document.close();
  printWin.focus();