Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Luciano Barletta
/
Pruebas-RTO
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit e584f4bb
authored
2020-01-21 11:58:57 +0000
by
Luciano Barletta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
each text gets its own style
1 parent
b33385d8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
121 deletions
static/src/div.js
static/src/pdf1.js
static/src/pdf2.js
templates/resultados.html
static/src/div.js
View file @
e584f4b
...
@@ -70,17 +70,22 @@ class Text {
...
@@ -70,17 +70,22 @@ class Text {
/**
/**
* Both arguments should be real coordinates and not a percentage based on parent element
* Both arguments should be real coordinates and not a percentage based on parent element
* @param {string} text
* @param {string} text
* @param {Vector} position
* @param {Vector} position
* @param {object} font
*/
*/
constructor
(
text
,
position
)
{
constructor
(
text
,
position
,
font
)
{
this
.
text
=
text
;
this
.
text
=
text
;
this
.
position
=
position
;
this
.
position
=
position
;
this
.
font
=
font
}
}
/**
/**
* @param {jsPDF} pdf
* @param {jsPDF} pdf
*/
*/
draw
(
pdf
)
{
draw
(
pdf
)
{
pdf
.
setFont
(
this
.
font
.
font
);
pdf
.
setFontType
(
this
.
font
.
type
);
pdf
.
setFontSize
(
this
.
font
.
size
);
pdf
.
text
(
pdf
.
text
(
this
.
text
,
this
.
text
,
this
.
position
.
x
,
this
.
position
.
x
,
...
@@ -224,21 +229,6 @@ const Pos = {
...
@@ -224,21 +229,6 @@ const Pos = {
};
};
function
compile
(
tree
,
pdf
)
{
function
compile
(
tree
,
pdf
)
{
pdf
.
setFont
(
"Courier"
);
tree
.
children
.
forEach
(
child
=>
child
.
draw
(
pdf
));
pdf
.
setFontType
(
"normal"
);
pdf
.
setFontSize
(
10
);
tree
.
children
.
forEach
(
child
=>
{
switch
(
child
.
constructor
.
name
)
{
case
"Text"
:
pdf
.
text
(
child
.
text
,
child
.
position
.
x
,
child
.
position
.
y
);
break
;
case
"Div"
:
if
(
child
.
drawOutline
)
{
child
.
drawDivBox
(
pdf
);
}
compile
(
child
,
pdf
);
break
;
}
});
return
pdf
;
return
pdf
;
}
}
\ No newline at end of file
\ No newline at end of file
static/src/pdf1.js
View file @
e584f4b
...
@@ -2,15 +2,20 @@ class PDF1 {
...
@@ -2,15 +2,20 @@ class PDF1 {
"use strict"
;
"use strict"
;
constructor
()
{
constructor
()
{
/** Coordinate container that occupies the whole page **/
/** Coordinate container that occupies the whole page **/
this
.
A4
=
new
Div
(
this
.
A4
=
new
Div
(
new
Vector
(
0
,
0
),
new
Vector
(
0
,
0
),
new
Vector
(
595
,
842
)
new
Vector
(
595
,
842
)
);
);
this
.
containerSize
=
86
;
this
.
containerSize
=
86
;
this
.
font
=
{
"font"
:
"courier"
,
"type"
:
"normal"
,
"size"
:
10
};
}
}
...
@@ -47,12 +52,12 @@ class PDF1 {
...
@@ -47,12 +52,12 @@ class PDF1 {
const
header
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
3
)));
const
header
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
3
)));
header
.
addRelativeChildren
([
header
.
addRelativeChildren
([
new
Text
(
"Dominio: "
+
data
[
'dominio'
],
new
Vector
(
Pos
.
beg_margin
,
Pos
.
two_thirds
)),
new
Text
(
"Dominio: "
+
data
[
'dominio'
],
new
Vector
(
Pos
.
beg_margin
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
"Fecha: "
+
data
[
'fecha'
],
new
Vector
(
Pos
.
third
,
Pos
.
two_thirds
))
new
Text
(
"Fecha: "
+
data
[
'fecha'
],
new
Vector
(
Pos
.
third
,
Pos
.
two_thirds
)
,
this
.
font
)
]);
]);
return
pointer
.
addxy
(
0
,
3
);
return
pointer
.
addxy
(
0
,
3
);
}
}
alineadorToPDF
(
pointer
,
data
)
{
alineadorToPDF
(
pointer
,
data
)
{
...
@@ -60,11 +65,11 @@ class PDF1 {
...
@@ -60,11 +65,11 @@ class PDF1 {
const
alineador
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
5
)));
const
alineador
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
5
)));
alineador
.
addRelativeChildren
([
alineador
.
addRelativeChildren
([
new
Text
(
"Resultado Pruebas en Banco de Alineador al Paso"
,
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
third
)),
new
Text
(
"Resultado Pruebas en Banco de Alineador al Paso"
,
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
third
)
,
this
.
font
),
new
Text
(
"Eje Delantero"
,
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
two_thirds
)),
new
Text
(
"Eje Delantero"
,
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
data
[
'eje_delan'
],
new
Vector
(
Pos
.
quarter
,
Pos
.
two_thirds
))
new
Text
(
data
[
'eje_delan'
],
new
Vector
(
Pos
.
quarter
,
Pos
.
two_thirds
)
,
this
.
font
)
]);
]);
return
pointer
.
addxy
(
0
,
5
);
return
pointer
.
addxy
(
0
,
5
);
...
@@ -82,34 +87,34 @@ class PDF1 {
...
@@ -82,34 +87,34 @@ class PDF1 {
]);
]);
const
table
=
(
container
,
eje
,
RI
,
peso
,
RD
)
=>
{
const
table
=
(
container
,
eje
,
RI
,
peso
,
RD
)
=>
{
container
.
addRelativeChildren
([
container
.
addRelativeChildren
([
new
Text
(
`Resultado Pruebas en Banco de Suspensión - Eje
${
eje
}
`
,
new
Vector
(
0
,
Pos
.
third
)),
new
Text
(
`Resultado Pruebas en Banco de Suspensión - Eje
${
eje
}
`
,
new
Vector
(
0
,
Pos
.
third
,
),
this
.
font
),
new
Text
(
"Rendimiento Izquierdo"
,
new
Vector
(
Pos
.
beg
,
Pos
.
two_thirds
)),
new
Text
(
"Rendimiento Izquierdo"
,
new
Vector
(
Pos
.
beg
,
Pos
.
two_thirds
),
this
.
font
),
new
Text
(
RI
,
new
Vector
(
Pos
.
beg
+
10
,
Pos
.
end
,
),
this
.
font
),
new
Text
(
RI
,
new
Vector
(
Pos
.
beg
+
10
,
Pos
.
end
)),
new
Text
(
"Peso Total del Eje"
,
new
Vector
(
Pos
.
middle
-
10
,
Pos
.
two_thirds
),
this
.
font
),
new
Text
(
"Peso Total del Eje"
,
new
Vector
(
Pos
.
middle
-
10
,
Pos
.
two_thirds
)),
new
Text
(
peso
,
new
Vector
(
Pos
.
middle
-
3
,
Pos
.
end
)),
new
Text
(
peso
,
new
Vector
(
Pos
.
middle
-
3
,
Pos
.
end
),
this
.
font
),
new
Text
(
"Rendimiento Derecho"
,
new
Vector
(
Pos
.
three_quarters
-
5
,
Pos
.
two_thirds
)),
new
Text
(
RD
,
new
Vector
(
Pos
.
three_quarters
+
5
,
Pos
.
end
))
new
Text
(
"Rendimiento Derecho"
,
new
Vector
(
Pos
.
three_quarters
-
5
,
Pos
.
two_thirds
),
this
.
font
),
new
Text
(
RD
,
new
Vector
(
Pos
.
three_quarters
+
5
,
Pos
.
end
),
this
.
font
)
]);
]);
};
};
for
(
let
i
=
0
;
i
<
ejes
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
ejes
.
length
;
i
++
)
{
const
x
=
data
[
i
];
const
x
=
data
[
i
];
table
(
ejes
[
i
],
i
-
1
,
x
[
"ren_izq"
],
x
[
"peso"
],
x
[
"ren_der"
])
table
(
ejes
[
i
],
i
-
1
,
x
[
"ren_izq"
],
x
[
"peso"
],
x
[
"ren_der"
])
}
}
return
pointer
.
addxy
(
0
,
15
);
return
pointer
.
addxy
(
0
,
15
);
}
}
frenosToPDF
(
pointer
,
data
)
{
frenosToPDF
(
pointer
,
data
)
{
const
frenos
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
60
)));
const
frenos
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
60
)));
const
divsize
=
new
Vector
(
this
.
containerSize
,
Pos
.
quarter
);
const
divsize
=
new
Vector
(
this
.
containerSize
,
Pos
.
quarter
);
...
@@ -124,62 +129,62 @@ class PDF1 {
...
@@ -124,62 +129,62 @@ class PDF1 {
const
table
=
(
container
,
eje
,
FI
,
RI
,
OI
,
peso
,
FD
,
RD
,
OD
)
=>
{
const
table
=
(
container
,
eje
,
FI
,
RI
,
OI
,
peso
,
FD
,
RD
,
OD
)
=>
{
container
.
addRelativeChildren
([
container
.
addRelativeChildren
([
new
Text
(
`Diagnóstico de Frenos - Eje
${
eje
}
`
,
new
Vector
(
Pos
.
beg
,
Pos
.
beg_margin
+
10
)),
new
Text
(
`Diagnóstico de Frenos - Eje
${
eje
}
`
,
new
Vector
(
Pos
.
beg
,
Pos
.
beg_margin
+
10
),
this
.
font
),
new
Text
(
"Fuerza IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
quarter
),
this
.
font
),
new
Text
(
FI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
quarter
+
10
),
this
.
font
),
new
Text
(
"Res.Rodadura IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
middle
),
this
.
font
),
new
Text
(
RI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
middle
+
10
),
this
.
font
),
new
Text
(
"Fuerza IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
quarter
)),
new
Text
(
"Ovalidad IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
three_quarters
),
this
.
font
),
new
Text
(
FI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
quarter
+
10
)),
new
Text
(
"Res.Rodadura IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
middle
)),
new
Text
(
RI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
middle
+
10
)),
new
Text
(
"Ovalidad IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
three_quarters
)),
new
Text
(
OI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
three_quarters
+
10
)),
new
Text
(
"Peso del Eje"
,
new
Vector
(
Pos
.
middle
-
10
,
Pos
.
quarter
)),
new
Text
(
peso
,
new
Vector
(
Pos
.
middle
-
5
,
Pos
.
quarter
+
10
)),
new
Text
(
"Fuerza DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
quarter
)
),
new
Text
(
OI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
three_quarters
+
10
),
this
.
font
),
new
Text
(
FD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
quarter
+
10
)
),
new
Text
(
"Peso del Eje"
,
new
Vector
(
Pos
.
middle
-
10
,
Pos
.
quarter
),
this
.
font
),
new
Text
(
"Res.Rodadura DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
middle
)
),
new
Text
(
peso
,
new
Vector
(
Pos
.
middle
-
5
,
Pos
.
quarter
+
10
),
this
.
font
),
new
Text
(
RD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
middle
+
10
)
),
new
Text
(
"Fuerza DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
quarter
),
this
.
font
),
new
Text
(
"Ovalidad DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
three_quarters
)
),
new
Text
(
FD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
quarter
+
10
),
this
.
font
),
new
Text
(
OD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
three_quarters
+
10
))
new
Text
(
"Res.Rodadura DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
middle
),
this
.
font
),
new
Text
(
RD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
middle
+
10
),
this
.
font
),
new
Text
(
"Ovalidad DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
three_quarters
),
this
.
font
),
new
Text
(
OD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
three_quarters
+
10
),
this
.
font
)
]);
]);
};
};
for
(
let
i
=
0
;
i
<
ejes
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
ejes
.
length
;
i
++
)
{
const
x
=
data
[
i
];
const
x
=
data
[
i
];
table
(
ejes
[
i
],
i
-
1
,
x
[
"f_izq"
],
x
[
"res_izq"
],
x
[
"ov_izq"
],
x
[
"peso"
],
x
[
"f_der"
],
x
[
"res_der"
],
x
[
"ov_der"
]);
table
(
ejes
[
i
],
i
-
1
,
x
[
"f_izq"
],
x
[
"res_izq"
],
x
[
"ov_izq"
],
x
[
"peso"
],
x
[
"f_der"
],
x
[
"res_der"
],
x
[
"ov_der"
]);
}
}
return
pointer
.
addxy
(
0
,
60
);
return
pointer
.
addxy
(
0
,
60
);
}
}
traseroToPDF
(
pointer
,
data
)
{
traseroToPDF
(
pointer
,
data
)
{
const
trasero
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
.
addxy
(
Pos
.
beg_margin
+
2
,
0
),
new
Vector
(
this
.
containerSize
,
9
)));
const
trasero
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
.
addxy
(
Pos
.
beg_margin
+
2
,
0
),
new
Vector
(
this
.
containerSize
,
9
)));
trasero
.
addRelativeChildren
([
trasero
.
addRelativeChildren
([
new
Text
(
"Diagnóstico de Frenos - Eje Trasero - Frenos de Mano"
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
)
),
new
Text
(
"Diagnóstico de Frenos - Eje Trasero - Frenos de Mano"
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
,
),
this
.
font
),
new
Text
(
"Fuerza IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
two_thirds
)),
new
Text
(
"Fuerza IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
data
[
'f_izq'
],
new
Vector
(
Pos
.
beg_margin
,
Pos
.
end
)),
new
Text
(
data
[
'f_izq'
],
new
Vector
(
Pos
.
beg_margin
,
Pos
.
end
)
,
this
.
font
),
new
Text
(
"Fuerza DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
two_thirds
)),
new
Text
(
"Fuerza DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
data
[
'f_der'
],
new
Vector
(
Pos
.
three_quarters
,
Pos
.
end
)),
new
Text
(
data
[
'f_der'
],
new
Vector
(
Pos
.
three_quarters
,
Pos
.
end
)
,
this
.
font
),
]);
]);
...
@@ -187,19 +192,19 @@ class PDF1 {
...
@@ -187,19 +192,19 @@ class PDF1 {
}
}
gaseshumosToPDF
(
pointer
,
data
)
{
gaseshumosToPDF
(
pointer
,
data
)
{
const
gaseshumos
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
.
addxy
(
Pos
.
beg_margin
+
2
,
0
),
new
Vector
(
this
.
containerSize
,
9
)));
const
gaseshumos
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
.
addxy
(
Pos
.
beg_margin
+
2
,
0
),
new
Vector
(
this
.
containerSize
,
9
)));
gaseshumos
.
addRelativeChildren
([
gaseshumos
.
addRelativeChildren
([
new
Text
(
"Resultado Analizador de Gases"
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
)),
new
Text
(
"Resultado Analizador de Gases"
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
)
,
this
.
font
),
new
Text
(
"Resultado Analizador de Humos"
,
new
Vector
(
Pos
.
two_thirds
,
Pos
.
third
)),
new
Text
(
"Resultado Analizador de Humos"
,
new
Vector
(
Pos
.
two_thirds
,
Pos
.
third
)
,
this
.
font
),
new
Text
(
`CO
${
data
[
'co'
]}
% HC
${
data
[
'hc'
]}
ppm`
,
new
Vector
(
Pos
.
beg
,
Pos
.
two_thirds
)),
new
Text
(
`CO
${
data
[
'co'
]}
% HC
${
data
[
'hc'
]}
ppm`
,
new
Vector
(
Pos
.
beg
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
`Medición
${
data
[
'med'
]}
`
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
two_thirds
))
new
Text
(
`Medición
${
data
[
'med'
]}
`
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
two_thirds
)
,
this
.
font
)
]);
]);
return
pointer
.
addxy
(
0
,
9
);
return
pointer
.
addxy
(
0
,
9
);
...
...
static/src/pdf2.js
View file @
e584f4b
class
PDF
2
{
class
PDF
1
{
"use strict"
;
"use strict"
;
...
@@ -11,6 +11,11 @@ class PDF2 {
...
@@ -11,6 +11,11 @@ class PDF2 {
);
);
this
.
containerSize
=
86
;
this
.
containerSize
=
86
;
this
.
font
=
{
"font"
:
"courier"
,
"type"
:
"normal"
,
"size"
:
10
};
}
}
...
@@ -22,6 +27,7 @@ class PDF2 {
...
@@ -22,6 +27,7 @@ class PDF2 {
*/
*/
const
pdfthis
=
this
;
const
pdfthis
=
this
;
const
functionMapping
=
[
const
functionMapping
=
[
(
pointer
,
data
)
=>
pdfthis
.
maha
(
pointer
,
data
[
'header'
]),
(
pointer
,
data
)
=>
pdfthis
.
headerToPDF
(
pointer
,
data
[
'header'
]),
(
pointer
,
data
)
=>
pdfthis
.
headerToPDF
(
pointer
,
data
[
'header'
]),
(
pointer
,
data
)
=>
pdfthis
.
alineadorToPDF
(
pointer
,
data
[
'alineador'
]),
(
pointer
,
data
)
=>
pdfthis
.
alineadorToPDF
(
pointer
,
data
[
'alineador'
]),
(
pointer
,
data
)
=>
pdfthis
.
suspensionToPDF
(
pointer
,
data
[
'suspension'
]),
(
pointer
,
data
)
=>
pdfthis
.
suspensionToPDF
(
pointer
,
data
[
'suspension'
]),
...
@@ -47,9 +53,9 @@ class PDF2 {
...
@@ -47,9 +53,9 @@ class PDF2 {
const
header
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
3
)));
const
header
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
3
)));
header
.
addRelativeChildren
([
header
.
addRelativeChildren
([
new
Text
(
"Dominio: "
+
data
[
'dominio'
],
new
Vector
(
Pos
.
beg_margin
,
Pos
.
two_thirds
)),
new
Text
(
"Dominio: "
+
data
[
'dominio'
],
new
Vector
(
Pos
.
beg_margin
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
"Fecha: "
+
data
[
'fecha'
],
new
Vector
(
Pos
.
third
,
Pos
.
two_thirds
))
new
Text
(
"Fecha: "
+
data
[
'fecha'
],
new
Vector
(
Pos
.
third
,
Pos
.
two_thirds
)
,
this
.
font
)
]);
]);
return
pointer
.
addxy
(
0
,
3
);
return
pointer
.
addxy
(
0
,
3
);
...
@@ -60,11 +66,11 @@ class PDF2 {
...
@@ -60,11 +66,11 @@ class PDF2 {
const
alineador
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
5
)));
const
alineador
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
5
)));
alineador
.
addRelativeChildren
([
alineador
.
addRelativeChildren
([
new
Text
(
"Resultado Pruebas en Banco de Alineador al Paso"
,
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
third
)),
new
Text
(
"Resultado Pruebas en Banco de Alineador al Paso"
,
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
third
)
,
this
.
font
),
new
Text
(
"Eje Delantero"
,
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
two_thirds
)),
new
Text
(
"Eje Delantero"
,
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
data
[
'eje_delan'
],
new
Vector
(
Pos
.
quarter
,
Pos
.
two_thirds
))
new
Text
(
data
[
'eje_delan'
],
new
Vector
(
Pos
.
quarter
,
Pos
.
two_thirds
)
,
this
.
font
)
]);
]);
return
pointer
.
addxy
(
0
,
5
);
return
pointer
.
addxy
(
0
,
5
);
...
@@ -84,19 +90,19 @@ class PDF2 {
...
@@ -84,19 +90,19 @@ class PDF2 {
const
table
=
(
container
,
eje
,
RI
,
peso
,
RD
)
=>
{
const
table
=
(
container
,
eje
,
RI
,
peso
,
RD
)
=>
{
container
.
addRelativeChildren
([
container
.
addRelativeChildren
([
new
Text
(
`Resultado Pruebas en Banco de Suspensión - Eje
${
eje
}
`
,
new
Vector
(
0
,
Pos
.
third
)
),
new
Text
(
`Resultado Pruebas en Banco de Suspensión - Eje
${
eje
}
`
,
new
Vector
(
0
,
Pos
.
third
,
),
this
.
font
),
new
Text
(
"Rendimiento Izquierdo"
,
new
Vector
(
Pos
.
beg
,
Pos
.
two_thirds
)),
new
Text
(
"Rendimiento Izquierdo"
,
new
Vector
(
Pos
.
beg
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
RI
,
new
Vector
(
Pos
.
beg
+
10
,
Pos
.
end
)
),
new
Text
(
RI
,
new
Vector
(
Pos
.
beg
+
10
,
Pos
.
end
,
),
this
.
font
),
new
Text
(
"Peso Total del Eje"
,
new
Vector
(
Pos
.
middle
-
10
,
Pos
.
two_thirds
)),
new
Text
(
"Peso Total del Eje"
,
new
Vector
(
Pos
.
middle
-
10
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
peso
,
new
Vector
(
Pos
.
middle
-
3
,
Pos
.
end
)),
new
Text
(
peso
,
new
Vector
(
Pos
.
middle
-
3
,
Pos
.
end
)
,
this
.
font
),
new
Text
(
"Rendimiento Derecho"
,
new
Vector
(
Pos
.
three_quarters
-
5
,
Pos
.
two_thirds
)),
new
Text
(
"Rendimiento Derecho"
,
new
Vector
(
Pos
.
three_quarters
-
5
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
RD
,
new
Vector
(
Pos
.
three_quarters
+
5
,
Pos
.
end
))
new
Text
(
RD
,
new
Vector
(
Pos
.
three_quarters
+
5
,
Pos
.
end
)
,
this
.
font
)
]);
]);
};
};
...
@@ -114,45 +120,45 @@ class PDF2 {
...
@@ -114,45 +120,45 @@ class PDF2 {
const
divsize
=
new
Vector
(
this
.
containerSize
,
Pos
.
quarter
);
const
divsize
=
new
Vector
(
this
.
containerSize
,
Pos
.
quarter
);
const
ejes
=
frenos
.
addRelativeChildren
(
const
ejes
=
frenos
.
addRelativeChildren
(
[
new
Div
(
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
beg
),
divsize
),
new
Div
(
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
beg
),
divsize
),
new
Div
(
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
quarter
),
divsize
),
new
Div
(
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
quarter
),
divsize
),
new
Div
(
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
middle
),
divsize
),
new
Div
(
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
middle
),
divsize
),
new
Div
(
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
three_quarters
),
divsize
)
new
Div
(
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
three_quarters
),
divsize
)
)
]);
const
table
=
(
container
,
eje
,
FI
,
RI
,
OI
,
peso
,
FD
,
RD
,
OD
)
=>
{
const
table
=
(
container
,
eje
,
FI
,
RI
,
OI
,
peso
,
FD
,
RD
,
OD
)
=>
{
container
.
addRelativeChildren
([
container
.
addRelativeChildren
([
new
Text
(
`Diagnóstico de Frenos - Eje
${
eje
}
`
,
new
Vector
(
Pos
.
beg
,
Pos
.
beg_margin
+
10
)),
new
Text
(
`Diagnóstico de Frenos - Eje
${
eje
}
`
,
new
Vector
(
Pos
.
beg
,
Pos
.
beg_margin
+
10
)
,
this
.
font
),
new
Text
(
"Fuerza IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
quarter
)),
new
Text
(
"Fuerza IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
quarter
)
,
this
.
font
),
new
Text
(
FI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
quarter
+
10
)),
new
Text
(
FI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
quarter
+
10
)
,
this
.
font
),
new
Text
(
"Res.Rodadura IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
middle
)),
new
Text
(
"Res.Rodadura IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
middle
)
,
this
.
font
),
new
Text
(
RI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
middle
+
10
)),
new
Text
(
RI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
middle
+
10
)
,
this
.
font
),
new
Text
(
"Ovalidad IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
three_quarters
)),
new
Text
(
"Ovalidad IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
three_quarters
)
,
this
.
font
),
new
Text
(
OI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
three_quarters
+
10
)),
new
Text
(
OI
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
three_quarters
+
10
)
,
this
.
font
),
new
Text
(
"Peso del Eje"
,
new
Vector
(
Pos
.
middle
-
10
,
Pos
.
quarter
)),
new
Text
(
"Peso del Eje"
,
new
Vector
(
Pos
.
middle
-
10
,
Pos
.
quarter
)
,
this
.
font
),
new
Text
(
peso
,
new
Vector
(
Pos
.
middle
-
5
,
Pos
.
quarter
+
10
)),
new
Text
(
peso
,
new
Vector
(
Pos
.
middle
-
5
,
Pos
.
quarter
+
10
)
,
this
.
font
),
new
Text
(
"Fuerza DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
quarter
)),
new
Text
(
"Fuerza DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
quarter
)
,
this
.
font
),
new
Text
(
FD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
quarter
+
10
)),
new
Text
(
FD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
quarter
+
10
)
,
this
.
font
),
new
Text
(
"Res.Rodadura DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
middle
)),
new
Text
(
"Res.Rodadura DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
middle
)
,
this
.
font
),
new
Text
(
RD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
middle
+
10
)),
new
Text
(
RD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
middle
+
10
)
,
this
.
font
),
new
Text
(
"Ovalidad DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
three_quarters
)),
new
Text
(
"Ovalidad DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
three_quarters
)
,
this
.
font
),
new
Text
(
OD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
three_quarters
+
10
))
new
Text
(
OD
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
three_quarters
+
10
)
,
this
.
font
)
]);
]);
};
};
...
@@ -171,15 +177,15 @@ class PDF2 {
...
@@ -171,15 +177,15 @@ class PDF2 {
trasero
.
addRelativeChildren
([
trasero
.
addRelativeChildren
([
new
Text
(
"Diagnóstico de Frenos - Eje Trasero - Frenos de Mano"
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
)
),
new
Text
(
"Diagnóstico de Frenos - Eje Trasero - Frenos de Mano"
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
,
),
this
.
font
),
new
Text
(
"Fuerza IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
two_thirds
)),
new
Text
(
"Fuerza IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
data
[
'f_izq'
],
new
Vector
(
Pos
.
beg_margin
,
Pos
.
end
)),
new
Text
(
data
[
'f_izq'
],
new
Vector
(
Pos
.
beg_margin
,
Pos
.
end
)
,
this
.
font
),
new
Text
(
"Fuerza DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
two_thirds
)),
new
Text
(
"Fuerza DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
data
[
'f_der'
],
new
Vector
(
Pos
.
three_quarters
,
Pos
.
end
)),
new
Text
(
data
[
'f_der'
],
new
Vector
(
Pos
.
three_quarters
,
Pos
.
end
)
,
this
.
font
),
]);
]);
...
@@ -192,13 +198,13 @@ class PDF2 {
...
@@ -192,13 +198,13 @@ class PDF2 {
gaseshumos
.
addRelativeChildren
([
gaseshumos
.
addRelativeChildren
([
new
Text
(
"Resultado Analizador de Gases"
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
)),
new
Text
(
"Resultado Analizador de Gases"
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
)
,
this
.
font
),
new
Text
(
"Resultado Analizador de Humos"
,
new
Vector
(
Pos
.
two_thirds
,
Pos
.
third
)),
new
Text
(
"Resultado Analizador de Humos"
,
new
Vector
(
Pos
.
two_thirds
,
Pos
.
third
)
,
this
.
font
),
new
Text
(
`CO
${
data
[
'co'
]}
% HC
${
data
[
'hc'
]}
ppm`
,
new
Vector
(
Pos
.
beg
,
Pos
.
two_thirds
)),
new
Text
(
`CO
${
data
[
'co'
]}
% HC
${
data
[
'hc'
]}
ppm`
,
new
Vector
(
Pos
.
beg
,
Pos
.
two_thirds
)
,
this
.
font
),
new
Text
(
`Medición
${
data
[
'med'
]}
`
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
two_thirds
))
new
Text
(
`Medición
${
data
[
'med'
]}
`
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
two_thirds
)
,
this
.
font
)
]);
]);
...
...
templates/resultados.html
View file @
e584f4b
...
@@ -16,13 +16,25 @@
...
@@ -16,13 +16,25 @@
<body>
<body>
<div
class=
"PDFButtonContainer"
>
<div
class=
"PDFButtonContainer"
>
<button
class=
"PDFButton"
onclick=
<button
class=
"PDFButton"
onclick=
"window.open(compile((new PDF1()).pdf( {{ data }} ), new jsPDF('portrait', 'pt', 'a4')).output('bloburl'))"
;
"window.open(
compile(
(new PDF1()).pdf( {{ data }} ),
new jsPDF('portrait', 'pt', 'a4'),
)
.output('bloburl')
)"
;
>
>
Convertir a PDF - 1
Convertir a PDF - 1
</button>
</button>
<button
class=
"PDFButton"
onclick=
<button
class=
"PDFButton"
onclick=
"window.open(compile((new PDF2()).pdf( {{ data }} ), new jsPDF('portrait', 'pt', 'a4')).output('bloburl'))"
;
"window.open(
compile(
(new PDF1()).pdf( {{ data }} ),
new jsPDF('portrait', 'pt', 'a4'),
)
.output('bloburl')
)"
;
>
>
Convertir a PDF - 2
Convertir a PDF - 2
</button>
</button>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment