Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
trismegisto-planilla
Overview
Overview
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Luis Gangas
trismegisto-planilla
Commits
fa40177f
Commit
fa40177f
authored
Nov 22, 2018
by
Luis Gangas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD] agregado de pdfcreator
parent
b2fb3515
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
6 deletions
+32
-6
PdfCreator.java
src/java/trismegistoplanilla/utilities/PdfCreator.java
+32
-6
No files found.
src/java/trismegistoplanilla/utilities/PdfCreator.java
View file @
fa40177f
...
...
@@ -5,6 +5,8 @@
*/
package
trismegistoplanilla
.
utilities
;
import
com.itextpdf.text.Anchor
;
import
com.itextpdf.text.Chunk
;
import
com.itextpdf.text.Document
;
import
com.itextpdf.text.DocumentException
;
import
com.itextpdf.text.Element
;
...
...
@@ -81,7 +83,19 @@ public class PdfCreator {
.
replace
(
"@distritoFirma"
,
distrito
)
.
replace
(
"@ruc"
,
ruc
);
documento
.
add
(
new
Paragraph
(
lineas
));
Phrase
phrase
=
new
Phrase
();
Paragraph
paragraph
=
new
Paragraph
();
Font
underlineFont
=
new
Font
(
Font
.
FontFamily
.
HELVETICA
,
15
,
Font
.
UNDERLINE
);
Font
paragraphFont
=
new
Font
(
Font
.
FontFamily
.
TIMES_ROMAN
,
8
,
Font
.
NORMAL
);
Chunk
underlineChunk
=
new
Chunk
(
"CONTRATO DE TRABAJO POR NECESIDADES DEL MERCADO"
,
underlineFont
);
phrase
.
add
(
underlineChunk
);
paragraph
.
add
(
phrase
);
paragraph
.
setAlignment
(
Element
.
ALIGN_CENTER
);
documento
.
add
(
paragraph
);
documento
.
add
(
Chunk
.
NEWLINE
);
documento
.
add
(
Chunk
.
NEWLINE
);
documento
.
add
(
new
Paragraph
(
lineas
,
paragraphFont
));
documento
.
close
();
}
...
...
@@ -92,7 +106,7 @@ public class PdfCreator {
public
static
boolean
crearPdfContratoTiempoParcial
(
JSONObject
json
)
throws
IOException
,
DocumentException
{
boolean
respuesta
=
false
;
Document
documento
=
new
Document
(
PageSize
.
A4
.
rotate
(),
5
,
5
,
5
,
5
);
Document
documento
=
new
Document
(
PageSize
.
A4
.
rotate
(),
100
,
100
,
30
,
30
);
// PdfWriter writer = PdfWriter.getInstance(documento, response.getOutputStream());
PdfWriter
.
getInstance
(
documento
,
new
FileOutputStream
(
"D:\\contratoPDF.pdf"
));
// MyFooter event = new MyFooter();
...
...
@@ -116,9 +130,7 @@ public class PdfCreator {
List
<
String
>
template
=
getTemplateContrato
(
2
);
String
lineas
=
""
;
for
(
String
linea
:
template
)
{
lineas
+=
linea
;
}
lineas
=
template
.
stream
().
map
((
linea
)
->
linea
).
reduce
(
lineas
,
String:
:
concat
);
lineas
=
lineas
.
replace
(
"@br"
,
"\n"
)
...
...
@@ -130,7 +142,21 @@ public class PdfCreator {
.
replace
(
"@distritoFirma"
,
distrito
)
.
replace
(
"@ruc"
,
ruc
);
documento
.
add
(
new
Paragraph
(
lineas
));
Phrase
phrase
=
new
Phrase
();
Paragraph
paragraph
=
new
Paragraph
();
Font
underlineFont
=
new
Font
(
Font
.
FontFamily
.
HELVETICA
,
15
,
Font
.
UNDERLINE
);
Font
paragraphFont
=
new
Font
(
Font
.
FontFamily
.
TIMES_ROMAN
,
8
,
Font
.
NORMAL
);
Chunk
underlineChunk
=
new
Chunk
(
"CONTRATO DE TRABAJO EN REGIMEN DE TIEMPO PARCIAL"
,
underlineFont
);
phrase
.
add
(
underlineChunk
);
paragraph
.
add
(
phrase
);
paragraph
.
setAlignment
(
Element
.
ALIGN_CENTER
);
documento
.
add
(
paragraph
);
documento
.
add
(
Chunk
.
NEWLINE
);
documento
.
add
(
Chunk
.
NEWLINE
);
documento
.
add
(
new
Paragraph
(
lineas
,
paragraphFont
));
documento
.
close
();
}
...
...
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