Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PDSLLabs Public
QMSL
PDFGenerator QMSL
Commits
4d45134b
Commit
4d45134b
authored
Jan 07, 2021
by
Sebastian Drenckberg
Browse files
refactor annotations
parent
b20408a8
Pipeline
#386949
passed with stage
in 14 seconds
Changes
21
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
pdf-generator/Controllers/EvaluationReportController.cs
View file @
4d45134b
...
@@ -18,7 +18,7 @@ namespace PDFGenerator.Controllers
...
@@ -18,7 +18,7 @@ namespace PDFGenerator.Controllers
/// <summary>
/// <summary>
/// Say hello!
/// Say hello!
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns>
"Hello"
</returns>
[
HttpGet
(
"Hello"
)]
[
HttpGet
(
"Hello"
)]
public
string
Get
()
public
string
Get
()
{
{
...
@@ -26,10 +26,10 @@ namespace PDFGenerator.Controllers
...
@@ -26,10 +26,10 @@ namespace PDFGenerator.Controllers
}
}
/// <summary>
/// <summary>
/// Generates the PDF report.
/// Generates the PDF
for an evaluation
report.
/// </summary>
/// </summary>
/// <param name="evaluationReport">Evaluation report for which the PDF should be rendered.</param>
/// <param name="evaluationReport">Evaluation report for which the PDF should be rendered.</param>
/// <returns>
the
PDF document as byte array</returns>
/// <returns>PDF document as byte array</returns>
[
HttpPost
(
"RenderReport"
)]
[
HttpPost
(
"RenderReport"
)]
[
RequestSizeLimit
(
100000000
)]
[
RequestSizeLimit
(
100000000
)]
public
byte
[]
RenderReport
([
FromBody
]
PDFGenerator
.
Models
.
EvaluationReport
evaluationReport
)
public
byte
[]
RenderReport
([
FromBody
]
PDFGenerator
.
Models
.
EvaluationReport
evaluationReport
)
...
...
pdf-generator/EvaluationReport/Appendix.cs
View file @
4d45134b
...
@@ -27,9 +27,9 @@ namespace PDFGenerator.EvaluationReport
...
@@ -27,9 +27,9 @@ namespace PDFGenerator.EvaluationReport
}
}
/// <summary>
/// <summary>
/// Includes custom uploads to
the available
attachments.
/// Includes custom uploads to attachments
available
.
/// </summary>
/// </summary>
/// <param name="customUploads">
c
ustom attachments to be added</param>
/// <param name="customUploads">
C
ustom attachments to be added
.
</param>
public
void
UpdateAppendix
(
Dictionary
<
string
,
byte
[
]>
customUploads
)
public
void
UpdateAppendix
(
Dictionary
<
string
,
byte
[
]>
customUploads
)
{
{
foreach
(
KeyValuePair
<
string
,
byte
[
]>
item
in
customUploads
)
foreach
(
KeyValuePair
<
string
,
byte
[
]>
item
in
customUploads
)
...
@@ -72,7 +72,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -72,7 +72,7 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Adds a single attachment to document.
/// Adds a single attachment to document.
/// </summary>
/// </summary>
/// <param name="item">
t
he item composed of an attachment key and content</param>
/// <param name="item">
T
he item composed of an attachment key and content
.
</param>
private
void
AddAttachment
(
KeyValuePair
<
string
,
byte
[
]>
item
)
private
void
AddAttachment
(
KeyValuePair
<
string
,
byte
[
]>
item
)
{
{
PdfReader
attachment
=
new
PdfReader
(
new
MemoryStream
(
item
.
Value
));
PdfReader
attachment
=
new
PdfReader
(
new
MemoryStream
(
item
.
Value
));
...
@@ -82,13 +82,13 @@ namespace PDFGenerator.EvaluationReport
...
@@ -82,13 +82,13 @@ namespace PDFGenerator.EvaluationReport
// avoiding the exception 'PdfReader not opened with owner password' from third party encrypted PDF uploads involves
// avoiding the exception 'PdfReader not opened with owner password' from third party encrypted PDF uploads involves
// manipulating both 'unethicalReading' and 'encrypted' flags from PdfReader
// manipulating both 'unethicalReading' and 'encrypted' flags from PdfReader
//
i
n case the original author of the document defined permissions
, then
these permissions are ignored by setting 'unethicalReading' to true
;
//
I
n case the original author of the document defined permissions these permissions are ignored by setting 'unethicalReading' to true
.
//
t
his is not a problem, as setting such permissions has become obsolete,
because
since PDF became an ISO standard
,
//
T
his is not a problem, as setting such permissions has become obsolete, since PDF became an ISO standard
and
// there is no longer a penalty for removing those permissions
// there is no longer a penalty for removing those permissions
// (refer to https://stackoverflow.com/questions/48064902/itext-7-pdfreader-is-not-opened-with-owner-password-error)
// (refer to https://stackoverflow.com/questions/48064902/itext-7-pdfreader-is-not-opened-with-owner-password-error)
attachment
.
SetUnethicalReading
(
true
);
attachment
.
SetUnethicalReading
(
true
);
//
m
islead iText into thinking that the original PDF file was not encrypted
//
M
islead iText into thinking that the original PDF file was not encrypted
attachment
.
GetType
()
attachment
.
GetType
()
.
GetField
(
"encrypted"
,
BindingFlags
.
NonPublic
|
BindingFlags
.
Instance
)
.
GetField
(
"encrypted"
,
BindingFlags
.
NonPublic
|
BindingFlags
.
Instance
)
.
SetValue
(
attachment
,
false
);
.
SetValue
(
attachment
,
false
);
...
@@ -103,7 +103,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -103,7 +103,7 @@ namespace PDFGenerator.EvaluationReport
SetPageOrientation
(
Orientation
.
Landscape
);
SetPageOrientation
(
Orientation
.
Landscape
);
}
}
// if attachment orientation is portrait
,
but destination pdf is not
// if attachment orientation is portrait but destination pdf is not
else
if
((
attachmentPageSize
.
GetHeight
()
>
attachmentPageSize
.
GetWidth
())
&&
((
int
)
Math
.
Round
(
attachmentPageSize
.
GetHeight
())
>
pageSize
.
GetHeight
()))
else
if
((
attachmentPageSize
.
GetHeight
()
>
attachmentPageSize
.
GetWidth
())
&&
((
int
)
Math
.
Round
(
attachmentPageSize
.
GetHeight
())
>
pageSize
.
GetHeight
()))
{
{
SetPageOrientation
(
Orientation
.
Portrait
);
SetPageOrientation
(
Orientation
.
Portrait
);
...
@@ -120,8 +120,8 @@ namespace PDFGenerator.EvaluationReport
...
@@ -120,8 +120,8 @@ namespace PDFGenerator.EvaluationReport
AddPageBreak
();
AddPageBreak
();
}
}
// table for inserting imported pages
;
// table for inserting imported pages
// true flag:
a
void memory overhead problems from big imported files
// true flag:
A
void memory overhead problems from big imported files
Table
table
=
new
Table
(
1
,
true
)
Table
table
=
new
Table
(
1
,
true
)
.
UseAllAvailableWidth
()
.
UseAllAvailableWidth
()
.
SetDestination
(
item
.
Key
);
.
SetDestination
(
item
.
Key
);
...
@@ -151,12 +151,12 @@ namespace PDFGenerator.EvaluationReport
...
@@ -151,12 +151,12 @@ namespace PDFGenerator.EvaluationReport
table
.
AddCell
(
cell
);
table
.
AddCell
(
cell
);
// flush content of a single page to render part of the table:
cell objects that were rendered
// flush content of a single page to render part of the table:
//
are
made available
to the garbage collector
so that the memory used by those objects can be
release
d
//
memory used be rendered cell objects is
made available to the garbage collector
for
release
table
.
Flush
();
table
.
Flush
();
}
}
// once
added
all the cells
, this
write
s
the remainder of the table that was
n'
t rendered yet
// once all the cells
are added
write the remainder of the table that was
no
t rendered yet
table
.
Complete
();
table
.
Complete
();
source
.
Close
();
source
.
Close
();
...
...
pdf-generator/EvaluationReport/BaseSection.cs
View file @
4d45134b
...
@@ -29,8 +29,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -29,8 +29,7 @@ namespace PDFGenerator.EvaluationReport
Bookmarks
=
bookmarks
;
Bookmarks
=
bookmarks
;
TableOfContents
=
tableOfContents
;
TableOfContents
=
tableOfContents
;
// get the root outline from the PdfDocument: false indicates that
// get root outline from the PdfDocument: false indicates iText does not need to update the outlines.
// iText does not need to update the outlines
RootOutline
=
Document
.
GetPdfDocument
().
GetOutlines
(
false
);
RootOutline
=
Document
.
GetPdfDocument
().
GetOutlines
(
false
);
}
}
...
@@ -42,7 +41,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -42,7 +41,7 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Gets the current page.
/// Gets the current page.
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns>
The current page.
</returns>
protected
int
GetCurrentPage
()
protected
int
GetCurrentPage
()
{
{
return
Document
.
GetPdfDocument
().
GetNumberOfPages
();
return
Document
.
GetPdfDocument
().
GetNumberOfPages
();
...
@@ -51,7 +50,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -51,7 +50,7 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Gets default page size.
/// Gets default page size.
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns>
The default page size.
</returns>
protected
PageSize
GetPageSize
()
protected
PageSize
GetPageSize
()
{
{
return
Document
.
GetPdfDocument
().
GetDefaultPageSize
();
return
Document
.
GetPdfDocument
().
GetDefaultPageSize
();
...
@@ -60,8 +59,8 @@ namespace PDFGenerator.EvaluationReport
...
@@ -60,8 +59,8 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Resizes image to fit page size.
/// Resizes image to fit page size.
/// </summary>
/// </summary>
/// <param name="image">
i
mage to be resized</param>
/// <param name="image">
I
mage to be resized
.
</param>
/// <returns>
t
he resized image</returns>
/// <returns>
T
he resized image
.
</returns>
protected
Image
GetScaledImage
(
Image
image
)
protected
Image
GetScaledImage
(
Image
image
)
{
{
PageSize
pageSize
=
GetPageSize
();
PageSize
pageSize
=
GetPageSize
();
...
@@ -77,12 +76,13 @@ namespace PDFGenerator.EvaluationReport
...
@@ -77,12 +76,13 @@ namespace PDFGenerator.EvaluationReport
}
}
/// <summary>
/// <summary>
/// Adds upload files directly to the document if they are images; uploads consisting of PDF files are
/// Adds upload files directly to the document if they are images.
/// added to the available custom uploads to be rendered as attachments in appendix and links are added to the document referring to them;
/// Uploads consisting of PDF files are added to the available custom uploads to be rendered as attachments in appendix
/// if the custom uploads are neither PDF nor image files, then an exception is triggered.
/// and links are added to the document referring to them instead.
/// If the custom uploads are neither PDF files nor image files an exception is thrown.
/// </summary>
/// </summary>
/// <param name="uploads">
n
ew custom uploads to be considered</param>
/// <param name="uploads">
N
ew custom uploads to be considered
.
</param>
/// <param name="customUploads">
a
lready available custom uploads</param>
/// <param name="customUploads">
A
lready available custom uploads
.
</param>
protected
void
AddCustomUploads
(
CustomUploads
uploads
,
Dictionary
<
string
,
byte
[
]>
customUploads
)
protected
void
AddCustomUploads
(
CustomUploads
uploads
,
Dictionary
<
string
,
byte
[
]>
customUploads
)
{
{
if
(
uploads
.
Files
==
null
)
if
(
uploads
.
Files
==
null
)
...
@@ -99,7 +99,8 @@ namespace PDFGenerator.EvaluationReport
...
@@ -99,7 +99,8 @@ namespace PDFGenerator.EvaluationReport
bool
imagesAvailable
=
false
;
bool
imagesAvailable
=
false
;
foreach
(
KeyValuePair
<
string
,
byte
[
]>
file
in
uploads
.
Files
)
foreach
(
KeyValuePair
<
string
,
byte
[
]>
file
in
uploads
.
Files
)
{
{
// only accept files in image or PDF format, otherwise an exception is triggered below
// only accept files in image or PDF format, otherwise an exception is thrown below
// firstly, check if file is a valid image
// firstly, check if file is a valid image
if
(
ImageDataFactory
.
IsSupportedType
(
file
.
Value
))
if
(
ImageDataFactory
.
IsSupportedType
(
file
.
Value
))
{
{
...
@@ -115,7 +116,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -115,7 +116,7 @@ namespace PDFGenerator.EvaluationReport
continue
;
continue
;
}
}
// secondly, if data does not correspond to a PDF file, an exception is t
riggered
// secondly, if data does not correspond to a PDF file, an exception is t
hrown
new
PdfReader
(
new
MemoryStream
(
file
.
Value
));
new
PdfReader
(
new
MemoryStream
(
file
.
Value
));
if
(!
customUploads
.
ContainsKey
(
file
.
Key
))
if
(!
customUploads
.
ContainsKey
(
file
.
Key
))
...
@@ -145,10 +146,10 @@ namespace PDFGenerator.EvaluationReport
...
@@ -145,10 +146,10 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Adds paragraph above the table.
/// Adds paragraph above the table.
/// </summary>
/// </summary>
/// <param name="table">
t
he table
,
on which the paragraph is added</param>
/// <param name="table">
T
he table on which the paragraph is added
.
</param>
/// <param name="text">
t
he paragra
h
content<
/
param>
/// <param name="text">
T
he paragra
phs
content
.
<param>
/// <param name="header">
f
lag indicat
esm
whether the content is a
hedaer for the table
</param>
/// <param name="header">
F
lag indicat
ing
whether the content is a
table header.
</param>
/// <param name="style">
g
iven style for paragraph</param>
/// <param name="style">
G
iven style for paragraph
.
</param>
protected
void
AddParagraphWithLeadingToTable
(
Table
table
,
string
text
,
bool
header
,
Style
style
=
null
)
protected
void
AddParagraphWithLeadingToTable
(
Table
table
,
string
text
,
bool
header
,
Style
style
=
null
)
{
{
Cell
cell
=
new
Cell
().
SetBorder
(
Border
.
NO_BORDER
);
Cell
cell
=
new
Cell
().
SetBorder
(
Border
.
NO_BORDER
);
...
@@ -173,7 +174,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -173,7 +174,7 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Changes the page orientation.
/// Changes the page orientation.
/// </summary>
/// </summary>
/// <param name="orientation"></param>
/// <param name="orientation">
Orientation to change to.
</param>
protected
void
SetPageOrientation
(
Orientation
orientation
)
protected
void
SetPageOrientation
(
Orientation
orientation
)
{
{
if
(
orientation
==
Orientation
.
Landscape
)
if
(
orientation
==
Orientation
.
Landscape
)
...
@@ -194,11 +195,11 @@ namespace PDFGenerator.EvaluationReport
...
@@ -194,11 +195,11 @@ namespace PDFGenerator.EvaluationReport
}
}
/// <summary>
/// <summary>
/// Prevents the default trim of
existent
leading whitespaces
at
the string
beginning and immediately after a linebreak on iText7,
/// Prevents the default trim of leading whitespaces
in
the string
/// by adding a NULL character ('\u0000')
///
and immediately after a linebreak on iText7
by adding a NULL character ('\u0000')
/// </summary>
/// </summary>
/// <param name="text">
input text
</param>
/// <param name="text">
Text which leading whitespaces to be preserved.
</param>
/// <returns>
t
ext with preserved leading whitespaces</returns>
/// <returns>
T
ext with preserved leading whitespaces
.
</returns>
protected
string
PreserveLeadingSpaces
(
string
text
)
protected
string
PreserveLeadingSpaces
(
string
text
)
{
{
return
"\u0000"
+
Regex
.
Replace
(
text
,
@"\n"
,
"\n\u0000"
);
return
"\u0000"
+
Regex
.
Replace
(
text
,
@"\n"
,
"\n\u0000"
);
...
@@ -215,7 +216,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -215,7 +216,7 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Adds scaled image to document.
/// Adds scaled image to document.
/// </summary>
/// </summary>
/// <param name="image"></param>
/// <param name="image">
Image to add do document.
</param>
private
void
AddScaledImage
(
Image
image
)
private
void
AddScaledImage
(
Image
image
)
{
{
Document
.
Add
(
GetScaledImage
(
image
));
Document
.
Add
(
GetScaledImage
(
image
));
...
...
pdf-generator/EvaluationReport/CourseGeneralInformation.cs
View file @
4d45134b
...
@@ -68,7 +68,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -68,7 +68,7 @@ namespace PDFGenerator.EvaluationReport
AddCustomUploads
(
item
.
UploadedFilesForTopic
,
CustomUploads
);
AddCustomUploads
(
item
.
UploadedFilesForTopic
,
CustomUploads
);
}
}
// description for the current topic, if available (
topic-dependent
)
// description for the current topic, if available (
depends on topic
)
if
(
item
.
Paragraphs
.
Count
==
2
)
if
(
item
.
Paragraphs
.
Count
==
2
)
{
{
Document
.
Add
(
ParagraphFactory
.
GetStandardParagraph
(
item
.
Paragraphs
[
1
]));
Document
.
Add
(
ParagraphFactory
.
GetStandardParagraph
(
item
.
Paragraphs
[
1
]));
...
...
pdf-generator/EvaluationReport/CourseInformationTables.cs
View file @
4d45134b
...
@@ -102,9 +102,9 @@ namespace PDFGenerator.EvaluationReport
...
@@ -102,9 +102,9 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Adds a new cell to table.
/// Adds a new cell to table.
/// </summary>
/// </summary>
/// <param name="table">
t
he table
,
on which a new cell is added</param>
/// <param name="table">
T
he table on which a new cell is added
.
</param>
/// <param name="text">
t
he cell content</param>
/// <param name="text">
T
he cell content
.
</param>
/// <param name="leftColumn">
f
lag to differentiate between left and right column</param>
/// <param name="leftColumn">
F
lag to differentiate between left and right column
.
</param>
private
void
AddCell
(
Table
table
,
string
text
,
bool
leftColumn
)
private
void
AddCell
(
Table
table
,
string
text
,
bool
leftColumn
)
{
{
Cell
cell
=
new
Cell
().
Add
(
Cell
cell
=
new
Cell
().
Add
(
...
...
pdf-generator/EvaluationReport/Cover.cs
View file @
4d45134b
...
@@ -31,7 +31,6 @@ namespace PDFGenerator.EvaluationReport
...
@@ -31,7 +31,6 @@ namespace PDFGenerator.EvaluationReport
Image
image
=
new
Image
(
imageData
);
Image
image
=
new
Image
(
imageData
);
PageSize
pageSize
=
GetPageSize
();
PageSize
pageSize
=
GetPageSize
();
//TODO Noch nicht 100% Vorgaben corporate design
image
.
ScaleAbsolute
(
MillimetersToPoints
(
60
),
MillimetersToPoints
(
16
));
image
.
ScaleAbsolute
(
MillimetersToPoints
(
60
),
MillimetersToPoints
(
16
));
image
.
SetFixedPosition
(
image
.
SetFixedPosition
(
pageSize
.
GetRight
()
-
image
.
GetImageScaledWidth
()
-
MillimetersToPoints
(
5
),
pageSize
.
GetRight
()
-
image
.
GetImageScaledWidth
()
-
MillimetersToPoints
(
5
),
...
...
pdf-generator/EvaluationReport/CriterionTarget.cs
View file @
4d45134b
...
@@ -78,7 +78,8 @@ namespace PDFGenerator.EvaluationReport
...
@@ -78,7 +78,8 @@ namespace PDFGenerator.EvaluationReport
{
{
if
(
Target
.
EvaluatedCriterions
.
Any
(
evaluatedCrit
=>
!
string
.
IsNullOrEmpty
(
evaluatedCrit
.
Description
)))
if
(
Target
.
EvaluatedCriterions
.
Any
(
evaluatedCrit
=>
!
string
.
IsNullOrEmpty
(
evaluatedCrit
.
Description
)))
{
{
Document
.
Add
(
ParagraphFactory
.
GetCustomParagraph
(
Target
.
Paragraphs
[
count
++],
Styles
.
H4
,
5f
,
2f
,
1.15f
));
// zielsetzung
// aimed target
Document
.
Add
(
ParagraphFactory
.
GetCustomParagraph
(
Target
.
Paragraphs
[
count
++],
Styles
.
H4
,
5f
,
2f
,
1.15f
));
}
}
Target
.
EvaluatedCriterions
.
ForEach
(
item
=>
Target
.
EvaluatedCriterions
.
ForEach
(
item
=>
...
@@ -90,14 +91,15 @@ namespace PDFGenerator.EvaluationReport
...
@@ -90,14 +91,15 @@ namespace PDFGenerator.EvaluationReport
Document
.
Add
(
ParagraphFactory
.
GetCustomParagraph
(
item
.
CourseName
,
Styles
.
H5
,
5f
,
5f
,
1.15f
));
Document
.
Add
(
ParagraphFactory
.
GetCustomParagraph
(
item
.
CourseName
,
Styles
.
H5
,
5f
,
5f
,
1.15f
));
}
}
// avoid that existent multiple white
spaces
immediately
after a line break are ignored
from
iText7
// avoid that existent multiple whitespaces after a line break are ignored
by
iText7
Document
.
Add
(
ParagraphFactory
.
GetStandardParagraph
(
PreserveLeadingSpaces
(
item
.
Description
)));
Document
.
Add
(
ParagraphFactory
.
GetStandardParagraph
(
PreserveLeadingSpaces
(
item
.
Description
)));
}
}
});
});
if
(
Target
.
EvaluatedCriterions
.
Any
(
evaluatedCrit
=>
!
string
.
IsNullOrEmpty
(
evaluatedCrit
.
Comment
)))
if
(
Target
.
EvaluatedCriterions
.
Any
(
evaluatedCrit
=>
!
string
.
IsNullOrEmpty
(
evaluatedCrit
.
Comment
)))
{
{
Document
.
Add
(
ParagraphFactory
.
GetCustomParagraph
(
Target
.
Paragraphs
[
count
++],
Styles
.
H4
,
5f
,
2f
,
1.15f
));
// IST-Stand
// actual state
Document
.
Add
(
ParagraphFactory
.
GetCustomParagraph
(
Target
.
Paragraphs
[
count
++],
Styles
.
H4
,
5f
,
2f
,
1.15f
));
}
}
Target
.
EvaluatedCriterions
.
ForEach
(
item
=>
Target
.
EvaluatedCriterions
.
ForEach
(
item
=>
...
...
pdf-generator/EvaluationReport/EvaluationResults.cs
View file @
4d45134b
...
@@ -34,7 +34,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -34,7 +34,7 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Adds pillar information to document and goes through all its quality targets.
/// Adds pillar information to document and goes through all its quality targets.
/// </summary>
/// </summary>
/// <param name="pillar"></param>
/// <param name="pillar">
Pillar to render into the document.
</param>
private
void
RenderPillar
(
Pillar
pillar
)
private
void
RenderPillar
(
Pillar
pillar
)
{
{
Bookmarks
.
AddRootOutline
(
pillar
.
Heading
,
RootOutline
);
Bookmarks
.
AddRootOutline
(
pillar
.
Heading
,
RootOutline
);
...
@@ -56,7 +56,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -56,7 +56,7 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Adds quality target information to document and goes through all its criteria.
/// Adds quality target information to document and goes through all its criteria.
/// </summary>
/// </summary>
/// <param name="qualityTarget"></param>
/// <param name="qualityTarget">
Quality target to render into the document.
</param>
private
void
RenderQualityTarget
(
QualityTarget
qualityTarget
)
private
void
RenderQualityTarget
(
QualityTarget
qualityTarget
)
{
{
string
section
=
qualityTarget
.
Paragraphs
[
0
];
string
section
=
qualityTarget
.
Paragraphs
[
0
];
...
@@ -90,7 +90,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -90,7 +90,7 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Adds criterion information to document and goes through all its kpi evaluations.
/// Adds criterion information to document and goes through all its kpi evaluations.
/// </summary>
/// </summary>
/// <param name="criterion"></param>
/// <param name="criterion">
Criterion to render into the document.
</param>
private
void
RenderCriterion
(
Criterion
criterion
)
private
void
RenderCriterion
(
Criterion
criterion
)
{
{
new
CriterionTarget
(
criterion
.
CriterionTarget
,
Results
.
Sections
[
criterion
.
CriterionTarget
.
Paragraphs
[
0
]],
CustomUploads
,
new
CriterionTarget
(
criterion
.
CriterionTarget
,
Results
.
Sections
[
criterion
.
CriterionTarget
.
Paragraphs
[
0
]],
CustomUploads
,
...
@@ -108,7 +108,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -108,7 +108,7 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Adds a table for listing measures as part of the criterion information
/// Adds a table for listing measures as part of the criterion information
/// </summary>
/// </summary>
/// <param name="measureTable">
h
olds the information of each measure</param>
/// <param name="measureTable">
H
olds the information of each measure
.
</param>
private
void
AddMeasureSection
(
MeasureTable
measureTable
)
private
void
AddMeasureSection
(
MeasureTable
measureTable
)
{
{
Table
table
=
new
Table
(
UnitValue
.
CreatePercentArray
(
new
float
[]
{
1f
,
1f
,
1f
,
1f
,
1f
,
1f
,
1f
,
1f
,
1f
,
1f
}),
false
)
Table
table
=
new
Table
(
UnitValue
.
CreatePercentArray
(
new
float
[]
{
1f
,
1f
,
1f
,
1f
,
1f
,
1f
,
1f
,
1f
,
1f
,
1f
}),
false
)
...
@@ -129,30 +129,30 @@ namespace PDFGenerator.EvaluationReport
...
@@ -129,30 +129,30 @@ namespace PDFGenerator.EvaluationReport
measureTable
.
Measures
.
ForEach
(
measure
=>
measureTable
.
Measures
.
ForEach
(
measure
=>
{
{
//first row
//
first row
table
.
AddCell
(
new
Cell
().
Add
(
new
Paragraph
(
new
Text
(
"Kriterium/ Kennzahl"
).
AddStyle
(
Styles
.
SmallBold
)).
SetMultipliedLeading
(
1f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
().
Add
(
new
Paragraph
(
new
Text
(
"Kriterium/ Kennzahl"
).
AddStyle
(
Styles
.
SmallBold
)).
SetMultipliedLeading
(
1f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
"Studiengang"
).
AddStyle
(
Styles
.
SmallBold
))).
SetVerticalAlignment
(
VerticalAlignment
.
MIDDLE
).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
"Studiengang"
).
AddStyle
(
Styles
.
SmallBold
))).
SetVerticalAlignment
(
VerticalAlignment
.
MIDDLE
).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
().
Add
(
new
Paragraph
(
new
Text
(
"Fristigkeit"
).
AddStyle
(
Styles
.
SmallBold
))).
SetVerticalAlignment
(
VerticalAlignment
.
MIDDLE
).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
().
Add
(
new
Paragraph
(
new
Text
(
"Fristigkeit"
).
AddStyle
(
Styles
.
SmallBold
))).
SetVerticalAlignment
(
VerticalAlignment
.
MIDDLE
).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
"Zuständigkeit"
).
AddStyle
(
Styles
.
SmallBold
))).
SetVerticalAlignment
(
VerticalAlignment
.
MIDDLE
).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
"Zuständigkeit"
).
AddStyle
(
Styles
.
SmallBold
))).
SetVerticalAlignment
(
VerticalAlignment
.
MIDDLE
).
SetPaddingBottom
(
0
));
//spans rows 2-4
//
spans rows 2-4
table
.
AddCell
(
new
Cell
(
3
,
1
).
Add
(
new
Paragraph
(
new
Text
(
measure
.
FullId
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
1f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
3
,
1
).
Add
(
new
Paragraph
(
new
Text
(
measure
.
FullId
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
1f
)).
SetPaddingBottom
(
0
));
//second row
//
second row
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
measure
.
CourseName
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
0.9f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
measure
.
CourseName
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
0.9f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
().
Add
(
new
Paragraph
(
new
Text
(
measure
.
Maturity
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
0.9f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
().
Add
(
new
Paragraph
(
new
Text
(
measure
.
Maturity
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
0.9f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
measure
.
Responsibilities
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
0.9f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
measure
.
Responsibilities
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
0.9f
)).
SetPaddingBottom
(
0
));
//third row
//
third row
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
"Maßnahme"
).
AddStyle
(
Styles
.
SmallBold
)).
SetMultipliedLeading
(
1f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
"Maßnahme"
).
AddStyle
(
Styles
.
SmallBold
)).
SetMultipliedLeading
(
1f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
5
).
Add
(
new
Paragraph
(
new
Text
(
"Kommentar"
).
AddStyle
(
Styles
.
SmallBold
)).
SetMultipliedLeading
(
1f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
5
).
Add
(
new
Paragraph
(
new
Text
(
"Kommentar"
).
AddStyle
(
Styles
.
SmallBold
)).
SetMultipliedLeading
(
1f
)).
SetPaddingBottom
(
0
));
//fourth row
//
fourth row
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
measure
.
Description
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
0.9f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
4
).
Add
(
new
Paragraph
(
new
Text
(
measure
.
Description
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
0.9f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
5
).
Add
(
new
Paragraph
(
new
Text
(
measure
.
Comments
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
0.9f
)).
SetPaddingBottom
(
0
));
table
.
AddCell
(
new
Cell
(
1
,
5
).
Add
(
new
Paragraph
(
new
Text
(
measure
.
Comments
).
AddStyle
(
Styles
.
Small
)).
SetMultipliedLeading
(
0.9f
)).
SetPaddingBottom
(
0
));
});
});
// message for non-available measures
,
if available
// message for non-available measures if available
if
(
measureTable
.
Measures
.
Count
==
0
&&
measureTable
.
Paragraphs
.
Count
>
1
)
if
(
measureTable
.
Measures
.
Count
==
0
&&
measureTable
.
Paragraphs
.
Count
>
1
)
{
{
table
.
AddCell
(
table
.
AddCell
(
...
...
pdf-generator/EvaluationReport/KpiEvaluation.cs
View file @
4d45134b
...
@@ -24,7 +24,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -24,7 +24,7 @@ namespace PDFGenerator.EvaluationReport
}
}
/// <summary>
/// <summary>
/// Renders the content regarding a single kpi and
go
es through
als
its reports.
/// Renders the content regarding a single kpi and
iterat
es through its reports.
/// </summary>
/// </summary>
public
override
void
Render
()
public
override
void
Render
()
{
{
...
@@ -66,7 +66,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -66,7 +66,7 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Adds content about if the kpi is reached or not.
/// Adds content about if the kpi is reached or not.
/// </summary>
/// </summary>
/// <param name="evaluatedKpis">
holds
information for each available course</param>
/// <param name="evaluatedKpis">
Containing
information for each available course
.
</param>
private
void
AddKpiIsReachedSection
(
List
<
EvaluatedKpi
>
evaluatedKpis
)
private
void
AddKpiIsReachedSection
(
List
<
EvaluatedKpi
>
evaluatedKpis
)
{
{
evaluatedKpis
.
ForEach
(
item
=>
evaluatedKpis
.
ForEach
(
item
=>
...
@@ -84,7 +84,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -84,7 +84,7 @@ namespace PDFGenerator.EvaluationReport
color
=
new
DeviceRgb
(
249
,
210
,
218
);
color
=
new
DeviceRgb
(
249
,
210
,
218
);
}
}
// avoid that existent multiple white
spaces
immediately
after a line break are ignored
from
iText7
// avoid that existent multiple whitespaces after a line break are ignored
by
iText7
Table
panel
=
Panel
.
GetPanel
(
new
Paragraph
(
new
Text
(
PreserveLeadingSpaces
(
item
.
Paragraph
)).
AddStyle
(
Styles
.
Paragraph
)),
color
);
Table
panel
=
Panel
.
GetPanel
(
new
Paragraph
(
new
Text
(
PreserveLeadingSpaces
(
item
.
Paragraph
)).
AddStyle
(
Styles
.
Paragraph
)),
color
);
cell
.
Add
(
panel
);
cell
.
Add
(
panel
);
Table
.
AddCell
(
cell
);
Table
.
AddCell
(
cell
);
...
@@ -95,7 +95,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -95,7 +95,7 @@ namespace PDFGenerator.EvaluationReport
/// <summary>
/// <summary>
/// Adds content about the kpi comment.
/// Adds content about the kpi comment.
/// </summary>
/// </summary>
/// <param name="evaluatedKpis">
hold
s information for each available course</param>
/// <param name="evaluatedKpis">
Contain
s information for each available course
.
</param>
private
void
AddKpiCommentSection
(
List
<
EvaluatedKpi
>
evaluatedKpis
)
private
void
AddKpiCommentSection
(
List
<
EvaluatedKpi
>
evaluatedKpis
)
{
{
evaluatedKpis
.
ForEach
(
item
=>
evaluatedKpis
.
ForEach
(
item
=>
...
...
pdf-generator/EvaluationReport/KpiEvaluationReports.cs
View file @
4d45134b
...
@@ -126,7 +126,7 @@ namespace PDFGenerator.EvaluationReport
...
@@ -126,7 +126,7 @@ namespace PDFGenerator.EvaluationReport
AddPageBreak
();
AddPageBreak
();
// if order between images and text important
// if order between images and text
is
important
if
(
Reports
.
ReportElementOrder
!=
null
)
if
(
Reports
.
ReportElementOrder
!=
null
)
{
{