Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
d4a09b55
Commit
d4a09b55
authored
Mar 05, 2019
by
Irving David
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab.geoint.mx/mario.chirinos/GeoInt_SIDT
into dev
parents
18b1cb61
6b471990
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
146 deletions
+6
-146
reportPdf.js
reports/static/reports/js/reportPdf.js
+6
-5
reportePdf.js
reports/static/reports/js/reportePdf.js
+0
-141
No files found.
reports/static/reports/js/reportPdf.js
View file @
d4a09b55
...
...
@@ -25,12 +25,12 @@ function imageInfo(pdf) {
let
offset_inc_y
=
40
;
let
imgHeigth
=
160.5
;
let
imgWidth
=
145.5
;
let
imgNumber
=
0
;
activePoints
.
forEach
(
function
(
value
,
index
)
{
console
.
log
(
"img"
,
activePoints
.
length
,
value
);
let
logo
=
new
Image
();
logo
.
src
=
"../../static/reports/tmpImages/repsat_test_dev/"
+
image_path
+
value
+
"_TCI_60m.jpg"
logo
.
addEventListener
(
'load'
,
function
()
{
if
(
position_x
+
20
>
pdfWidth
-
100
)
{
position_x
=
0
;
position_y
+=
imgHeigth
+
offset_inc_y
;
...
...
@@ -50,12 +50,13 @@ function imageInfo(pdf) {
//pdf.text(coordinate_x + 110, coordinate_y + imgHeigth + 12, value,'center');
position_x
+=
imgWidth
+
offset_inc_x
if
(
i
ndex
==
activePoints
.
length
-
1
)
{
if
(
i
mgNumber
==
activePoints
.
length
-
1
)
{
// download the pdf
headerFooterFormatting
(
pdf
,
pdf
.
internal
.
getNumberOfPages
());
window
.
open
(
pdf
.
output
(
'bloburl'
),
'_blank'
);
//pdf.save('{{ zone }}.pdf');
}
imgNumber
++
;
});
});
}
...
...
@@ -77,7 +78,7 @@ function graphInfo(pdf) {
var
pdfctxX
=
0
;
var
pdfctxY
=
0
;
var
buffer
=
100
;
// for each chart.js chart
$
(
"canvas"
).
each
(
function
(
index
)
{
// obtener medidas height/width
...
...
@@ -92,7 +93,7 @@ function graphInfo(pdf) {
if
(
index
%
2
===
1
)
{
pdfctxX
=
0
;
pdfctxY
+=
canvasHeight
+
buffer
;
}
}
});
pdf
.
setFontSize
(
18
);
pdf
.
setTextColor
(
34
,
45
,
50
);
...
...
reports/static/reports/js/reportePdf.js
deleted
100644 → 0
View file @
18b1cb61
var
pdfWidth
=
612
;
var
pdfHeight
=
792
;
function
imageInfo
(
pdf
)
{
pdf
.
setFontSize
(
18
);
pdf
.
setTextColor
(
34
,
45
,
50
);
pdf
.
text
(
70
,
100
,
"IMAGES"
);
let
position_x
=
0
;
let
position_y
=
0
;
let
offset_y
=
120
;
let
offset_x
=
60
;
let
offset_inc_x
=
30
;
let
offset_inc_y
=
40
;
let
imgHeigth
=
160.5
;
let
imgWidth
=
145.5
;
activePoints
.
forEach
(
function
(
value
,
index
)
{
console
.
log
(
"img"
,
activePoints
.
length
,
value
);
let
logo
=
new
Image
();
logo
.
src
=
"../../static/reports/tmpImages/repsat_test_dev/"
+
image_path
+
value
+
"_TCI_60m.jpg"
logo
.
addEventListener
(
'load'
,
function
()
{
if
(
position_x
+
20
>
pdfWidth
-
100
)
{
position_x
=
0
;
position_y
+=
imgHeigth
+
offset_inc_y
;
}
if
(
position_y
+
offset_y
>
pdfHeight
-
(
imgHeigth
+
30
))
{
pdf
.
addPage
();
margin
(
pdf
)
position_y
=
0
;
}
let
coordinate_x
=
offset_x
+
position_x
let
coordinate_y
=
offset_y
+
position_y
pdf
.
addImage
(
logo
,
'PNG'
,
coordinate_x
,
coordinate_y
,
imgWidth
,
imgHeigth
);
pdf
.
setFontSize
(
11
);
pdf
.
setTextColor
(
105
,
105
,
105
);
pdf
.
text
(
coordinate_x
+
72
,
coordinate_y
+
imgHeigth
+
11
,
value
,
'center'
);
//pdf.text(coordinate_x + 110, coordinate_y + imgHeigth + 12, value,'center');
position_x
+=
imgWidth
+
offset_inc_x
if
(
index
==
activePoints
.
length
-
1
)
{
// download the pdf
headerFooterFormatting
(
pdf
,
pdf
.
internal
.
getNumberOfPages
());
window
.
open
(
pdf
.
output
(
'bloburl'
),
'_blank'
);
//pdf.save('{{ zone }}.pdf');
}
});
});
}
function
graphInfo
(
pdf
)
{
// tomar el tamaño de la pagina
var
reportPageHeight
=
$
(
'#reportPage'
).
innerHeight
();
var
reportPageWidth
=
$
(
'#reportPage'
).
innerWidth
();
// que rellenaremos con todos los demás canvas
var
pdfCanvas
=
$
(
'<canvas />'
).
attr
({
id
:
"canvaspdf"
,
width
:
reportPageWidth
,
height
:
reportPageHeight
});
// mantener la posicion del canvas
var
pdfctx
=
$
(
pdfCanvas
)[
0
].
getContext
(
'2d'
);
var
pdfctxX
=
0
;
var
pdfctxY
=
0
;
var
buffer
=
100
;
// for each chart.js chart
$
(
"canvas"
).
each
(
function
(
index
)
{
// obtener medidas height/width
var
canvasHeight
=
$
(
this
).
innerHeight
();
var
canvasWidth
=
$
(
this
).
innerWidth
();
// dibujar en el nuevo canvas
pdfctx
.
drawImage
(
$
(
this
)[
0
],
pdfctxX
,
pdfctxY
,
canvasWidth
/
1.4
,
canvasHeight
/
1.4
);
pdfctxX
+=
canvasWidth
+
buffer
;
// our report page is in a grid pattern so replicate that in the new canvas
if
(
index
%
2
===
1
)
{
pdfctxX
=
0
;
pdfctxY
+=
canvasHeight
+
buffer
;
}
});
pdf
.
setFontSize
(
18
);
pdf
.
setTextColor
(
34
,
45
,
50
);
pdf
.
text
(
70
,
(
pdfHeight
/
2
)
-
20
,
"GRAPH"
);
pdf
.
addImage
(
$
(
pdfCanvas
)[
0
],
'PNG'
,
30
,
pdfHeight
/
2
);
}
function
margin
(
pdf
)
{
pdf
.
setLineWidth
(
1
)
pdf
.
setDrawColor
(
255
,
111
,
0
);
pdf
.
setFillColor
(
255
,
255
,
255
);
pdf
.
roundedRect
(
20
,
20
,
pdfWidth
-
40
,
pdfHeight
-
40
,
5
,
5
,
'FD'
)
}
function
searchInfo
(
pdf
)
{
pdf
.
setFontSize
(
15
);
pdf
.
setTextColor
(
150
);
pdf
.
setDrawColor
(
0
);
pdf
.
setFillColor
(
0
,
0
,
255
);
pdf
.
roundedRect
(
40
,
100
,
pdfWidth
-
80
,
150
,
5
,
5
,
'FD'
)
pdf
.
setDrawColor
(
0
);
pdf
.
setFillColor
(
255
,
255
,
255
);
pdf
.
roundedRect
(
42
,
102
,
pdfWidth
-
84
,
146
,
5
,
5
,
'FD'
)
pdf
.
setTextColor
(
34
,
45
,
50
);
pdf
.
text
(
70
,
140
,
"Search Information: "
);
pdf
.
setFontSize
(
12
);
pdf
.
setTextColor
(
105
,
105
,
105
);
pdf
.
text
(
120
,
170
,
"Zone: "
+
zone
);
pdf
.
text
(
120
,
190
,
"Platform: "
+
platform
);
pdf
.
text
(
120
,
210
,
"Product level: "
+
productLevel
);
pdf
.
text
(
340
,
170
,
"Start date: "
+
startDate
);
pdf
.
text
(
340
,
190
,
"End date: "
+
endDate
);
pdf
.
text
(
340
,
210
,
"Clouds: "
+
clouds
);
}
function
headerFooterFormatting
(
pdf
,
totalPages
)
{
for
(
var
i
=
totalPages
;
i
>=
1
;
i
--
)
{
pdf
.
setPage
(
i
);
header
(
pdf
);
footer
(
pdf
,
i
,
totalPages
);
pdf
.
page
++
;
}
};
function
header
(
pdf
)
{
pdf
.
setFontSize
(
30
);
pdf
.
setTextColor
(
40
);
pdf
.
setFontStyle
(
'normal'
);
pdf
.
text
(
250
,
48
,
"RepSat"
);
pdf
.
setLineCap
(
2
);
};
function
footer
(
pdf
,
pageNumber
,
totalPages
)
{
var
str
=
"Page "
+
pageNumber
+
" of "
+
totalPages
pdf
.
setFontSize
(
10
);
pdf
.
text
(
str
,
pdfWidth
-
80
,
pdf
.
internal
.
pageSize
.
height
-
10
);
};
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment