diff --git a/ghostkube/_onlyLines/A3.htm b/ghostkube/_onlyLines/A3.htm new file mode 100644 index 0000000..e8ba5c2 --- /dev/null +++ b/ghostkube/_onlyLines/A3.htm @@ -0,0 +1,40 @@ + + + + + + + + + + + + + diff --git a/ghostkube/_onlyLines/A3.ts b/ghostkube/_onlyLines/A3.ts new file mode 100644 index 0000000..0c0635e --- /dev/null +++ b/ghostkube/_onlyLines/A3.ts @@ -0,0 +1,73 @@ +/// /// +declare const getPageParameterByName: (name: string, defaultValue: string)=> string; + +window.onload = () => { + const SIDE_LENGTH = parseInt(getPageParameterByName('side', '10')); + + const PAGE_LEFT = parseFloat(getPageParameterByName('left', '5')); + const PAGE_RIGHT = parseFloat(getPageParameterByName('right', '5')); + const PAGE_TOP = parseFloat(getPageParameterByName('top', '3.5')); + const PAGE_BOTTOM = parseFloat(getPageParameterByName('bottom', '3.5')); + + const MIN_X = 0; + const MAX_X = 420 - PAGE_LEFT - PAGE_RIGHT; + + const MIN_Y = 0; + const MAX_Y = 297 - PAGE_TOP - PAGE_BOTTOM; + + const ROW_COUNT = Math.floor(MAX_Y / SIDE_LENGTH); + const COL_COUNT = Math.floor(MAX_X / SIDE_LENGTH); + + let html = ''; + for (let rowIndex = 0; rowIndex <= ROW_COUNT; ++rowIndex) { + const Y = SIDE_LENGTH * rowIndex; + const X_SEG = ` x1="${MIN_X}mm" x2="${MAX_X}mm"`; + html += ``; + } + for (let colIndex = 0; colIndex <= COL_COUNT; ++colIndex) { + const X = SIDE_LENGTH * colIndex; + const Y_SEG = ` y1="${MIN_Y}mm" y2="${MAX_Y}mm"`; + html += ``; + } + + const SVG_ELEMENT = (document.getElementById('svg') as unknown as SVGElement); + SVG_ELEMENT.innerHTML = html; + + const SVG_ELEMENT_STYLE = SVG_ELEMENT.style; + SVG_ELEMENT_STYLE.marginLeft = `${PAGE_LEFT}mm`; + SVG_ELEMENT_STYLE.marginRight = `${PAGE_RIGHT}mm`; + SVG_ELEMENT_STYLE.marginTop = `${PAGE_TOP}mm`; + SVG_ELEMENT_STYLE.marginBottom = `${PAGE_BOTTOM}mm`; + + SVG_ELEMENT_STYLE.width = `${MAX_X}mm`; + SVG_ELEMENT_STYLE.height = `${MAX_Y}mm`; + // console.log(SVG_ELEMENT_STYLE); + + let title = `A3_${SIDE_LENGTH}mm_lines_`; + if ( + ( + (PAGE_LEFT === 5 && PAGE_RIGHT === 5) + || (PAGE_LEFT === 4.5 && PAGE_RIGHT === 4.5) + || (PAGE_LEFT === 4 && PAGE_RIGHT === 4) + || (PAGE_LEFT === 3.5 && PAGE_RIGHT === 3.5) + || (PAGE_LEFT === 3 && PAGE_RIGHT === 3) + ) + && + ( + (PAGE_TOP === 5 && PAGE_BOTTOM === 5) + || (PAGE_TOP === 4.5 && PAGE_BOTTOM === 4.5) + || (PAGE_TOP === 4 && PAGE_BOTTOM === 4) + || (PAGE_TOP === 3.5 && PAGE_BOTTOM === 3.5) + || (PAGE_TOP === 3 && PAGE_BOTTOM === 3) + ) + ) { + title += 'L1300.pdf'; + } else if (!PAGE_LEFT && !PAGE_RIGHT && !PAGE_TOP && !PAGE_BOTTOM) { + title += 'zero_margins.pdf'; + } else { + title += `left${PAGE_LEFT}mm_right${PAGE_RIGHT}mm_top${PAGE_TOP}mm_bottom${PAGE_BOTTOM}mm.pdf`; + } + document.getElementsByTagName('title')[0].innerText = title; + + window.print(); + }; \ No newline at end of file diff --git a/ghostkube/_onlyLines/A3_10mm_lines_L1300.pdf b/ghostkube/_onlyLines/A3_10mm_lines_L1300.pdf new file mode 100644 index 0000000..72c3389 Binary files /dev/null and b/ghostkube/_onlyLines/A3_10mm_lines_L1300.pdf differ diff --git a/ghostkube/_onlyLines/A3_10mm_lines_zero_margins.pdf b/ghostkube/_onlyLines/A3_10mm_lines_zero_margins.pdf new file mode 100644 index 0000000..9be1131 Binary files /dev/null and b/ghostkube/_onlyLines/A3_10mm_lines_zero_margins.pdf differ diff --git a/ghostkube/_onlyLines/A4.htm b/ghostkube/_onlyLines/A4.htm new file mode 100644 index 0000000..866901d --- /dev/null +++ b/ghostkube/_onlyLines/A4.htm @@ -0,0 +1,40 @@ + + + + + + + + + + + + + diff --git a/ghostkube/_onlyLines/A4.ts b/ghostkube/_onlyLines/A4.ts new file mode 100644 index 0000000..cef2ea9 --- /dev/null +++ b/ghostkube/_onlyLines/A4.ts @@ -0,0 +1,73 @@ +/// /// +declare const getPageParameterByName: (name: string, defaultValue: string)=> string; + +window.onload = () => { + const SIDE_LENGTH = parseInt(getPageParameterByName('side', '10')); + + const PAGE_LEFT = parseFloat(getPageParameterByName('left', '5')); + const PAGE_RIGHT = parseFloat(getPageParameterByName('right', '5')); + const PAGE_TOP = parseFloat(getPageParameterByName('top', '3.5')); + const PAGE_BOTTOM = parseFloat(getPageParameterByName('bottom', '3.5')); + + const MIN_X = 0; + const MAX_X = 210 - PAGE_LEFT - PAGE_RIGHT; + + const MIN_Y = 0; + const MAX_Y = 297 - PAGE_TOP - PAGE_BOTTOM; + + const ROW_COUNT = Math.floor(MAX_Y / SIDE_LENGTH); + const COL_COUNT = Math.floor(MAX_X / SIDE_LENGTH); + + let html = ''; + for (let rowIndex = 0; rowIndex <= ROW_COUNT; ++rowIndex) { + const Y = SIDE_LENGTH * rowIndex; + const X_SEG = ` x1="${MIN_X}mm" x2="${MAX_X}mm"`; + html += ``; + } + for (let colIndex = 0; colIndex <= COL_COUNT; ++colIndex) { + const X = SIDE_LENGTH * colIndex; + const Y_SEG = ` y1="${MIN_Y}mm" y2="${MAX_Y}mm"`; + html += ``; + } + + const SVG_ELEMENT = (document.getElementById('svg') as unknown as SVGElement); + SVG_ELEMENT.innerHTML = html; + + const SVG_ELEMENT_STYLE = SVG_ELEMENT.style; + SVG_ELEMENT_STYLE.marginLeft = `${PAGE_LEFT}mm`; + SVG_ELEMENT_STYLE.marginRight = `${PAGE_RIGHT}mm`; + SVG_ELEMENT_STYLE.marginTop = `${PAGE_TOP}mm`; + SVG_ELEMENT_STYLE.marginBottom = `${PAGE_BOTTOM}mm`; + + SVG_ELEMENT_STYLE.width = `${MAX_X}mm`; + SVG_ELEMENT_STYLE.height = `${MAX_Y}mm`; + // console.log(SVG_ELEMENT_STYLE); + + let title = `A4_${SIDE_LENGTH}mm_lines_`; + if ( + ( + (PAGE_LEFT === 5 && PAGE_RIGHT === 5) + || (PAGE_LEFT === 4.5 && PAGE_RIGHT === 4.5) + || (PAGE_LEFT === 4 && PAGE_RIGHT === 4) + || (PAGE_LEFT === 3.5 && PAGE_RIGHT === 3.5) + || (PAGE_LEFT === 3 && PAGE_RIGHT === 3) + ) + && + ( + (PAGE_TOP === 5 && PAGE_BOTTOM === 5) + || (PAGE_TOP === 4.5 && PAGE_BOTTOM === 4.5) + || (PAGE_TOP === 4 && PAGE_BOTTOM === 4) + || (PAGE_TOP === 3.5 && PAGE_BOTTOM === 3.5) + || (PAGE_TOP === 3 && PAGE_BOTTOM === 3) + ) + ) { + title += 'L1300.pdf'; + } else if (!PAGE_LEFT && !PAGE_RIGHT && !PAGE_TOP && !PAGE_BOTTOM) { + title += 'zero_margins.pdf'; + } else { + title += `left${PAGE_LEFT}mm_right${PAGE_RIGHT}mm_top${PAGE_TOP}mm_bottom${PAGE_BOTTOM}mm.pdf`; + } + document.getElementsByTagName('title')[0].innerText = title; + + window.print(); + }; \ No newline at end of file diff --git a/ghostkube/_onlyLines/A4_10mm_lines_L1300.pdf b/ghostkube/_onlyLines/A4_10mm_lines_L1300.pdf new file mode 100644 index 0000000..7b46d22 Binary files /dev/null and b/ghostkube/_onlyLines/A4_10mm_lines_L1300.pdf differ diff --git a/ghostkube/_onlyLines/A4_10mm_lines_zero_margins.pdf b/ghostkube/_onlyLines/A4_10mm_lines_zero_margins.pdf new file mode 100644 index 0000000..f90cadb Binary files /dev/null and b/ghostkube/_onlyLines/A4_10mm_lines_zero_margins.pdf differ diff --git a/ghostkube/_onlyLines/_removed.css b/ghostkube/_onlyLines/_removed.css new file mode 100644 index 0000000..d8efca8 --- /dev/null +++ b/ghostkube/_onlyLines/_removed.css @@ -0,0 +1,10 @@ +line.inner { + stroke: #888; + stroke-width: 0.1mm; + stroke-dasharray: 3 2; +} + +line.outer { + stroke-width: 0.2mm; + stroke: #000; +} \ No newline at end of file diff --git a/ghostkube/_onlyLines/anySize.htm b/ghostkube/_onlyLines/anySize.htm new file mode 100644 index 0000000..553e038 --- /dev/null +++ b/ghostkube/_onlyLines/anySize.htm @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ghostkube/_onlyLines/anySize.ts b/ghostkube/_onlyLines/anySize.ts new file mode 100644 index 0000000..49d2252 --- /dev/null +++ b/ghostkube/_onlyLines/anySize.ts @@ -0,0 +1,120 @@ +/* + file:///P:/anqi/Desktop/tech/ts/projects/203_ts_ghostkube/src/_onlyLines/anySize.htm?width=210&height=297&left=0&right=0&top=0&bottom=0&side=5 + + file:///P:/anqi/Desktop/tech/ts/projects/203_ts_ghostkube/src/_onlyLines/anySize.htm?width=210&height=216&left=0&right=0&top=0&bottom=0&side=5 +*/ + +/// /// +declare const getPageParameterByName: (name: string, defaultValue: string)=> string; + +window.onload = () => { + const SIDE_LENGTH = parseInt(getPageParameterByName('side', '10')); + + const PAGE_WIDTH = parseFloat(getPageParameterByName('width', '210')); + const PAGE_HEIGHT = parseFloat(getPageParameterByName('height', '297')); + + const PAGE_LEFT = parseFloat(getPageParameterByName('left', '5')); + const PAGE_RIGHT = parseFloat(getPageParameterByName('right', '5')); + const PAGE_TOP = parseFloat(getPageParameterByName('top', '3.5')); + const PAGE_BOTTOM = parseFloat(getPageParameterByName('bottom', '3.5')); + + const MIN_X = 0; + const MAX_X = PAGE_WIDTH - PAGE_LEFT - PAGE_RIGHT; + + const MIN_Y = 0; + const MAX_Y = PAGE_HEIGHT - PAGE_TOP - PAGE_BOTTOM; + + const ROW_COUNT = Math.floor(MAX_Y / SIDE_LENGTH); + const COL_COUNT = Math.floor(MAX_X / SIDE_LENGTH); + + let html = ''; + for (let rowIndex = 0; rowIndex <= ROW_COUNT; ++rowIndex) { + const Y = SIDE_LENGTH * rowIndex; + const X_SEG = ` x1="${MIN_X}mm" x2="${MAX_X}mm"`; + html += ``; + } + for (let colIndex = 0; colIndex <= COL_COUNT; ++colIndex) { + const X = SIDE_LENGTH * colIndex; + const Y_SEG = ` y1="${MIN_Y}mm" y2="${MAX_Y}mm"`; + html += ``; + } + + const SVG_ELEMENT = (document.getElementById('svg') as unknown as SVGElement); + SVG_ELEMENT.innerHTML = html; + + const SVG_ELEMENT_STYLE = SVG_ELEMENT.style; + SVG_ELEMENT_STYLE.marginLeft = `${PAGE_LEFT}mm`; + SVG_ELEMENT_STYLE.marginRight = `${PAGE_RIGHT}mm`; + SVG_ELEMENT_STYLE.marginTop = `${PAGE_TOP}mm`; + SVG_ELEMENT_STYLE.marginBottom = `${PAGE_BOTTOM}mm`; + + SVG_ELEMENT_STYLE.width = `${MAX_X}mm`; + SVG_ELEMENT_STYLE.height = `${MAX_Y}mm`; + // console.log(SVG_ELEMENT_STYLE); + + let title = `${ + ( + ((PAGE_WIDTH === 420 && PAGE_HEIGHT === 297) || (PAGE_WIDTH === 297 && PAGE_HEIGHT === 420)) + ? 'A3' + : ( + ((PAGE_WIDTH === 210 && PAGE_HEIGHT === 297) || (PAGE_WIDTH === 297 && PAGE_HEIGHT === 210)) + ? 'A4' + : `width${PAGE_WIDTH}mm_height${PAGE_HEIGHT}mm` + ) + ) + }_${SIDE_LENGTH}mm_lines_`; + if ( + ( + (PAGE_LEFT === 5 && PAGE_RIGHT === 5) + || (PAGE_LEFT === 4.5 && PAGE_RIGHT === 4.5) + || (PAGE_LEFT === 4 && PAGE_RIGHT === 4) + || (PAGE_LEFT === 3.5 && PAGE_RIGHT === 3.5) + || (PAGE_LEFT === 3 && PAGE_RIGHT === 3) + ) + && + ( + (PAGE_TOP === 5 && PAGE_BOTTOM === 5) + || (PAGE_TOP === 4.5 && PAGE_BOTTOM === 4.5) + || (PAGE_TOP === 4 && PAGE_BOTTOM === 4) + || (PAGE_TOP === 3.5 && PAGE_BOTTOM === 3.5) + || (PAGE_TOP === 3 && PAGE_BOTTOM === 3) + ) + ) { + title += 'L1300.pdf'; + } else if (!PAGE_LEFT && !PAGE_RIGHT && !PAGE_TOP && !PAGE_BOTTOM) { + title += 'zero_margins.pdf'; + } else { + title += `left${PAGE_LEFT}mm_right${PAGE_RIGHT}mm_top${PAGE_TOP}mm_bottom${PAGE_BOTTOM}mm.pdf`; + } + document.getElementsByTagName('title')[0].innerText = title; + + let css = ` +@media print { + @page { + size: ${PAGE_WIDTH}mm ${PAGE_HEIGHT}mm; + } +} + +* { + border: 0; + padding: 0; + margin: 0; +} + +html, +body { + overflow: hidden; + width: ${PAGE_WIDTH}mm; + height: ${PAGE_HEIGHT}mm; +} + +line { + stroke: #888; + stroke-width: 0.1mm; + /* stroke-dasharray: 3 2; */ +}`; + (document.getElementById('dynamicStyle') as unknown as HTMLStyleElement).innerText = css; + + + window.print(); + }; \ No newline at end of file diff --git a/ghostkube/_onlyLines/js/A3.js b/ghostkube/_onlyLines/js/A3.js new file mode 100644 index 0000000..daaafb7 --- /dev/null +++ b/ghostkube/_onlyLines/js/A3.js @@ -0,0 +1,56 @@ +window.onload = function () { + var SIDE_LENGTH = parseInt(getPageParameterByName('side', '10')); + var PAGE_LEFT = parseFloat(getPageParameterByName('left', '5')); + var PAGE_RIGHT = parseFloat(getPageParameterByName('right', '5')); + var PAGE_TOP = parseFloat(getPageParameterByName('top', '3.5')); + var PAGE_BOTTOM = parseFloat(getPageParameterByName('bottom', '3.5')); + var MIN_X = 0; + var MAX_X = 420 - PAGE_LEFT - PAGE_RIGHT; + var MIN_Y = 0; + var MAX_Y = 297 - PAGE_TOP - PAGE_BOTTOM; + var ROW_COUNT = Math.floor(MAX_Y / SIDE_LENGTH); + var COL_COUNT = Math.floor(MAX_X / SIDE_LENGTH); + var html = ''; + for (var rowIndex = 0; rowIndex <= ROW_COUNT; ++rowIndex) { + var Y = SIDE_LENGTH * rowIndex; + var X_SEG = " x1=\"" + MIN_X + "mm\" x2=\"" + MAX_X + "mm\""; + html += ""; + } + for (var colIndex = 0; colIndex <= COL_COUNT; ++colIndex) { + var X = SIDE_LENGTH * colIndex; + var Y_SEG = " y1=\"" + MIN_Y + "mm\" y2=\"" + MAX_Y + "mm\""; + html += ""; + } + var SVG_ELEMENT = document.getElementById('svg'); + SVG_ELEMENT.innerHTML = html; + var SVG_ELEMENT_STYLE = SVG_ELEMENT.style; + SVG_ELEMENT_STYLE.marginLeft = PAGE_LEFT + "mm"; + SVG_ELEMENT_STYLE.marginRight = PAGE_RIGHT + "mm"; + SVG_ELEMENT_STYLE.marginTop = PAGE_TOP + "mm"; + SVG_ELEMENT_STYLE.marginBottom = PAGE_BOTTOM + "mm"; + SVG_ELEMENT_STYLE.width = MAX_X + "mm"; + SVG_ELEMENT_STYLE.height = MAX_Y + "mm"; + // console.log(SVG_ELEMENT_STYLE); + var title = "A3_" + SIDE_LENGTH + "mm_lines_"; + if (((PAGE_LEFT === 5 && PAGE_RIGHT === 5) + || (PAGE_LEFT === 4.5 && PAGE_RIGHT === 4.5) + || (PAGE_LEFT === 4 && PAGE_RIGHT === 4) + || (PAGE_LEFT === 3.5 && PAGE_RIGHT === 3.5) + || (PAGE_LEFT === 3 && PAGE_RIGHT === 3)) + && + ((PAGE_TOP === 5 && PAGE_BOTTOM === 5) + || (PAGE_TOP === 4.5 && PAGE_BOTTOM === 4.5) + || (PAGE_TOP === 4 && PAGE_BOTTOM === 4) + || (PAGE_TOP === 3.5 && PAGE_BOTTOM === 3.5) + || (PAGE_TOP === 3 && PAGE_BOTTOM === 3))) { + title += 'L1300.pdf'; + } + else if (!PAGE_LEFT && !PAGE_RIGHT && !PAGE_TOP && !PAGE_BOTTOM) { + title += 'zero_margins.pdf'; + } + else { + title += "left" + PAGE_LEFT + "mm_right" + PAGE_RIGHT + "mm_top" + PAGE_TOP + "mm_bottom" + PAGE_BOTTOM + "mm.pdf"; + } + document.getElementsByTagName('title')[0].innerText = title; + window.print(); +}; diff --git a/ghostkube/_onlyLines/js/A4.js b/ghostkube/_onlyLines/js/A4.js new file mode 100644 index 0000000..6cbafd8 --- /dev/null +++ b/ghostkube/_onlyLines/js/A4.js @@ -0,0 +1,56 @@ +window.onload = function () { + var SIDE_LENGTH = parseInt(getPageParameterByName('side', '10')); + var PAGE_LEFT = parseFloat(getPageParameterByName('left', '5')); + var PAGE_RIGHT = parseFloat(getPageParameterByName('right', '5')); + var PAGE_TOP = parseFloat(getPageParameterByName('top', '3.5')); + var PAGE_BOTTOM = parseFloat(getPageParameterByName('bottom', '3.5')); + var MIN_X = 0; + var MAX_X = 210 - PAGE_LEFT - PAGE_RIGHT; + var MIN_Y = 0; + var MAX_Y = 297 - PAGE_TOP - PAGE_BOTTOM; + var ROW_COUNT = Math.floor(MAX_Y / SIDE_LENGTH); + var COL_COUNT = Math.floor(MAX_X / SIDE_LENGTH); + var html = ''; + for (var rowIndex = 0; rowIndex <= ROW_COUNT; ++rowIndex) { + var Y = SIDE_LENGTH * rowIndex; + var X_SEG = " x1=\"" + MIN_X + "mm\" x2=\"" + MAX_X + "mm\""; + html += ""; + } + for (var colIndex = 0; colIndex <= COL_COUNT; ++colIndex) { + var X = SIDE_LENGTH * colIndex; + var Y_SEG = " y1=\"" + MIN_Y + "mm\" y2=\"" + MAX_Y + "mm\""; + html += ""; + } + var SVG_ELEMENT = document.getElementById('svg'); + SVG_ELEMENT.innerHTML = html; + var SVG_ELEMENT_STYLE = SVG_ELEMENT.style; + SVG_ELEMENT_STYLE.marginLeft = PAGE_LEFT + "mm"; + SVG_ELEMENT_STYLE.marginRight = PAGE_RIGHT + "mm"; + SVG_ELEMENT_STYLE.marginTop = PAGE_TOP + "mm"; + SVG_ELEMENT_STYLE.marginBottom = PAGE_BOTTOM + "mm"; + SVG_ELEMENT_STYLE.width = MAX_X + "mm"; + SVG_ELEMENT_STYLE.height = MAX_Y + "mm"; + // console.log(SVG_ELEMENT_STYLE); + var title = "A4_" + SIDE_LENGTH + "mm_lines_"; + if (((PAGE_LEFT === 5 && PAGE_RIGHT === 5) + || (PAGE_LEFT === 4.5 && PAGE_RIGHT === 4.5) + || (PAGE_LEFT === 4 && PAGE_RIGHT === 4) + || (PAGE_LEFT === 3.5 && PAGE_RIGHT === 3.5) + || (PAGE_LEFT === 3 && PAGE_RIGHT === 3)) + && + ((PAGE_TOP === 5 && PAGE_BOTTOM === 5) + || (PAGE_TOP === 4.5 && PAGE_BOTTOM === 4.5) + || (PAGE_TOP === 4 && PAGE_BOTTOM === 4) + || (PAGE_TOP === 3.5 && PAGE_BOTTOM === 3.5) + || (PAGE_TOP === 3 && PAGE_BOTTOM === 3))) { + title += 'L1300.pdf'; + } + else if (!PAGE_LEFT && !PAGE_RIGHT && !PAGE_TOP && !PAGE_BOTTOM) { + title += 'zero_margins.pdf'; + } + else { + title += "left" + PAGE_LEFT + "mm_right" + PAGE_RIGHT + "mm_top" + PAGE_TOP + "mm_bottom" + PAGE_BOTTOM + "mm.pdf"; + } + document.getElementsByTagName('title')[0].innerText = title; + window.print(); +}; diff --git a/ghostkube/_onlyLines/js/anySize.js b/ghostkube/_onlyLines/js/anySize.js new file mode 100644 index 0000000..f4fa7ec --- /dev/null +++ b/ghostkube/_onlyLines/js/anySize.js @@ -0,0 +1,69 @@ +/* + file:///P:/anqi/Desktop/tech/ts/projects/203_ts_ghostkube/src/_onlyLines/anySize.htm?width=210&height=297&left=0&right=0&top=0&bottom=0&side=5 + + file:///P:/anqi/Desktop/tech/ts/projects/203_ts_ghostkube/src/_onlyLines/anySize.htm?width=210&height=216&left=0&right=0&top=0&bottom=0&side=5 +*/ +window.onload = function () { + var SIDE_LENGTH = parseInt(getPageParameterByName('side', '10')); + var PAGE_WIDTH = parseFloat(getPageParameterByName('width', '210')); + var PAGE_HEIGHT = parseFloat(getPageParameterByName('height', '297')); + var PAGE_LEFT = parseFloat(getPageParameterByName('left', '5')); + var PAGE_RIGHT = parseFloat(getPageParameterByName('right', '5')); + var PAGE_TOP = parseFloat(getPageParameterByName('top', '3.5')); + var PAGE_BOTTOM = parseFloat(getPageParameterByName('bottom', '3.5')); + var MIN_X = 0; + var MAX_X = PAGE_WIDTH - PAGE_LEFT - PAGE_RIGHT; + var MIN_Y = 0; + var MAX_Y = PAGE_HEIGHT - PAGE_TOP - PAGE_BOTTOM; + var ROW_COUNT = Math.floor(MAX_Y / SIDE_LENGTH); + var COL_COUNT = Math.floor(MAX_X / SIDE_LENGTH); + var html = ''; + for (var rowIndex = 0; rowIndex <= ROW_COUNT; ++rowIndex) { + var Y = SIDE_LENGTH * rowIndex; + var X_SEG = " x1=\"" + MIN_X + "mm\" x2=\"" + MAX_X + "mm\""; + html += ""; + } + for (var colIndex = 0; colIndex <= COL_COUNT; ++colIndex) { + var X = SIDE_LENGTH * colIndex; + var Y_SEG = " y1=\"" + MIN_Y + "mm\" y2=\"" + MAX_Y + "mm\""; + html += ""; + } + var SVG_ELEMENT = document.getElementById('svg'); + SVG_ELEMENT.innerHTML = html; + var SVG_ELEMENT_STYLE = SVG_ELEMENT.style; + SVG_ELEMENT_STYLE.marginLeft = PAGE_LEFT + "mm"; + SVG_ELEMENT_STYLE.marginRight = PAGE_RIGHT + "mm"; + SVG_ELEMENT_STYLE.marginTop = PAGE_TOP + "mm"; + SVG_ELEMENT_STYLE.marginBottom = PAGE_BOTTOM + "mm"; + SVG_ELEMENT_STYLE.width = MAX_X + "mm"; + SVG_ELEMENT_STYLE.height = MAX_Y + "mm"; + // console.log(SVG_ELEMENT_STYLE); + var title = (((PAGE_WIDTH === 420 && PAGE_HEIGHT === 297) || (PAGE_WIDTH === 297 && PAGE_HEIGHT === 420)) + ? 'A3' + : (((PAGE_WIDTH === 210 && PAGE_HEIGHT === 297) || (PAGE_WIDTH === 297 && PAGE_HEIGHT === 210)) + ? 'A4' + : "width" + PAGE_WIDTH + "mm_height" + PAGE_HEIGHT + "mm")) + "_" + SIDE_LENGTH + "mm_lines_"; + if (((PAGE_LEFT === 5 && PAGE_RIGHT === 5) + || (PAGE_LEFT === 4.5 && PAGE_RIGHT === 4.5) + || (PAGE_LEFT === 4 && PAGE_RIGHT === 4) + || (PAGE_LEFT === 3.5 && PAGE_RIGHT === 3.5) + || (PAGE_LEFT === 3 && PAGE_RIGHT === 3)) + && + ((PAGE_TOP === 5 && PAGE_BOTTOM === 5) + || (PAGE_TOP === 4.5 && PAGE_BOTTOM === 4.5) + || (PAGE_TOP === 4 && PAGE_BOTTOM === 4) + || (PAGE_TOP === 3.5 && PAGE_BOTTOM === 3.5) + || (PAGE_TOP === 3 && PAGE_BOTTOM === 3))) { + title += 'L1300.pdf'; + } + else if (!PAGE_LEFT && !PAGE_RIGHT && !PAGE_TOP && !PAGE_BOTTOM) { + title += 'zero_margins.pdf'; + } + else { + title += "left" + PAGE_LEFT + "mm_right" + PAGE_RIGHT + "mm_top" + PAGE_TOP + "mm_bottom" + PAGE_BOTTOM + "mm.pdf"; + } + document.getElementsByTagName('title')[0].innerText = title; + var css = "\n@media print {\n @page {\n size: " + PAGE_WIDTH + "mm " + PAGE_HEIGHT + "mm;\n }\n}\n\n* {\n border: 0;\n padding: 0;\n margin: 0;\n}\n\nhtml,\nbody {\n overflow: hidden;\n width: " + PAGE_WIDTH + "mm;\n height: " + PAGE_HEIGHT + "mm;\n}\n\nline {\n stroke: #888;\n stroke-width: 0.1mm;\n /* stroke-dasharray: 3 2; */\n}"; + document.getElementById('dynamicStyle').innerText = css; + window.print(); +}; diff --git a/ghostkube/_onlyLines/pdfs.lnk b/ghostkube/_onlyLines/pdfs.lnk new file mode 100644 index 0000000..6298311 Binary files /dev/null and b/ghostkube/_onlyLines/pdfs.lnk differ diff --git a/ghostkube/_onlyLines/width210mm_height148.5mm_10mm_lines_L1300.pdf b/ghostkube/_onlyLines/width210mm_height148.5mm_10mm_lines_L1300.pdf new file mode 100644 index 0000000..8f29965 Binary files /dev/null and b/ghostkube/_onlyLines/width210mm_height148.5mm_10mm_lines_L1300.pdf differ diff --git a/ghostkube/_onlyLines/width210mm_height148.5mm_10mm_lines_zero_margins.pdf b/ghostkube/_onlyLines/width210mm_height148.5mm_10mm_lines_zero_margins.pdf new file mode 100644 index 0000000..81cb796 Binary files /dev/null and b/ghostkube/_onlyLines/width210mm_height148.5mm_10mm_lines_zero_margins.pdf differ