diff --git a/.gitignore b/.gitignore
index f77eae46893690311f70556e3ffac36b9c03b266..abf47058d679b4377e1c2d22192e134499d41a94 100644
--- a/.gitignore
+++ b/.gitignore
@@ -559,4 +559,4 @@ $RECYCLE.BIN/
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
-/pdf-generator/Properties/launchSettings.json
\ No newline at end of file
+/PDSLLabs.Public.QMSL.PDFGenerator/Properties/launchSettings.json
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c4f061f9c28717ffe640ed8cab2f8a6fb67784fc..92c650cc2369e42b9de0647db0a4ded2609d790b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -74,7 +74,7 @@ deploy_integration:
only: [/^integration/.*$/]
script:
- iisreset
- - Copy-Item -Path ".\output\*" -Destination "C:\inetpub\wwwroot\wss\VirtualDirectories\pdf-generator\" -Recurse -Exclude "web.config"
+ - Copy-Item -Path ".\output\*" -Destination "C:\inetpub\wwwroot\wss\VirtualDirectories\pdf-generator-qmsl\" -Recurse -Exclude "web.config"
- iisreset
variables:
ErrorActionPreference: stop
diff --git a/.vscode/launch.json b/.vscode/launch.json
index d8f7e727d63128d3ae4f1f3b645b27563953862f..76884391eaaac820dd0a5954e9a1140dfd712b22 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -9,9 +9,9 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
- "program": "${workspaceFolder}/pdf-generator/bin/Debug/netcoreapp3.1/pdf-generator.dll",
+ "program": "${workspaceFolder}/PDSLLabs.Public.QMSL.PDFGenerator/bin/Debug/netcoreapp3.1/pdf-generator.dll",
"args": [],
- "cwd": "${workspaceFolder}/pdf-generator",
+ "cwd": "${workspaceFolder}/PDSLLabs.Public.QMSL.PDFGenerator",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 7b18005094986cd2b8efdda1577c389044e5b031..500e9e04359f798f3cc7087f075101ced4e8d9f7 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
- "${workspaceFolder}/pdf-generator/pdf-generator.csproj",
+ "${workspaceFolder}/PDSLLabs.Public.QMSL.PDFGenerator/PDSLLabs.Public.QMSL.PDFGenerator.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
@@ -19,7 +19,7 @@
"type": "process",
"args": [
"publish",
- "${workspaceFolder}/pdf-generator/pdf-generator.csproj",
+ "${workspaceFolder}/PDSLLabs.Public.QMSL.PDFGenerator/PDSLLabs.Public.QMSL.PDFGenerator.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
@@ -32,7 +32,7 @@
"args": [
"watch",
"run",
- "${workspaceFolder}/pdf-generator/pdf-generator.csproj",
+ "${workspaceFolder}/PDSLLabs.Public.QMSL.PDFGenerator/PDSLLabs.Public.QMSL.PDFGenerator.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
diff --git a/LICENSE b/LICENSE
index 641264128ae5728f4be678efe970c0405e0ce78c..f478f6c1b76711e3b9d4fc0c96012fda1e73585b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2020 Datencockpit
+Copyright (c) 2022 QMS-Lehre
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/pdf-generator.sln b/PDSLLabs.Public.QMSL.PDFGenerator.sln
similarity index 82%
rename from pdf-generator.sln
rename to PDSLLabs.Public.QMSL.PDFGenerator.sln
index ca5e0c37c28ebd0ca5d7b1a7e9e10634b135d45e..1721c470eb598ea55dd163aeade50c58403b81a9 100644
--- a/pdf-generator.sln
+++ b/PDSLLabs.Public.QMSL.PDFGenerator.sln
@@ -1,9 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26124.0
-MinimumVisualStudioVersion = 15.0.26124.0
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pdf-generator", "pdf-generator\pdf-generator.csproj", "{4501EAF1-485C-4230-9F81-8A562DB5FC5A}"
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30011.22
+MinimumVisualStudioVersion = 16.0.30011.22
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDSLLabs.Public.QMSL.PDFGenerator", "PDSLLabs.Public.QMSL.PDFGenerator\PDSLLabs.Public.QMSL.PDFGenerator.csproj", "{4501EAF1-485C-4230-9F81-8A562DB5FC5A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/pdf-generator/Controllers/AbsbHomepagePdfController.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Controllers/AbsbHomepagePdfController.cs
similarity index 84%
rename from pdf-generator/Controllers/AbsbHomepagePdfController.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Controllers/AbsbHomepagePdfController.cs
index b2f1f48adee40475e46c53efaa7f4e047e967c61..637b567740b3cabe18b6ff912fd58a3be7536e9d 100644
--- a/pdf-generator/Controllers/AbsbHomepagePdfController.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Controllers/AbsbHomepagePdfController.cs
@@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
-using PDFGenerator.Models.AbsbHomepagePdf;
-using PDFGenerator.Renderers;
+using PDSLLabs.Public.QMSL.PDFGenerator.Renderers;
+using PDSLLabs.QMSL.PDFGenerator.Models.AbsbHomepagePdf;
-namespace PDFGenerator.Controllers
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Controllers
{
[ApiController]
[Route("[controller]")]
diff --git a/pdf-generator/Controllers/EvaluationReportController.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Controllers/EvaluationReportController.cs
similarity index 86%
rename from pdf-generator/Controllers/EvaluationReportController.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Controllers/EvaluationReportController.cs
index 4ef47ae04ee4a78f63b6ce6b1a8d38055da14c58..62f4f167936c4075c190ce49a51eb4dc8ae54930 100644
--- a/pdf-generator/Controllers/EvaluationReportController.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Controllers/EvaluationReportController.cs
@@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
-using PDFGenerator.Renderers;
-using EvaluationReportModel = PDFGenerator.Models.EvaluationReport.EvaluationReport;
+using PDSLLabs.Public.QMSL.PDFGenerator.Renderers;
+using EvaluationReportModel = PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport.EvaluationReport;
-namespace PDFGenerator.Controllers
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Controllers
{
[ApiController]
[Route("[controller]")]
diff --git a/pdf-generator/Controllers/FactSheetController.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Controllers/FactSheetController.cs
similarity index 87%
rename from pdf-generator/Controllers/FactSheetController.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Controllers/FactSheetController.cs
index a654635e355652decf477a1f532b1c30949e786e..4968d6b60ce89136b1a52bb90c1d77b77970e734 100644
--- a/pdf-generator/Controllers/FactSheetController.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Controllers/FactSheetController.cs
@@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
-using PDFGenerator.Renderers;
-using FactSheetModel = PDFGenerator.Models.FactSheet.FactSheet;
+using PDSLLabs.Public.QMSL.PDFGenerator.Renderers;
+using FactSheetModel = PDSLLabs.QMSL.PDFGenerator.Models.FactSheet.FactSheet;
-namespace PDFGenerator.Controllers
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Controllers
{
[Route("[controller]")]
[ApiController]
diff --git a/pdf-generator/Controllers/SurveyPdfController.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Controllers/SurveyPdfController.cs
similarity index 86%
rename from pdf-generator/Controllers/SurveyPdfController.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Controllers/SurveyPdfController.cs
index 2b469b61c381ec2da8f3bcdc80b16e696871970f..65b2e54317e1874d6f121354446b0d9a774dface 100644
--- a/pdf-generator/Controllers/SurveyPdfController.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Controllers/SurveyPdfController.cs
@@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
-using PDFGenerator.Models.SurveyPdf;
-using PDFGenerator.Renderers;
+using PDSLLabs.Public.QMSL.PDFGenerator.Renderers;
+using PDSLLabs.QMSL.PDFGenerator.Models.SurveyPdf;
-namespace PDFGenerator.Controllers
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Controllers
{
[ApiController]
[Route("[controller]")]
diff --git a/pdf-generator/DocumentStructures/AbsbHomepagePdf/Appendix.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/AbsbHomepagePdf/Appendix.cs
similarity index 90%
rename from pdf-generator/DocumentStructures/AbsbHomepagePdf/Appendix.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/AbsbHomepagePdf/Appendix.cs
index 97bbdcccc1c5447be1b8268cca451b5dab2d8d62..5bbea36f19e32540a69c6ad0db73a538eef9fddf 100644
--- a/pdf-generator/DocumentStructures/AbsbHomepagePdf/Appendix.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/AbsbHomepagePdf/Appendix.cs
@@ -3,17 +3,17 @@ using iText.Layout;
using iText.Layout.Borders;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.DocumentStructures.SurveyPdfDocStructures;
-using PDFGenerator.Models.AbsbHomepagePdf;
-using PDFGenerator.Utilities;
+using PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.SurveyPdfDocStructures;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.AbsbHomepagePdf;
using System.Collections.Generic;
-using static PDFGenerator.Utilities.Globals;
-using static PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
-using Orientation = PDFGenerator.Utilities.Globals.Orientation;
-using Styles = PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
+using Orientation = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Orientation;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
-namespace PDFGenerator.DocumentStructures.AbsbHomepagePdfDocStructures
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.AbsbHomepagePdfDocStructures
{
public class Appendix : SurveyPdfBaseSection
{
diff --git a/pdf-generator/DocumentStructures/AbsbHomepagePdf/Cover.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/AbsbHomepagePdf/Cover.cs
similarity index 72%
rename from pdf-generator/DocumentStructures/AbsbHomepagePdf/Cover.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/AbsbHomepagePdf/Cover.cs
index c1a8f42a2257d6012479d1fa62c09ea6e1e7c3f7..de7c2f342ba055d99ff7a2b0492b095983145f07 100644
--- a/pdf-generator/DocumentStructures/AbsbHomepagePdf/Cover.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/AbsbHomepagePdf/Cover.cs
@@ -1,15 +1,15 @@
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.DocumentStructures.SurveyPdfDocStructures;
-using PDFGenerator.Models.SurveyPdf;
-using PDFGenerator.Utilities;
-using static PDFGenerator.Utilities.Globals;
-using static PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
-using Orientation = PDFGenerator.Utilities.Globals.Orientation;
-using Styles = PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
+using PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.SurveyPdfDocStructures;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.SurveyPdf;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
+using Orientation = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Orientation;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
-namespace PDFGenerator.DocumentStructures.AbsbHomepagePdfDocStructures
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.AbsbHomepagePdfDocStructures
{
public class Cover : SurveyPdfBaseSection
{
diff --git a/pdf-generator/DocumentStructures/BaseSection.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/BaseSection.cs
similarity index 94%
rename from pdf-generator/DocumentStructures/BaseSection.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/BaseSection.cs
index 98e4058ada7bdf9d2a92e49cd7d581f30c81113d..c03839b496ac1673ab06adf0ce01281e2020574d 100644
--- a/pdf-generator/DocumentStructures/BaseSection.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/BaseSection.cs
@@ -1,77 +1,77 @@
-using iText.Kernel.Geom;
+using iText.Kernel.Geom;
using iText.Kernel.Pdf;
-using iText.Layout;
-using iText.Layout.Element;
+using iText.Layout;
+using iText.Layout.Element;
using iText.Layout.Layout;
-using iText.Layout.Properties;
-using PDFGenerator.Utilities;
+using iText.Layout.Properties;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
-namespace PDFGenerator.DocumentStructures
-{
- public abstract class BaseSection
- {
- protected PdfOutline RootOutline { get; }
- protected Document Document { get; set; }
- protected Bookmarks Bookmarks { get; }
- public static Text NewLine { get; } = new Text("\n");
-
- public BaseSection(Document document)
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures
+{
+ public abstract class BaseSection
+ {
+ protected PdfOutline RootOutline { get; }
+ protected Document Document { get; set; }
+ protected Bookmarks Bookmarks { get; }
+ public static Text NewLine { get; } = new Text("\n");
+
+ public BaseSection(Document document)
+ {
+ Document = document;
+ }
+ public BaseSection(Document document, Bookmarks bookmarks)
{
- Document = document;
- }
- public BaseSection(Document document, Bookmarks bookmarks)
- {
- // get root outline from the PdfDocument: false indicates iText does not need to update the outlines.
- RootOutline = document.GetPdfDocument().GetOutlines(false);
+ // get root outline from the PdfDocument: false indicates iText does not need to update the outlines.
+ RootOutline = document.GetPdfDocument().GetOutlines(false);
Bookmarks = bookmarks;
- Document = document;
- }
-
- ///
- /// Adds page break to document.
- ///
- public void AddPageBreak()
- {
- Document.Add(new AreaBreak(AreaBreakType.NEXT_PAGE));
- }
-
- ///
- /// Gets default page size.
- ///
- /// The default page size.
- protected PageSize GetPageSize()
- {
- return Document.GetPdfDocument().GetDefaultPageSize();
+ Document = document;
+ }
+
+ ///
+ /// Adds page break to document.
+ ///
+ public void AddPageBreak()
+ {
+ Document.Add(new AreaBreak(AreaBreakType.NEXT_PAGE));
+ }
+
+ ///
+ /// Gets default page size.
+ ///
+ /// The default page size.
+ protected PageSize GetPageSize()
+ {
+ return Document.GetPdfDocument().GetDefaultPageSize();
}
- ///
- /// Gets the current page.
- ///
- /// The current page.
- protected int GetCurrentPage()
- {
- return Document.GetPdfDocument().GetNumberOfPages();
+ ///
+ /// Gets the current page.
+ ///
+ /// The current page.
+ protected int GetCurrentPage()
+ {
+ return Document.GetPdfDocument().GetNumberOfPages();
}
- ///
- /// Resizes image to fit page size.
- ///
+ ///
+ /// Resizes image to fit page size.
+ ///
/// Image to be resized.
/// Optional extra space.
- /// Optional custom maximum height.
- /// The resized image.
- protected Image GetScaledImage(Image image, float marginTop = 0, float customMaxHeight = 0f)
- {
- PageSize pageSize = GetPageSize();
- float maxWidth = pageSize.GetWidth() - Document.GetLeftMargin() - Document.GetRightMargin();
- float maxHeight = customMaxHeight > 0 ? customMaxHeight : pageSize.GetHeight() - Document.GetTopMargin() - Document.GetBottomMargin() - marginTop;
-
- if (image.GetImageWidth() > maxWidth || image.GetImageHeight() > maxHeight)
- {
- return image.ScaleToFit(maxWidth, maxHeight);
- }
-
- return image;
+ /// Optional custom maximum height.
+ /// The resized image.
+ protected Image GetScaledImage(Image image, float marginTop = 0, float customMaxHeight = 0f)
+ {
+ PageSize pageSize = GetPageSize();
+ float maxWidth = pageSize.GetWidth() - Document.GetLeftMargin() - Document.GetRightMargin();
+ float maxHeight = customMaxHeight > 0 ? customMaxHeight : pageSize.GetHeight() - Document.GetTopMargin() - Document.GetBottomMargin() - marginTop;
+
+ if (image.GetImageWidth() > maxWidth || image.GetImageHeight() > maxHeight)
+ {
+ return image.ScaleToFit(maxWidth, maxHeight);
+ }
+
+ return image;
}
///
@@ -97,6 +97,6 @@ namespace PDFGenerator.DocumentStructures
}
return result.GetOccupiedArea().GetBBox().GetY();
- }
- }
-}
+ }
+ }
+}
diff --git a/pdf-generator/DocumentStructures/BaseTableOfContents.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/BaseTableOfContents.cs
similarity index 94%
rename from pdf-generator/DocumentStructures/BaseTableOfContents.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/BaseTableOfContents.cs
index 2161f210e7202274bd1e21b92bbdaf0449657ef6..f588aa96079aa56e27603ac69e39590196418f50 100644
--- a/pdf-generator/DocumentStructures/BaseTableOfContents.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/BaseTableOfContents.cs
@@ -4,7 +4,7 @@ using iText.Layout;
using System.Collections.Generic;
using System.IO;
-namespace PDFGenerator.DocumentStructures
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures
{
public struct TocItem
{
diff --git a/pdf-generator/DocumentStructures/EvaluationReport/Appendix.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/Appendix.cs
similarity index 93%
rename from pdf-generator/DocumentStructures/EvaluationReport/Appendix.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/Appendix.cs
index f0148a264e1edcefb0f813f58c3e1c090b89f6c0..5a462c96b89a4e4e9b2e9be2a846246301f248fb 100644
--- a/pdf-generator/DocumentStructures/EvaluationReport/Appendix.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/Appendix.cs
@@ -1,114 +1,114 @@
using iText.IO.Image;
-using iText.Kernel.Geom;
-using iText.Kernel.Pdf;
-using iText.Kernel.Pdf.Xobject;
-using iText.Layout;
-using iText.Layout.Borders;
-using iText.Layout.Element;
-using PDFGenerator.Models.EvaluationReport;
-using PDFGenerator.Utilities;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using static PDFGenerator.Utilities.Globals;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-
-
-namespace PDFGenerator.DocumentStructures.EvaluationReport
-{
- internal class Appendix : EvaluationReportBaseSection
- {
- private PDFAppendix PDFAppendix { get; }
- private bool FirstFile { get; set; }
-
- public Appendix(PDFAppendix appendix, Document document, Bookmarks bookmarks, TableOfContents tableOfContents)
- : base(document, bookmarks, tableOfContents)
- {
- PDFAppendix = appendix;
- FirstFile = true;
- }
-
- ///
- /// Includes custom uploads to attachments available.
- ///
- /// Custom attachments to be added.
- public void UpdateAppendix(Dictionary customUploads)
- {
- foreach (KeyValuePair item in customUploads)
- {
- if (!PDFAppendix.Attachments.ContainsKey(item.Key))
- {
- PDFAppendix.Attachments.Add(item.Key, item.Value);
- }
- }
- }
-
- ///
- /// Renders the attachments for the appendix section.
- ///
- public override void Render()
- {
- if (PDFAppendix.Attachments.Count == 0 && PDFAppendix.ReportAttachments.Count == 0)
- {
- return;
- }
-
- Bookmarks.AddRootOutline(PDFAppendix.Heading, RootOutline);
-
- TocItem tocItem = new TocItem
- {
- Title = PDFAppendix.Heading,
- Indent = 0,
- Page = GetCurrentPage()
- };
+using iText.Kernel.Geom;
+using iText.Kernel.Pdf;
+using iText.Kernel.Pdf.Xobject;
+using iText.Layout;
+using iText.Layout.Borders;
+using iText.Layout.Element;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+
+
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport
+{
+ internal class Appendix : EvaluationReportBaseSection
+ {
+ private PDFAppendix PDFAppendix { get; }
+ private bool FirstFile { get; set; }
+
+ public Appendix(PDFAppendix appendix, Document document, Bookmarks bookmarks, TableOfContents tableOfContents)
+ : base(document, bookmarks, tableOfContents)
+ {
+ PDFAppendix = appendix;
+ FirstFile = true;
+ }
+
+ ///
+ /// Includes custom uploads to attachments available.
+ ///
+ /// Custom attachments to be added.
+ public void UpdateAppendix(Dictionary customUploads)
+ {
+ foreach (KeyValuePair item in customUploads)
+ {
+ if (!PDFAppendix.Attachments.ContainsKey(item.Key))
+ {
+ PDFAppendix.Attachments.Add(item.Key, item.Value);
+ }
+ }
+ }
+
+ ///
+ /// Renders the attachments for the appendix section.
+ ///
+ public override void Render()
+ {
+ if (PDFAppendix.Attachments.Count == 0 && PDFAppendix.ReportAttachments.Count == 0)
+ {
+ return;
+ }
+
+ Bookmarks.AddRootOutline(PDFAppendix.Heading, RootOutline);
+
+ TocItem tocItem = new TocItem
+ {
+ Title = PDFAppendix.Heading,
+ Indent = 0,
+ Page = GetCurrentPage()
+ };
TableOfContents.AddToTOC(tocItem);
FirstFile = false;
Paragraph p = new Paragraph(new Text(PDFAppendix.Heading).AddStyle(Styles.ChapterTitle)).SetDestination(PDFAppendix.Heading);
Document.Add(p);
- int counter = 1;
- foreach (KeyValuePair>> attachment in PDFAppendix.ReportAttachments)
+ int counter = 1;
+ foreach (KeyValuePair>> attachment in PDFAppendix.ReportAttachments)
{
AddReportAttachment(attachment);
if (counter < PDFAppendix.ReportAttachments.Count)
{
AddPageBreak();
- }
- counter++;
+ }
+ counter++;
}
- foreach (KeyValuePair attachment in PDFAppendix.Attachments)
+ foreach (KeyValuePair attachment in PDFAppendix.Attachments)
{
if (PDFAppendix.ReportAttachments != null && PDFAppendix.ReportAttachments.Count > 0)
{
AddPageBreak();
- }
+ }
AddAttachment(attachment);
}
- SetPageOrientation(Orientation.Portrait);
+ SetPageOrientation(Orientation.Portrait);
}
private void AddReportAttachment(KeyValuePair>> attachment)
{
- TocItem tocItem = new TocItem
- {
- Title = attachment.Key,
- Indent = 1,
- Page = GetCurrentPage()
- };
+ TocItem tocItem = new TocItem
+ {
+ Title = attachment.Key,
+ Indent = 1,
+ Page = GetCurrentPage()
+ };
TableOfContents.AddToTOC(tocItem);
Paragraph paragraph = new Paragraph(attachment.Key).AddStyle(Styles.ChapterSubtitle).SetMarginBottom(8f).SetDestination(attachment.Key);
Document.Add(paragraph);
Table table = new Table(1, false).UseAllAvailableWidth().SetKeepTogether(true).SetMarginTop(20f);
- ImageData imageData;
- Image image;
- int counter = 1;
- foreach (KeyValuePair> reports in attachment.Value)
- {
- paragraph = new Paragraph(reports.Key).AddStyle(Styles.ChapterSubsubtitle).SetMarginBottom(-4f);
- Document.Add(paragraph);
+ ImageData imageData;
+ Image image;
+ int counter = 1;
+ foreach (KeyValuePair> reports in attachment.Value)
+ {
+ paragraph = new Paragraph(reports.Key).AddStyle(Styles.ChapterSubsubtitle).SetMarginBottom(-4f);
+ Document.Add(paragraph);
if (reports.Value == null || reports.Value.Count == 0)
{
paragraph = new Paragraph(PDFAppendix.NoDataAvailable).AddStyle(Styles.Paragraph).SetMarginBottom(15f);
@@ -129,100 +129,100 @@ namespace PDFGenerator.DocumentStructures.EvaluationReport
table.AddCell(cell);
}
- }
+ }
Document.Add(table);
- table = new Table(1, false).UseAllAvailableWidth().SetKeepTogether(true).SetMarginTop(20f);
+ table = new Table(1, false).UseAllAvailableWidth().SetKeepTogether(true).SetMarginTop(20f);
if (attachment.Value.Count < counter)
{
AddPageBreak();
- }
- counter++;
+ }
+ counter++;
}
}
- ///
- /// Adds a single attachment to document.
- ///
- /// The item composed of an attachment key and content.
- private void AddAttachment(KeyValuePair item)
- {
- PdfReader attachment = new PdfReader(new MemoryStream(item.Value));
- PdfDocument source = new PdfDocument(attachment);
- PdfDocument dest = Document.GetPdfDocument();
-
- // avoiding the exception 'PdfReader not opened with owner password' from third party encrypted PDF uploads involves
- // manipulating both 'unethicalReading' and 'encrypted' flags from PdfReader
-
- // In case the original author of the document defined permissions these permissions are ignored by setting 'unethicalReading' to true.
- // This 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
- // (refer to https://stackoverflow.com/questions/48064902/itext-7-pdfreader-is-not-opened-with-owner-password-error)
- attachment.SetUnethicalReading(true);
-
- // Mislead iText into thinking that the original PDF file was not encrypted
- attachment.GetType()
- .GetField("encrypted", BindingFlags.NonPublic | BindingFlags.Instance)
- .SetValue(attachment, false);
-
- // detect page orientation
- Rectangle attachmentPageSize = source.GetPage(1).GetPageSizeWithRotation();
- PageSize pageSize = GetPageSize();
-
- // if attachment orientation is landscape, but destination pdf is not
- if ((attachmentPageSize.GetHeight() < attachmentPageSize.GetWidth()) && ((int)Math.Round(attachmentPageSize.GetHeight()) < pageSize.GetHeight()))
- {
- SetPageOrientation(Orientation.Landscape);
- }
-
- // if attachment orientation is portrait but destination pdf is not
- else if ((attachmentPageSize.GetHeight() > attachmentPageSize.GetWidth()) && ((int)Math.Round(attachmentPageSize.GetHeight()) > pageSize.GetHeight()))
- {
- SetPageOrientation(Orientation.Portrait);
- }
-
- // table for inserting imported pages
- // true flag: Avoid memory overhead problems from big imported files
- Table table = new Table(1, true)
- .UseAllAvailableWidth()
- .SetDestination(item.Key);
-
- Document.Add(table);
-
- TocItem tocItem = new TocItem
- {
- Title = item.Key,
- Indent = 1,
- Page = GetCurrentPage()
- };
- TableOfContents.AddToTOC(tocItem);
-
- for (int i = 1; i <= source.GetNumberOfPages(); i++)
- {
- PdfPage page = source.GetPage(i);
- PdfFormXObject pageCopy = page.CopyAsFormXObject(dest);
- Image image = new Image(pageCopy);
-
-
- Cell cell = new Cell()
- .Add(GetScaledImage(image))
- .SetBorder(Border.NO_BORDER)
- .SetPadding(0)
- .SetKeepTogether(true);
-
- table.AddCell(cell);
-
- // flush content of a single page to render part of the table:
- // memory used be rendered cell objects is made available to the garbage collector for release
- table.Flush();
- }
-
- // once all the cells are added write the remainder of the table that was not rendered yet
- table.Complete();
-
- source.Close();
- }
- }
-}
+ ///
+ /// Adds a single attachment to document.
+ ///
+ /// The item composed of an attachment key and content.
+ private void AddAttachment(KeyValuePair item)
+ {
+ PdfReader attachment = new PdfReader(new MemoryStream(item.Value));
+ PdfDocument source = new PdfDocument(attachment);
+ PdfDocument dest = Document.GetPdfDocument();
+
+ // avoiding the exception 'PdfReader not opened with owner password' from third party encrypted PDF uploads involves
+ // manipulating both 'unethicalReading' and 'encrypted' flags from PdfReader
+
+ // In case the original author of the document defined permissions these permissions are ignored by setting 'unethicalReading' to true.
+ // This 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
+ // (refer to https://stackoverflow.com/questions/48064902/itext-7-pdfreader-is-not-opened-with-owner-password-error)
+ attachment.SetUnethicalReading(true);
+
+ // Mislead iText into thinking that the original PDF file was not encrypted
+ attachment.GetType()
+ .GetField("encrypted", BindingFlags.NonPublic | BindingFlags.Instance)
+ .SetValue(attachment, false);
+
+ // detect page orientation
+ Rectangle attachmentPageSize = source.GetPage(1).GetPageSizeWithRotation();
+ PageSize pageSize = GetPageSize();
+
+ // if attachment orientation is landscape, but destination pdf is not
+ if ((attachmentPageSize.GetHeight() < attachmentPageSize.GetWidth()) && ((int)Math.Round(attachmentPageSize.GetHeight()) < pageSize.GetHeight()))
+ {
+ SetPageOrientation(Orientation.Landscape);
+ }
+
+ // if attachment orientation is portrait but destination pdf is not
+ else if ((attachmentPageSize.GetHeight() > attachmentPageSize.GetWidth()) && ((int)Math.Round(attachmentPageSize.GetHeight()) > pageSize.GetHeight()))
+ {
+ SetPageOrientation(Orientation.Portrait);
+ }
+
+ // table for inserting imported pages
+ // true flag: Avoid memory overhead problems from big imported files
+ Table table = new Table(1, true)
+ .UseAllAvailableWidth()
+ .SetDestination(item.Key);
+
+ Document.Add(table);
+
+ TocItem tocItem = new TocItem
+ {
+ Title = item.Key,
+ Indent = 1,
+ Page = GetCurrentPage()
+ };
+ TableOfContents.AddToTOC(tocItem);
+
+ for (int i = 1; i <= source.GetNumberOfPages(); i++)
+ {
+ PdfPage page = source.GetPage(i);
+ PdfFormXObject pageCopy = page.CopyAsFormXObject(dest);
+ Image image = new Image(pageCopy);
+
+
+ Cell cell = new Cell()
+ .Add(GetScaledImage(image))
+ .SetBorder(Border.NO_BORDER)
+ .SetPadding(0)
+ .SetKeepTogether(true);
+
+ table.AddCell(cell);
+
+ // flush content of a single page to render part of the table:
+ // memory used be rendered cell objects is made available to the garbage collector for release
+ table.Flush();
+ }
+
+ // once all the cells are added write the remainder of the table that was not rendered yet
+ table.Complete();
+
+ source.Close();
+ }
+ }
+}
diff --git a/pdf-generator/DocumentStructures/EvaluationReport/CourseGeneralInformation.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/CourseGeneralInformation.cs
similarity index 89%
rename from pdf-generator/DocumentStructures/EvaluationReport/CourseGeneralInformation.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/CourseGeneralInformation.cs
index b70a3b15277d5accdb610c1503478cd20704d90a..be645c30e8f3f363f2aad82535880ca784e6fede 100644
--- a/pdf-generator/DocumentStructures/EvaluationReport/CourseGeneralInformation.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/CourseGeneralInformation.cs
@@ -1,13 +1,13 @@
using iText.Layout;
using iText.Layout.Element;
-using PDFGenerator.Utilities;
-using PDFGenerator.Models.EvaluationReport;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport;
using System.Collections.Generic;
using System.Linq;
-using static PDFGenerator.Utilities.Globals;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-namespace PDFGenerator.DocumentStructures.EvaluationReport
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport
{
public class CourseGeneralInformation : EvaluationReportBaseSection
{
diff --git a/pdf-generator/DocumentStructures/EvaluationReport/CourseInformationTables.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/CourseInformationTables.cs
similarity index 91%
rename from pdf-generator/DocumentStructures/EvaluationReport/CourseInformationTables.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/CourseInformationTables.cs
index 664b8512db4bbec11cff2a57389ecef60206bb8e..98789a1549e98de8e221aa7e578c35ba94a921b5 100644
--- a/pdf-generator/DocumentStructures/EvaluationReport/CourseInformationTables.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/CourseInformationTables.cs
@@ -1,118 +1,118 @@
-using iText.Kernel.Colors;
+using iText.Kernel.Colors;
using iText.Kernel.Pdf.Action;
-using iText.Layout;
-using iText.Layout.Element;
-using iText.Layout.Properties;
-using PDFGenerator.Models.EvaluationReport;
-using PDFGenerator.Utilities;
-using System.Collections.Generic;
-using System.Linq;
-using static PDFGenerator.Utilities.Globals;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-
-namespace PDFGenerator.DocumentStructures.EvaluationReport
-{
- public class CourseInformationTables : EvaluationReportBaseSection
- {
- private PDFCourseInformationTables Tables { get; }
- public CourseInformationTables(PDFCourseInformationTables tables, Document document, Bookmarks bookmarks, TableOfContents tableOfContents)
- : base(document, bookmarks, tableOfContents)
- {
- Tables = tables;
- }
-
- ///
- /// Renders the tables for general course information.
- ///
- public override void Render()
- {
- // negative values indicate that a specific expression should not be considered neither in the bookmark tree nor in table of contents
- string[] sections = Tables.Sections.Where(section => section.Value >= 0).Select(section => section.Key).ToArray();
- string[] tableTitles = Tables.Sections.Where(section => section.Value < 0).Select(section => section.Key).ToArray();
- int sectionCount = 0;
-
- Bookmarks.AddRootOutline(sections[sectionCount], RootOutline);
-
- TocItem tocItem = new TocItem
- {
- Title = sections[sectionCount],
- Indent = Tables.Sections[sections[sectionCount]],
- Page = GetCurrentPage()
- };
- TableOfContents.AddToTOC(tocItem);
-
- Paragraph p = new Paragraph(new Text(sections[sectionCount]).AddStyle(Styles.ChapterTitle)).SetDestination(sections[sectionCount++]);
- Document.Add(p);
-
-
- Table table;
- foreach (List> TablesForSubject in Tables.Tables)
- {
- Bookmarks.AddOutline(sections[sectionCount], OutlineLevel.Level1);
-
- tocItem = new TocItem
- {
- Title = sections[sectionCount],
- Indent = Tables.Sections[sections[sectionCount]],
- Page = GetCurrentPage()
- };
- TableOfContents.AddToTOC(tocItem);
-
- p = new Paragraph(new Text(sections[sectionCount]).AddStyle(Styles.ChapterSubtitle)).SetDestination(sections[sectionCount++]);
- Document.Add(p);
-
- AddLineBreak();
-
- int listCount = 0;
- foreach (List entry in TablesForSubject)
- {
- // specific for po-version tables if available
- if (listCount > 0 && listCount < TablesForSubject.Count - 1)
- {
- string header = listCount == 1 ? tableTitles[0] : tableTitles[1];
-
- p = new Paragraph(new Text(header).AddStyle(Styles.ChapterSubtitle));
- Document.Add(p);
- AddLineBreak();
- }
- // add more distance between tables
- else if (listCount > 0)
- {
- Document.Add(new Paragraph(string.Empty).SetMarginBottom(8f));
- }
-
-
- table = new Table(UnitValue.CreatePercentArray(new float[] { 1f, 1f }))
- .SetWidth(UnitValue.CreatePercentValue(100))
- .SetFixedLayout()
- .SetMarginTop(-2f)
- .SetMarginBottom(10f);
-
- foreach (CourseInformationTableEntry item in entry)
- {
- AddCell(table, item.Title, true);
- AddCell(table, item.Content != null ? item.Content : "", false, item.IsLink);
- }
-
- listCount++;
- Document.Add(table);
- }
- }
-
- AddPageBreak();
+using iText.Layout;
+using iText.Layout.Element;
+using iText.Layout.Properties;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport;
+using System.Collections.Generic;
+using System.Linq;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport
+{
+ public class CourseInformationTables : EvaluationReportBaseSection
+ {
+ private PDFCourseInformationTables Tables { get; }
+ public CourseInformationTables(PDFCourseInformationTables tables, Document document, Bookmarks bookmarks, TableOfContents tableOfContents)
+ : base(document, bookmarks, tableOfContents)
+ {
+ Tables = tables;
+ }
+
+ ///
+ /// Renders the tables for general course information.
+ ///
+ public override void Render()
+ {
+ // negative values indicate that a specific expression should not be considered neither in the bookmark tree nor in table of contents
+ string[] sections = Tables.Sections.Where(section => section.Value >= 0).Select(section => section.Key).ToArray();
+ string[] tableTitles = Tables.Sections.Where(section => section.Value < 0).Select(section => section.Key).ToArray();
+ int sectionCount = 0;
+
+ Bookmarks.AddRootOutline(sections[sectionCount], RootOutline);
+
+ TocItem tocItem = new TocItem
+ {
+ Title = sections[sectionCount],
+ Indent = Tables.Sections[sections[sectionCount]],
+ Page = GetCurrentPage()
+ };
+ TableOfContents.AddToTOC(tocItem);
+
+ Paragraph p = new Paragraph(new Text(sections[sectionCount]).AddStyle(Styles.ChapterTitle)).SetDestination(sections[sectionCount++]);
+ Document.Add(p);
+
+
+ Table table;
+ foreach (List> TablesForSubject in Tables.Tables)
+ {
+ Bookmarks.AddOutline(sections[sectionCount], OutlineLevel.Level1);
+
+ tocItem = new TocItem
+ {
+ Title = sections[sectionCount],
+ Indent = Tables.Sections[sections[sectionCount]],
+ Page = GetCurrentPage()
+ };
+ TableOfContents.AddToTOC(tocItem);
+
+ p = new Paragraph(new Text(sections[sectionCount]).AddStyle(Styles.ChapterSubtitle)).SetDestination(sections[sectionCount++]);
+ Document.Add(p);
+
+ AddLineBreak();
+
+ int listCount = 0;
+ foreach (List entry in TablesForSubject)
+ {
+ // specific for po-version tables if available
+ if (listCount > 0 && listCount < TablesForSubject.Count - 1)
+ {
+ string header = listCount == 1 ? tableTitles[0] : tableTitles[1];
+
+ p = new Paragraph(new Text(header).AddStyle(Styles.ChapterSubtitle));
+ Document.Add(p);
+ AddLineBreak();
+ }
+ // add more distance between tables
+ else if (listCount > 0)
+ {
+ Document.Add(new Paragraph(string.Empty).SetMarginBottom(8f));
+ }
+
+
+ table = new Table(UnitValue.CreatePercentArray(new float[] { 1f, 1f }))
+ .SetWidth(UnitValue.CreatePercentValue(100))
+ .SetFixedLayout()
+ .SetMarginTop(-2f)
+ .SetMarginBottom(10f);
+
+ foreach (CourseInformationTableEntry item in entry)
+ {
+ AddCell(table, item.Title, true);
+ AddCell(table, item.Content != null ? item.Content : "", false, item.IsLink);
+ }
+
+ listCount++;
+ Document.Add(table);
+ }
+ }
+
+ AddPageBreak();
}
- ///
- /// Adds a new cell to table.
- ///
- /// The table on which a new cell is added.
- /// The cell content.
+ ///
+ /// Adds a new cell to table.
+ ///
+ /// The table on which a new cell is added.
+ /// The cell content.
/// Flag to differentiate between left and right column.
- /// Falg to differentiate between normal text an a clickable link
- private void AddCell(Table table, string text, bool leftColumn, bool isLink = false)
+ /// Falg to differentiate between normal text an a clickable link
+ private void AddCell(Table table, string text, bool leftColumn, bool isLink = false)
{
- Text cellContent;
+ Text cellContent;
if (isLink)
{
cellContent = new Link(text, PdfAction.CreateURI(text));
@@ -120,19 +120,19 @@ namespace PDFGenerator.DocumentStructures.EvaluationReport
else
{
cellContent = new Text(text);
- }
+ }
Cell cell = new Cell().Add(
new Paragraph(
cellContent.AddStyle(Styles.Small).SetFontColor(ColorConstants.BLACK)
).SetMultipliedLeading(0.9f)
).SetKeepTogether(true)
- .SetPadding(4.7f);
- if (leftColumn)
- {
- cell.SetBackgroundColor(new DeviceRgb(142, 186, 229));
- }
-
- table.AddCell(cell);
- }
- }
-}
+ .SetPadding(4.7f);
+ if (leftColumn)
+ {
+ cell.SetBackgroundColor(new DeviceRgb(142, 186, 229));
+ }
+
+ table.AddCell(cell);
+ }
+ }
+}
diff --git a/pdf-generator/DocumentStructures/EvaluationReport/Cover.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/Cover.cs
similarity index 87%
rename from pdf-generator/DocumentStructures/EvaluationReport/Cover.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/Cover.cs
index f46d4c8f774d00ff70d956d72fa76378651d46d8..9457fa3ac86f14d18d7915d5eea19335ab0d472e 100644
--- a/pdf-generator/DocumentStructures/EvaluationReport/Cover.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/Cover.cs
@@ -3,14 +3,14 @@ using iText.Kernel.Geom;
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.Utilities;
-using PDFGenerator.Models.EvaluationReport;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport;
using System;
-using static PDFGenerator.Utilities.Conversion;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Conversion;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-namespace PDFGenerator.DocumentStructures.EvaluationReport
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport
{
public class Cover : EvaluationReportBaseSection
{
diff --git a/pdf-generator/DocumentStructures/EvaluationReport/CriterionTarget.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/CriterionTarget.cs
similarity index 92%
rename from pdf-generator/DocumentStructures/EvaluationReport/CriterionTarget.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/CriterionTarget.cs
index a7b46c409ec576f23932ae8f833ab17c481760ec..fab07933e43aea68830813cfa2a34968fd3853df 100644
--- a/pdf-generator/DocumentStructures/EvaluationReport/CriterionTarget.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/CriterionTarget.cs
@@ -1,14 +1,14 @@
using iText.Kernel.Colors;
using iText.Layout;
using iText.Layout.Element;
-using PDFGenerator.Utilities;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
using System.Collections.Generic;
using System.Linq;
-using static PDFGenerator.Utilities.Globals;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-using Target = PDFGenerator.Models.EvaluationReport.CriterionTarget;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+using Target = PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport.CriterionTarget;
-namespace PDFGenerator.DocumentStructures.EvaluationReport
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport
{
public class CriterionTarget : EvaluationReportBaseSection
{
diff --git a/pdf-generator/DocumentStructures/EvaluationReport/EvaluationReportBaseSection.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/EvaluationReportBaseSection.cs
similarity index 93%
rename from pdf-generator/DocumentStructures/EvaluationReport/EvaluationReportBaseSection.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/EvaluationReportBaseSection.cs
index cbcbe52a72f09426135b1f9075588250afa71d30..63ae842f342b84145a7088f7a24ae71e08ee90b7 100644
--- a/pdf-generator/DocumentStructures/EvaluationReport/EvaluationReportBaseSection.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/EvaluationReportBaseSection.cs
@@ -1,171 +1,171 @@
-using iText.IO.Image;
-using iText.Kernel.Geom;
-using iText.Kernel.Pdf;
-using iText.Kernel.Pdf.Action;
-using iText.Layout;
-using iText.Layout.Borders;
-using iText.Layout.Element;
-using iText.Layout.Properties;
-using PDFGenerator.Utilities;
-using PDFGenerator.Models.EvaluationReport;
-using System.Collections.Generic;
-using System.IO;
-using System.Text.RegularExpressions;
-using static PDFGenerator.Utilities.Globals;
-
-namespace PDFGenerator.DocumentStructures.EvaluationReport
-{
- public abstract class EvaluationReportBaseSection : BaseSection
+using iText.IO.Image;
+using iText.Kernel.Geom;
+using iText.Kernel.Pdf;
+using iText.Kernel.Pdf.Action;
+using iText.Layout;
+using iText.Layout.Borders;
+using iText.Layout.Element;
+using iText.Layout.Properties;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport;
+using System.Collections.Generic;
+using System.IO;
+using System.Text.RegularExpressions;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport
+{
+ public abstract class EvaluationReportBaseSection : BaseSection
{
- protected TableOfContents TableOfContents { get; set; }
-
- public EvaluationReportBaseSection(Document document, Bookmarks bookmarks, TableOfContents tableOfContents) : base(document, bookmarks)
- {
+ protected TableOfContents TableOfContents { get; set; }
+
+ public EvaluationReportBaseSection(Document document, Bookmarks bookmarks, TableOfContents tableOfContents) : base(document, bookmarks)
+ {
TableOfContents = tableOfContents;
- }
-
- ///
- /// Renders the content in each section.
- ///
- public abstract void Render();
-
- ///
- /// Adds upload files directly to the document if they are images.
- /// Uploads consisting of PDF files are added to the available custom uploads to be rendered as attachments in appendix
- /// 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.
- ///
- /// New custom uploads to be considered.
- /// Already available custom uploads.
- protected void AddCustomUploads(CustomUploads uploads, Dictionary customUploads)
- {
- if (uploads.Files == null)
- {
- if (!string.IsNullOrEmpty(uploads.Paragraph))
- {
- Document.Add(ParagraphFactory.GetStandardParagraph(uploads.Paragraph));
- return;
- }
-
- return;
- }
-
- bool imagesAvailable = false;
- foreach (KeyValuePair file in uploads.Files)
- {
- // only accept files in image or PDF format, otherwise an exception is thrown below
-
- // firstly, check if file is a valid image
- if (ImageDataFactory.IsSupportedType(file.Value))
- {
- ImageData imageData = ImageDataFactory.Create(file.Value);
- Image image = new Image(imageData)
- .SetMarginTop(10f)
- .SetHorizontalAlignment(HorizontalAlignment.CENTER)
- .SetMarginBottom(15f);
-
- AddScaledImage(image);
- imagesAvailable = true;
-
- continue;
- }
-
- // secondly, if data does not correspond to a PDF file, an exception is thrown
- new PdfReader(new MemoryStream(file.Value));
-
- if (!customUploads.ContainsKey(file.Key))
- {
- customUploads.Add(file.Key, file.Value);
- }
-
- // ensure that the sentence is only written once
- if (customUploads.Count == 1)
- {
- Document.Add(ParagraphFactory.GetStandardParagraph("Weitere Dokumente siehe Anhang."));
- }
-
- Document.Add(
- ParagraphFactory.GetStandardParagraph(file.Key)
- .SetMarginTop(-2f)
- .SetAction(PdfAction.CreateGoTo(file.Key))
- );
- };
-
- if (!imagesAvailable && !string.IsNullOrEmpty(uploads.Paragraph))
- {
- Document.Add(ParagraphFactory.GetStandardParagraph(uploads.Paragraph));
- }
- }
-
- ///
- /// Adds paragraph above the table.
- ///
- /// The table on which the paragraph is added.
- /// The paragraphs content.
- /// Flag indicating whether the content is a table header.
- /// Given style for paragraph.
- protected void AddParagraphWithLeadingToTable(Table table, string text, bool header, Style style = null)
- {
- Cell cell = new Cell().SetBorder(Border.NO_BORDER);
- Paragraph p;
-
- if (header)
- {
- cell.SetPaddingTop(12.5f).SetPaddingBottom(7f);
- p = ParagraphFactory.GetTableHeaderParagraph(text, style);
- }
- else
- {
- cell.SetPaddingTop(0f);
- p = ParagraphFactory.GetStandardParagraph(text);
- }
- p.SetKeepTogether(true);
-
- cell.Add(p);
- table.AddCell(cell);
- }
-
- ///
- /// Changes the page orientation.
- ///
- /// Orientation to change to.
- protected void SetPageOrientation(Orientation orientation)
- {
- if (orientation == Orientation.Landscape)
- {
- Document.GetPdfDocument().SetDefaultPageSize(PageSize.A4.Rotate());
- return;
- }
-
- Document.GetPdfDocument().SetDefaultPageSize(PageSize.A4);
- }
-
- ///
- /// Adds line break to document.
- ///
- protected void AddLineBreak()
- {
- Document.Add(ParagraphFactory.GetTableHeaderParagraph(string.Empty));
- }
-
- ///
- /// Prevents the default trim of leading whitespaces in the string
- /// and immediately after a linebreak on iText7 by adding a NULL character ('\u0000')
- ///
- /// Text which leading whitespaces to be preserved.
- /// Text with preserved leading whitespaces.
- protected string PreserveLeadingSpaces(string text)
- {
- return "\u0000" + Regex.Replace(text, @"\n", "\n\u0000");
- }
-
- ///
- /// Adds scaled image to document.
- ///
- /// Image to add do document.
- private void AddScaledImage(Image image)
- {
- Document.Add(GetScaledImage(image));
- }
- }
-}
+ }
+
+ ///
+ /// Renders the content in each section.
+ ///
+ public abstract void Render();
+
+ ///
+ /// Adds upload files directly to the document if they are images.
+ /// Uploads consisting of PDF files are added to the available custom uploads to be rendered as attachments in appendix
+ /// 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.
+ ///
+ /// New custom uploads to be considered.
+ /// Already available custom uploads.
+ protected void AddCustomUploads(CustomUploads uploads, Dictionary customUploads)
+ {
+ if (uploads.Files == null)
+ {
+ if (!string.IsNullOrEmpty(uploads.Paragraph))
+ {
+ Document.Add(ParagraphFactory.GetStandardParagraph(uploads.Paragraph));
+ return;
+ }
+
+ return;
+ }
+
+ bool imagesAvailable = false;
+ foreach (KeyValuePair file in uploads.Files)
+ {
+ // only accept files in image or PDF format, otherwise an exception is thrown below
+
+ // firstly, check if file is a valid image
+ if (ImageDataFactory.IsSupportedType(file.Value))
+ {
+ ImageData imageData = ImageDataFactory.Create(file.Value);
+ Image image = new Image(imageData)
+ .SetMarginTop(10f)
+ .SetHorizontalAlignment(HorizontalAlignment.CENTER)
+ .SetMarginBottom(15f);
+
+ AddScaledImage(image);
+ imagesAvailable = true;
+
+ continue;
+ }
+
+ // secondly, if data does not correspond to a PDF file, an exception is thrown
+ new PdfReader(new MemoryStream(file.Value));
+
+ if (!customUploads.ContainsKey(file.Key))
+ {
+ customUploads.Add(file.Key, file.Value);
+ }
+
+ // ensure that the sentence is only written once
+ if (customUploads.Count == 1)
+ {
+ Document.Add(ParagraphFactory.GetStandardParagraph("Weitere Dokumente siehe Anhang."));
+ }
+
+ Document.Add(
+ ParagraphFactory.GetStandardParagraph(file.Key)
+ .SetMarginTop(-2f)
+ .SetAction(PdfAction.CreateGoTo(file.Key))
+ );
+ };
+
+ if (!imagesAvailable && !string.IsNullOrEmpty(uploads.Paragraph))
+ {
+ Document.Add(ParagraphFactory.GetStandardParagraph(uploads.Paragraph));
+ }
+ }
+
+ ///
+ /// Adds paragraph above the table.
+ ///
+ /// The table on which the paragraph is added.
+ /// The paragraphs content.
+ /// Flag indicating whether the content is a table header.
+ /// Given style for paragraph.
+ protected void AddParagraphWithLeadingToTable(Table table, string text, bool header, Style style = null)
+ {
+ Cell cell = new Cell().SetBorder(Border.NO_BORDER);
+ Paragraph p;
+
+ if (header)
+ {
+ cell.SetPaddingTop(12.5f).SetPaddingBottom(7f);
+ p = ParagraphFactory.GetTableHeaderParagraph(text, style);
+ }
+ else
+ {
+ cell.SetPaddingTop(0f);
+ p = ParagraphFactory.GetStandardParagraph(text);
+ }
+ p.SetKeepTogether(true);
+
+ cell.Add(p);
+ table.AddCell(cell);
+ }
+
+ ///
+ /// Changes the page orientation.
+ ///
+ /// Orientation to change to.
+ protected void SetPageOrientation(Orientation orientation)
+ {
+ if (orientation == Orientation.Landscape)
+ {
+ Document.GetPdfDocument().SetDefaultPageSize(PageSize.A4.Rotate());
+ return;
+ }
+
+ Document.GetPdfDocument().SetDefaultPageSize(PageSize.A4);
+ }
+
+ ///
+ /// Adds line break to document.
+ ///
+ protected void AddLineBreak()
+ {
+ Document.Add(ParagraphFactory.GetTableHeaderParagraph(string.Empty));
+ }
+
+ ///
+ /// Prevents the default trim of leading whitespaces in the string
+ /// and immediately after a linebreak on iText7 by adding a NULL character ('\u0000')
+ ///
+ /// Text which leading whitespaces to be preserved.
+ /// Text with preserved leading whitespaces.
+ protected string PreserveLeadingSpaces(string text)
+ {
+ return "\u0000" + Regex.Replace(text, @"\n", "\n\u0000");
+ }
+
+ ///
+ /// Adds scaled image to document.
+ ///
+ /// Image to add do document.
+ private void AddScaledImage(Image image)
+ {
+ Document.Add(GetScaledImage(image));
+ }
+ }
+}
diff --git a/pdf-generator/DocumentStructures/EvaluationReport/EvaluationResults.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/EvaluationResults.cs
similarity index 95%
rename from pdf-generator/DocumentStructures/EvaluationReport/EvaluationResults.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/EvaluationResults.cs
index 15d047b0424e9d4fd83906b83a9e9899a5708503..df9758cdc7f8e5eceb150737450d428b10d22247 100644
--- a/pdf-generator/DocumentStructures/EvaluationReport/EvaluationResults.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/EvaluationResults.cs
@@ -3,13 +3,13 @@ using iText.Layout;
using iText.Layout.Borders;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.Models.EvaluationReport;
-using PDFGenerator.Utilities;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport;
using System.Collections.Generic;
-using static PDFGenerator.Utilities.Globals;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-namespace PDFGenerator.DocumentStructures.EvaluationReport
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport
{
public class EvaluationResults : EvaluationReportBaseSection
{
diff --git a/pdf-generator/DocumentStructures/EvaluationReport/KpiEvaluation.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/KpiEvaluation.cs
similarity index 89%
rename from pdf-generator/DocumentStructures/EvaluationReport/KpiEvaluation.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/KpiEvaluation.cs
index cd7de182d2695c6aaba76b59aececcf5ca62550d..4e86dddc2dce4b77b8031c2ff0bad216a4b9b54c 100644
--- a/pdf-generator/DocumentStructures/EvaluationReport/KpiEvaluation.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/KpiEvaluation.cs
@@ -2,14 +2,14 @@ using iText.Kernel.Colors;
using iText.Layout;
using iText.Layout.Borders;
using iText.Layout.Element;
-using PDFGenerator.Utilities;
-using PDFGenerator.Models.EvaluationReport;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport;
using System.Collections.Generic;
-using Constants = PDFGenerator.Utilities.Globals.Constants;
-using KPIEvaluation = PDFGenerator.Models.EvaluationReport.KpiEvaluation;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+using Constants = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants;
+using KPIEvaluation = PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport.KpiEvaluation;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-namespace PDFGenerator.DocumentStructures.EvaluationReport
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport
{
public class KpiEvaluation : EvaluationReportBaseSection
{
diff --git a/pdf-generator/DocumentStructures/EvaluationReport/KpiEvaluationReports.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/KpiEvaluationReports.cs
similarity index 91%
rename from pdf-generator/DocumentStructures/EvaluationReport/KpiEvaluationReports.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/KpiEvaluationReports.cs
index e87fde057a4a64deab9535d16d6a46828aa26e16..062e39bcb70ede2b10cadd5dc22900c323f1cc73 100644
--- a/pdf-generator/DocumentStructures/EvaluationReport/KpiEvaluationReports.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/KpiEvaluationReports.cs
@@ -1,182 +1,182 @@
-using iText.IO.Image;
-using iText.Kernel.Pdf.Action;
-using iText.Layout;
-using iText.Layout.Borders;
-using iText.Layout.Element;
-using PDFGenerator.Utilities;
-using PDFGenerator.Models.EvaluationReport;
-using System.Collections.Generic;
-using Reports = PDFGenerator.Models.EvaluationReport.KpiEvaluationReports;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-
-namespace PDFGenerator.DocumentStructures.EvaluationReport
-{
- public class KpiEvaluationReports : EvaluationReportBaseSection
- {
- private Reports Reports { get; }
- private Table Table { get; set; }
- private Dictionary CustomUploads { get; set; }
-
- public KpiEvaluationReports(Reports reports, Dictionary customUploads, Document document,
- Bookmarks bookmarks, TableOfContents tableOfContents) : base(document, bookmarks, tableOfContents)
- {
- Reports = reports;
- CustomUploads = customUploads;
- }
-
- ///
- /// Renders the report section for the current kpi.
- ///
- public override void Render()
- {
- if (Reports.Paragraphs != null)
- {
+using iText.IO.Image;
+using iText.Kernel.Pdf.Action;
+using iText.Layout;
+using iText.Layout.Borders;
+using iText.Layout.Element;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport;
+using System.Collections.Generic;
+using Reports = PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport.KpiEvaluationReports;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport
+{
+ public class KpiEvaluationReports : EvaluationReportBaseSection
+ {
+ private Reports Reports { get; }
+ private Table Table { get; set; }
+ private Dictionary CustomUploads { get; set; }
+
+ public KpiEvaluationReports(Reports reports, Dictionary customUploads, Document document,
+ Bookmarks bookmarks, TableOfContents tableOfContents) : base(document, bookmarks, tableOfContents)
+ {
+ Reports = reports;
+ CustomUploads = customUploads;
+ }
+
+ ///
+ /// Renders the report section for the current kpi.
+ ///
+ public override void Render()
+ {
+ if (Reports.Paragraphs != null)
+ {
Table = new Table(1, false).UseAllAvailableWidth().SetMarginTop(-10f);
AddParagraphWithLeadingToTable(Table, Reports.Paragraphs[0], true);
AddLinks();
- AddReports();
-
+ AddReports();
+
Document.Add(Table);
- }
-
+ }
+
if (Reports.UploadedFilesForKpi != null)
{
AddCustomUploads(Reports.UploadedFilesForKpi, CustomUploads);
- }
- }
-
- ///
- /// Adds links for the report section.
- ///
- private void AddLinks()
- {
- if (Reports.ExternalLinks != null)
- {
- Link link;
- Paragraph hyperlink;
- foreach (KeyValuePair item in Reports.ExternalLinks)
- {
- link = new Link(item.Key, PdfAction.CreateURI(item.Value));
- link.AddStyle(Styles.Link);
-
- hyperlink = new Paragraph(link).SetMarginTop(-1f).SetMultipliedLeading(1f);
-
- Table.AddCell(new Cell().Add(hyperlink).SetBorder(Border.NO_BORDER).SetPaddingBottom(9f));
- }
- }
-
- if (Reports.InternalLinksOnSamePhrase != null)
- {
- Paragraph links;
- Link link;
- foreach (List linkSet in Reports.InternalLinksOnSamePhrase)
- {
- string expression = "Report(s) siehe Anhang. (";
- links = ParagraphFactory.GetCustomParagraph(expression, Styles.Paragraph, 0, 9, 1f);
-
- for (int i = 0; i < linkSet.Count; i++)
- {
- link = new Link(linkSet[i], PdfAction.CreateGoTo(linkSet[i]));
- link.AddStyle(Styles.Paragraph);
- links.Add(link);
- if (i < linkSet.Count - 1)
- {
- links.Add(", ");
- }
- }
-
- links.Add(")");
- Table.AddCell(new Cell().Add(links).SetBorder(Border.NO_BORDER).SetPaddingBottom(9f));
- }
- }
-
- if (Reports.InternalLinks != null)
- {
- foreach (KeyValuePair item in Reports.InternalLinks)
- {
- Paragraph link = ParagraphFactory.GetStandardParagraph(item.Key)
- .SetMarginTop(-2f)
- .SetAction(PdfAction.CreateGoTo(item.Value));
-
- Table.AddCell(new Cell().Add(link).SetBorder(Border.NO_BORDER).SetPaddingBottom(0f));
- }
- }
- }
-
- ///
- /// Adds reports and/or paragraphs for the report section.
- ///
- private void AddReports()
- {
- if (Reports.Reports == null)
- {
- // index 0 is reserved for the headline
- for (int i = 1; i < Reports.Paragraphs.Count; i++)
- {
- Paragraph p = ParagraphFactory.GetStandardParagraph(Reports.Paragraphs[i]);
- Table.AddCell(new Cell().SetPaddingTop(0f).SetBorder(Border.NO_BORDER).Add(p));
- }
-
- return;
- }
-
- AddPageBreak();
-
- // if order between images and text is important
- if (Reports.ReportElementOrder != null)
- {
- int countImages = 0;
- int countParagraphs = 1;
- Reports.ReportElementOrder.ForEach(type =>
- {
- if (type == LayoutElement.Image)
- {
- AddImageToTable(Reports.Reports[countImages++]);
- }
-
- if (type == LayoutElement.Paragraph)
- {
- Paragraph p = ParagraphFactory.GetStandardParagraph(Reports.Paragraphs[countParagraphs++]);
- Table.AddCell(new Cell().SetPaddingTop(0f).SetBorder(Border.NO_BORDER).Add(p));
- }
- });
-
- return;
- }
-
- Reports.Reports.ForEach(item =>
- {
- if (item != null)
- {
- AddImageToTable(item);
- }
- });
- }
-
- ///
- /// Adds a single report.
- ///
- /// List of images representing the report.
- private void AddImageToTable(List images)
- {
- ImageData imageData;
- Image image;
- foreach (byte[] imageB in images)
- {
- imageData = ImageDataFactory.Create(imageB);
- image = new Image(imageData);
-
- Cell cell = new Cell()
- .Add(GetScaledImage(image))
- .SetBorder(Border.NO_BORDER)
- .SetPadding(0)
- .SetPaddingBottom(12f);
-
- Table.AddCell(cell);
- }
- }
- }
-}
+ }
+ }
+
+ ///
+ /// Adds links for the report section.
+ ///
+ private void AddLinks()
+ {
+ if (Reports.ExternalLinks != null)
+ {
+ Link link;
+ Paragraph hyperlink;
+ foreach (KeyValuePair item in Reports.ExternalLinks)
+ {
+ link = new Link(item.Key, PdfAction.CreateURI(item.Value));
+ link.AddStyle(Styles.Link);
+
+ hyperlink = new Paragraph(link).SetMarginTop(-1f).SetMultipliedLeading(1f);
+
+ Table.AddCell(new Cell().Add(hyperlink).SetBorder(Border.NO_BORDER).SetPaddingBottom(9f));
+ }
+ }
+
+ if (Reports.InternalLinksOnSamePhrase != null)
+ {
+ Paragraph links;
+ Link link;
+ foreach (List linkSet in Reports.InternalLinksOnSamePhrase)
+ {
+ string expression = "Report(s) siehe Anhang. (";
+ links = ParagraphFactory.GetCustomParagraph(expression, Styles.Paragraph, 0, 9, 1f);
+
+ for (int i = 0; i < linkSet.Count; i++)
+ {
+ link = new Link(linkSet[i], PdfAction.CreateGoTo(linkSet[i]));
+ link.AddStyle(Styles.Paragraph);
+ links.Add(link);
+ if (i < linkSet.Count - 1)
+ {
+ links.Add(", ");
+ }
+ }
+
+ links.Add(")");
+ Table.AddCell(new Cell().Add(links).SetBorder(Border.NO_BORDER).SetPaddingBottom(9f));
+ }
+ }
+
+ if (Reports.InternalLinks != null)
+ {
+ foreach (KeyValuePair item in Reports.InternalLinks)
+ {
+ Paragraph link = ParagraphFactory.GetStandardParagraph(item.Key)
+ .SetMarginTop(-2f)
+ .SetAction(PdfAction.CreateGoTo(item.Value));
+
+ Table.AddCell(new Cell().Add(link).SetBorder(Border.NO_BORDER).SetPaddingBottom(0f));
+ }
+ }
+ }
+
+ ///
+ /// Adds reports and/or paragraphs for the report section.
+ ///
+ private void AddReports()
+ {
+ if (Reports.Reports == null)
+ {
+ // index 0 is reserved for the headline
+ for (int i = 1; i < Reports.Paragraphs.Count; i++)
+ {
+ Paragraph p = ParagraphFactory.GetStandardParagraph(Reports.Paragraphs[i]);
+ Table.AddCell(new Cell().SetPaddingTop(0f).SetBorder(Border.NO_BORDER).Add(p));
+ }
+
+ return;
+ }
+
+ AddPageBreak();
+
+ // if order between images and text is important
+ if (Reports.ReportElementOrder != null)
+ {
+ int countImages = 0;
+ int countParagraphs = 1;
+ Reports.ReportElementOrder.ForEach(type =>
+ {
+ if (type == LayoutElement.Image)
+ {
+ AddImageToTable(Reports.Reports[countImages++]);
+ }
+
+ if (type == LayoutElement.Paragraph)
+ {
+ Paragraph p = ParagraphFactory.GetStandardParagraph(Reports.Paragraphs[countParagraphs++]);
+ Table.AddCell(new Cell().SetPaddingTop(0f).SetBorder(Border.NO_BORDER).Add(p));
+ }
+ });
+
+ return;
+ }
+
+ Reports.Reports.ForEach(item =>
+ {
+ if (item != null)
+ {
+ AddImageToTable(item);
+ }
+ });
+ }
+
+ ///
+ /// Adds a single report.
+ ///
+ /// List of images representing the report.
+ private void AddImageToTable(List images)
+ {
+ ImageData imageData;
+ Image image;
+ foreach (byte[] imageB in images)
+ {
+ imageData = ImageDataFactory.Create(imageB);
+ image = new Image(imageData);
+
+ Cell cell = new Cell()
+ .Add(GetScaledImage(image))
+ .SetBorder(Border.NO_BORDER)
+ .SetPadding(0)
+ .SetPaddingBottom(12f);
+
+ Table.AddCell(cell);
+ }
+ }
+ }
+}
diff --git a/pdf-generator/DocumentStructures/EvaluationReport/Preface.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/Preface.cs
similarity index 93%
rename from pdf-generator/DocumentStructures/EvaluationReport/Preface.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/Preface.cs
index 2f58e651c5688c72578a9f257f5908b1fc772159..10c4e30cd49b9a1f01a5896c97ad014e2e416387 100644
--- a/pdf-generator/DocumentStructures/EvaluationReport/Preface.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/Preface.cs
@@ -3,13 +3,13 @@ using iText.Layout;
using iText.Layout.Borders;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.Utilities;
-using PDFGenerator.Models.EvaluationReport;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport;
using System.Linq;
-using static PDFGenerator.Utilities.Globals;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-namespace PDFGenerator.DocumentStructures.EvaluationReport
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport
{
public class Preface : EvaluationReportBaseSection
{
diff --git a/pdf-generator/DocumentStructures/EvaluationReport/TableOfContents.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/TableOfContents.cs
similarity index 92%
rename from pdf-generator/DocumentStructures/EvaluationReport/TableOfContents.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/TableOfContents.cs
index 4d78040e09f63071e527d8ca06c2ece754488cdf..84ca5f51ee8cfcfc1c14149af06053abe54243d8 100644
--- a/pdf-generator/DocumentStructures/EvaluationReport/TableOfContents.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/EvaluationReport/TableOfContents.cs
@@ -1,147 +1,145 @@
-using iText.Kernel.Pdf.Action;
-using iText.Kernel.Pdf.Canvas.Draw;
-using iText.Layout;
-using iText.Layout.Element;
-using iText.Layout.Properties;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-
-namespace PDFGenerator.DocumentStructures.EvaluationReport
+using iText.Kernel.Pdf.Action;
+using iText.Kernel.Pdf.Canvas.Draw;
+using iText.Layout;
+using iText.Layout.Element;
+using iText.Layout.Properties;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport
{
+ public class TableOfContents : BaseTableOfContents
+ {
+ public TableOfContents(Document document) : base(document)
+ {
+ }
- public class TableOfContents : BaseTableOfContents
- {
- public TableOfContents(Document document) : base(document)
+ ///
+ /// Adds the table of contents to the document.
+ ///
+ /// The PDF document.
+ /// The page number for the beginning of appendix.
+ protected override void AddTOC(Document document, int appendixStart)
{
+ Paragraph paragraph = new Paragraph(new Text("Inhaltsverzeichnis").AddStyle(Styles.ChapterTitle)).SetMarginBottom(20f);
+ document.Add(paragraph);
+
+ float width = document.GetPdfDocument().GetDefaultPageSize().GetWidth();
+ TabStop tabStop = new TabStop(width, TabAlignment.RIGHT, new DottedLine()); // maximal document width exclusive margin
+
+ foreach (TocItem item in TocItems)
+ {
+ Text title = new Text(item.Title);
+ Text page = item.Page < appendixStart ? new Text("\t" + (TocPages + item.Page)) : new Text("\t" + ToRoman(item.Page + 1 - appendixStart));
+
+ if (item.Indent == 0)
+ {
+ title.AddStyle(Styles.ChapterSubtitle);
+ page.AddStyle(Styles.ChapterSubtitle);
+
+ paragraph = new Paragraph()
+ .AddTabStops(tabStop)
+ .Add(title)
+ .Add(new Tab())
+ .Add(page)
+ .SetAction(PdfAction.CreateGoTo(item.Title))
+ .SetMarginTop(10f);
+
+ document.Add(paragraph);
+ continue;
+ }
+ title.AddStyle(Styles.Paragraph);
+ page.AddStyle(Styles.Paragraph);
+
+ paragraph = new Paragraph()
+ .AddTabStops(tabStop)
+ .Add(title)
+ .Add(new Tab())
+ .Add(page)
+ .SetAction(PdfAction.CreateGoTo(item.Title))
+ .SetMarginTop(-1.43f)
+ .SetMarginLeft(17f * item.Indent)
+ .SetMultipliedLeading(1.4f);
+
+ document.Add(paragraph);
+ }
}
- ///
- /// Adds the table of contents to the document.
- ///
- /// The PDF document.
- /// The page number for the beginning of appendix.
- protected override void AddTOC(Document document, int appendixStart)
- {
- Paragraph paragraph = new Paragraph(new Text("Inhaltsverzeichnis").AddStyle(Styles.ChapterTitle)).SetMarginBottom(20f);
- document.Add(paragraph);
-
- float width = document.GetPdfDocument().GetDefaultPageSize().GetWidth();
- TabStop tabStop = new TabStop(width, TabAlignment.RIGHT, new DottedLine()); // maximal document width exclusive margin
-
- foreach (TocItem item in TocItems)
- {
- Text title = new Text(item.Title);
- Text page = item.Page < appendixStart ? new Text("\t" + (TocPages + item.Page)) : new Text("\t" + ToRoman(item.Page + 1 - appendixStart));
-
- if (item.Indent == 0)
- {
- title.AddStyle(Styles.ChapterSubtitle);
- page.AddStyle(Styles.ChapterSubtitle);
-
- paragraph = new Paragraph()
- .AddTabStops(tabStop)
- .Add(title)
- .Add(new Tab())
- .Add(page)
- .SetAction(PdfAction.CreateGoTo(item.Title))
- .SetMarginTop(10f);
-
- document.Add(paragraph);
- continue;
- }
-
- title.AddStyle(Styles.Paragraph);
- page.AddStyle(Styles.Paragraph);
-
- paragraph = new Paragraph()
- .AddTabStops(tabStop)
- .Add(title)
- .Add(new Tab())
- .Add(page)
- .SetAction(PdfAction.CreateGoTo(item.Title))
- .SetMarginTop(-1.43f)
- .SetMarginLeft(17f * item.Indent)
- .SetMultipliedLeading(1.4f);
-
- document.Add(paragraph);
+ ///
+ /// Converts a number to roman numerals.
+ ///
+ /// Page number to convert.
+ /// The converted number in roman numerals.
+ public static string ToRoman(int number)
+ {
+ if (number >= 1000)
+ {
+ return "m" + ToRoman(number - 1000);
+ }
+
+ if (number >= 900)
+ {
+ return "cm" + ToRoman(number - 900);
+ }
+
+ if (number >= 500)
+ {
+ return "d" + ToRoman(number - 500);
+ }
+
+ if (number >= 400)
+ {
+ return "cd" + ToRoman(number - 400);
}
- }
-
- ///
- /// Converts a number to roman numerals.
- ///
- /// Page number to convert.
- /// The converted number in roman numerals.
- public static string ToRoman(int number)
- {
- if (number >= 1000)
- {
- return "m" + ToRoman(number - 1000);
- }
-
- if (number >= 900)
- {
- return "cm" + ToRoman(number - 900);
- }
-
- if (number >= 500)
- {
- return "d" + ToRoman(number - 500);
- }
-
- if (number >= 400)
- {
- return "cd" + ToRoman(number - 400);
- }
-
- if (number >= 100)
- {
- return "c" + ToRoman(number - 100);
- }
-
- if (number >= 90)
- {
- return "xc" + ToRoman(number - 90);
- }
-
- if (number >= 50)
- {
- return "l" + ToRoman(number - 50);
- }
-
- if (number >= 40)
- {
- return "xl" + ToRoman(number - 40);
- }
-
- if (number >= 10)
- {
- return "x" + ToRoman(number - 10);
- }
-
- if (number >= 9)
- {
- return "ix" + ToRoman(number - 9);
- }
-
- if (number >= 5)
- {
- return "v" + ToRoman(number - 5);
- }
-
- if (number >= 4)
- {
- return "iv" + ToRoman(number - 4);
- }
-
- if (number >= 1)
- {
- return "i" + ToRoman(number - 1);
- }
-
- // if number < 1
- return string.Empty;
- }
- }
-}
+
+ if (number >= 100)
+ {
+ return "c" + ToRoman(number - 100);
+ }
+
+ if (number >= 90)
+ {
+ return "xc" + ToRoman(number - 90);
+ }
+
+ if (number >= 50)
+ {
+ return "l" + ToRoman(number - 50);
+ }
+
+ if (number >= 40)
+ {
+ return "xl" + ToRoman(number - 40);
+ }
+
+ if (number >= 10)
+ {
+ return "x" + ToRoman(number - 10);
+ }
+
+ if (number >= 9)
+ {
+ return "ix" + ToRoman(number - 9);
+ }
+
+ if (number >= 5)
+ {
+ return "v" + ToRoman(number - 5);
+ }
+
+ if (number >= 4)
+ {
+ return "iv" + ToRoman(number - 4);
+ }
+
+ if (number >= 1)
+ {
+ return "i" + ToRoman(number - 1);
+ }
+
+ // if number < 1
+ return string.Empty;
+ }
+ }
+}
diff --git a/pdf-generator/DocumentStructures/FactSheet/Chapter.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Chapter.cs
similarity index 97%
rename from pdf-generator/DocumentStructures/FactSheet/Chapter.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Chapter.cs
index bd7ba8952b24545c647cf54260a3db81fda5ec0c..d1f3e46afdf24109968f2f74b17a409ddcbccb12 100644
--- a/pdf-generator/DocumentStructures/FactSheet/Chapter.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Chapter.cs
@@ -3,12 +3,12 @@ using iText.Layout;
using iText.Layout.Borders;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.Models.FactSheet;
-using PDFGenerator.Utilities;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.FactSheet;
using System.Collections.Generic;
using System.Linq;
-namespace PDFGenerator.DocumentStructures.FactSheet
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.FactSheet
{
public class Chapter : FactSheetBaseSection
{
diff --git a/pdf-generator/DocumentStructures/FactSheet/Cover.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Cover.cs
similarity index 82%
rename from pdf-generator/DocumentStructures/FactSheet/Cover.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Cover.cs
index f9fdf169a011400edcdb5ada9a90c89626f5770a..678fd36ba5a3d5ff8cd3a0f393e8dcabbe2c8c57 100644
--- a/pdf-generator/DocumentStructures/FactSheet/Cover.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Cover.cs
@@ -1,9 +1,9 @@
using iText.Layout;
using iText.Layout.Properties;
-using PDFGenerator.Models.FactSheet;
-using PDFGenerator.Utilities;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.FactSheet;
-namespace PDFGenerator.DocumentStructures.FactSheet
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.FactSheet
{
public class Cover : FactSheetBaseSection
{
diff --git a/pdf-generator/DocumentStructures/FactSheet/FactSheetBaseSection.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/FactSheetBaseSection.cs
similarity index 78%
rename from pdf-generator/DocumentStructures/FactSheet/FactSheetBaseSection.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/FactSheetBaseSection.cs
index ae08ad022d563dec0bdc23ad585207a349c16518..d7e8b0c780eff87e0991dc28fe41a83dec34177e 100644
--- a/pdf-generator/DocumentStructures/FactSheet/FactSheetBaseSection.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/FactSheetBaseSection.cs
@@ -1,9 +1,9 @@
using iText.Layout;
-using PDFGenerator.Models.FactSheet;
+using PDSLLabs.QMSL.PDFGenerator.Models.FactSheet;
using System.Collections.Generic;
-using Styles = PDFGenerator.Utilities.Globals.Constants.FactSheet.Styles;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.FactSheet.Styles;
-namespace PDFGenerator.DocumentStructures.FactSheet
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.FactSheet
{
public abstract class FactSheetBaseSection : BaseSection
{
diff --git a/pdf-generator/DocumentStructures/FactSheet/Footer.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Footer.cs
similarity index 89%
rename from pdf-generator/DocumentStructures/FactSheet/Footer.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Footer.cs
index e790d43c13e243d8e050a5818c465b2ffa1df7e0..ecfbde1486c380eaf701c555ba4fc9dc8fd634ea 100644
--- a/pdf-generator/DocumentStructures/FactSheet/Footer.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Footer.cs
@@ -1,42 +1,42 @@
-using iText.Kernel.Geom;
-using iText.Layout;
-using iText.Layout.Element;
-using iText.Layout.Properties;
-using PDFGenerator.Models.FactSheet;
-using System;
-using static PDFGenerator.Utilities.Globals.Constants.FactSheet;
-
-namespace PDFGenerator.DocumentStructures.FactSheet
-{
- public class Footer : HeaderFooterBase
- {
- private PDFHeaderFooter PDFFooter { get; }
-
- public Footer(PDFHeaderFooter footer, Document document, System.IO.MemoryStream inputStream) : base(document, inputStream)
- {
- PDFFooter = footer;
- }
-
- ///
- /// Initializes content for footer.
- ///
- protected override void InitializeElements()
- {
- PageSize pageSize = GetPageSize();
-
- // add titles on the left/or right side
- if (PDFFooter.Titles != null)
- {
- if (PDFFooter.Titles.ContainsKey(Alignment.Left))
- {
- string text = string.Join(Environment.NewLine, PDFFooter.Titles[Alignment.Left]);
- AddItem(text, Margins.LeftMargin, TextAlignment.LEFT);
- }
-
- if (PDFFooter.Titles.ContainsKey(Alignment.Right))
- {
- string text = string.Join(Environment.NewLine, PDFFooter.Titles[Alignment.Right]);
- AddItem(text, pageSize.GetRight() - Margins.RightMargin, TextAlignment.RIGHT);
+using iText.Kernel.Geom;
+using iText.Layout;
+using iText.Layout.Element;
+using iText.Layout.Properties;
+using PDSLLabs.QMSL.PDFGenerator.Models.FactSheet;
+using System;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.FactSheet;
+
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.FactSheet
+{
+ public class Footer : HeaderFooterBase
+ {
+ private PDFHeaderFooter PDFFooter { get; }
+
+ public Footer(PDFHeaderFooter footer, Document document, System.IO.MemoryStream inputStream) : base(document, inputStream)
+ {
+ PDFFooter = footer;
+ }
+
+ ///
+ /// Initializes content for footer.
+ ///
+ protected override void InitializeElements()
+ {
+ PageSize pageSize = GetPageSize();
+
+ // add titles on the left/or right side
+ if (PDFFooter.Titles != null)
+ {
+ if (PDFFooter.Titles.ContainsKey(Alignment.Left))
+ {
+ string text = string.Join(Environment.NewLine, PDFFooter.Titles[Alignment.Left]);
+ AddItem(text, Margins.LeftMargin, TextAlignment.LEFT);
+ }
+
+ if (PDFFooter.Titles.ContainsKey(Alignment.Right))
+ {
+ string text = string.Join(Environment.NewLine, PDFFooter.Titles[Alignment.Right]);
+ AddItem(text, pageSize.GetRight() - Margins.RightMargin, TextAlignment.RIGHT);
}
}
@@ -48,20 +48,20 @@ namespace PDFGenerator.DocumentStructures.FactSheet
TextAlignment = TextAlignment.LEFT,
VerticalAlignment = VerticalAlignment.BOTTOM
};
- }
-
- ///
- /// Adds new pararaph to footer.
- ///
- /// The paragrah text to be added.
- /// The x-position.
- /// The text alignment.
- private void AddItem(string text, float positionX, TextAlignment alignment)
- {
- Paragraph content = new Paragraph(new Text(text).AddStyle(Styles.Footer))
+ }
+
+ ///
+ /// Adds new pararaph to footer.
+ ///
+ /// The paragrah text to be added.
+ /// The x-position.
+ /// The text alignment.
+ private void AddItem(string text, float positionX, TextAlignment alignment)
+ {
+ Paragraph content = new Paragraph(new Text(text).AddStyle(Styles.Footer))
.SetMultipliedLeading(1.0f);
- AddItem(content, positionX, PDFFooter.Indent, alignment, VerticalAlignment.BOTTOM);
- }
- }
-}
+ AddItem(content, positionX, PDFFooter.Indent, alignment, VerticalAlignment.BOTTOM);
+ }
+ }
+}
diff --git a/pdf-generator/DocumentStructures/FactSheet/Header.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Header.cs
similarity index 93%
rename from pdf-generator/DocumentStructures/FactSheet/Header.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Header.cs
index 294e6f474c7e270fdfc5a251a6576f6fc8e8efa4..f48a21f3905e1f0b00f1ea2800538baeed4c9b60 100644
--- a/pdf-generator/DocumentStructures/FactSheet/Header.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/Header.cs
@@ -3,14 +3,14 @@ using iText.Kernel.Geom;
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.Models.FactSheet;
+using PDSLLabs.QMSL.PDFGenerator.Models.FactSheet;
using System;
using System.IO;
using System.Linq;
-using static PDFGenerator.Utilities.Conversion;
-using static PDFGenerator.Utilities.Globals.Constants.FactSheet;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Conversion;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.FactSheet;
-namespace PDFGenerator.DocumentStructures.FactSheet
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.FactSheet
{
public class Header : HeaderFooterBase
{
diff --git a/pdf-generator/DocumentStructures/FactSheet/HeaderFooterBase.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/HeaderFooterBase.cs
similarity index 94%
rename from pdf-generator/DocumentStructures/FactSheet/HeaderFooterBase.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/HeaderFooterBase.cs
index 444fc131ccc6cba230dffb1c1253b99f8cf828a2..a971c369e09deda29e9ccbfb36757a0aaaad0920 100644
--- a/pdf-generator/DocumentStructures/FactSheet/HeaderFooterBase.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/FactSheet/HeaderFooterBase.cs
@@ -1,139 +1,139 @@
-using iText.IO.Image;
-using iText.Kernel.Geom;
-using iText.Kernel.Pdf;
-using iText.Kernel.Pdf.Canvas;
-using iText.Layout;
-using iText.Layout.Element;
-using iText.Layout.Properties;
-using System.Collections.Generic;
-using System.IO;
-using static PDFGenerator.Utilities.Globals.Constants.FactSheet;
+using iText.IO.Image;
+using iText.Kernel.Geom;
+using iText.Kernel.Pdf;
+using iText.Kernel.Pdf.Canvas;
+using iText.Layout;
+using iText.Layout.Element;
+using iText.Layout.Properties;
+using System.Collections.Generic;
+using System.IO;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.FactSheet;
-namespace PDFGenerator.DocumentStructures.FactSheet
-{
- public abstract class HeaderFooterBase : FactSheetBaseSection
- {
- private MemoryStream InputStream { get; }
-
- protected class HeaderFooterElement
- {
- public Paragraph Paragraph { get; set; }
- public ImageData ImageData { get; set; }
- public Rectangle ImageRectangle { get; set; }
- public float PositionX { get; set; }
- public float PositionY { get; set; }
- public TextAlignment TextAlignment { get; set; }
- public VerticalAlignment VerticalAlignment { get; set; }
- }
- protected List Items { get; set; }
- protected HeaderFooterElement PageNumber { get; set; }
- public MemoryStream ResultStream { get; private set; }
-
- protected abstract void InitializeElements();
-
- public HeaderFooterBase(Document document, MemoryStream inputStream) : base(document)
- {
- InputStream = inputStream;
- Items = new List();
- }
-
- ///
- /// Renders the content for the document header and footer.
- ///
- public void Render()
- {
- InitializeElements();
-
- ResultStream = new MemoryStream();
- PdfDocument pdfDocument = new PdfDocument(new PdfReader(new MemoryStream(InputStream.ToArray())), new PdfWriter(ResultStream));
-
- using (Document document = new Document(pdfDocument))
- {
- int firstPage = 1;
- int totalPages = pdfDocument.GetNumberOfPages();
- Paragraph pageNumberParagraph = null;
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.FactSheet
+{
+ public abstract class HeaderFooterBase : FactSheetBaseSection
+ {
+ private MemoryStream InputStream { get; }
+
+ protected class HeaderFooterElement
+ {
+ public Paragraph Paragraph { get; set; }
+ public ImageData ImageData { get; set; }
+ public Rectangle ImageRectangle { get; set; }
+ public float PositionX { get; set; }
+ public float PositionY { get; set; }
+ public TextAlignment TextAlignment { get; set; }
+ public VerticalAlignment VerticalAlignment { get; set; }
+ }
+ protected List Items { get; set; }
+ protected HeaderFooterElement PageNumber { get; set; }
+ public MemoryStream ResultStream { get; private set; }
+
+ protected abstract void InitializeElements();
+
+ public HeaderFooterBase(Document document, MemoryStream inputStream) : base(document)
+ {
+ InputStream = inputStream;
+ Items = new List();
+ }
+
+ ///
+ /// Renders the content for the document header and footer.
+ ///
+ public void Render()
+ {
+ InitializeElements();
+
+ ResultStream = new MemoryStream();
+ PdfDocument pdfDocument = new PdfDocument(new PdfReader(new MemoryStream(InputStream.ToArray())), new PdfWriter(ResultStream));
+
+ using (Document document = new Document(pdfDocument))
+ {
+ int firstPage = 1;
+ int totalPages = pdfDocument.GetNumberOfPages();
+ Paragraph pageNumberParagraph = null;
if (PageNumber != null)
{
pageNumberParagraph = PageNumber.Paragraph;
- }
- // header and footer for cover excluded
- for (int page = firstPage + 1; page <= totalPages; page++)
- {
- // get page size from the given the page number
- Rectangle ps = pdfDocument.GetPage(page).GetPageSizeWithRotation();
- float height = ps.GetHeight();
- float width = ps.GetWidth();
-
- Items.ForEach(item =>
- {
- if (item.ImageData != null)
- {
- RenderImage(pdfDocument, item, page);
- }
- if (item.Paragraph != null)
- {
- RenderParagraph(document, item, page);
- }
- });
+ }
+ // header and footer for cover excluded
+ for (int page = firstPage + 1; page <= totalPages; page++)
+ {
+ // get page size from the given the page number
+ Rectangle ps = pdfDocument.GetPage(page).GetPageSizeWithRotation();
+ float height = ps.GetHeight();
+ float width = ps.GetWidth();
+
+ Items.ForEach(item =>
+ {
+ if (item.ImageData != null)
+ {
+ RenderImage(pdfDocument, item, page);
+ }
+ if (item.Paragraph != null)
+ {
+ RenderParagraph(document, item, page);
+ }
+ });
if (pageNumberParagraph != null)
{
- PageNumber.Paragraph = new Paragraph(new Text($"Seite {page}").AddStyle(Styles.Footer))
+ PageNumber.Paragraph = new Paragraph(new Text($"Seite {page}").AddStyle(Styles.Footer))
.SetMultipliedLeading(1.0f);
RenderParagraph(document, PageNumber, page);
}
- }
- }
- }
-
- ///
- /// Adds new paragraph to header/footer.
- ///
- /// The paragraph to be added.
- /// The x-position.
- /// /// The y-position.
- /// The text alignment.
- /// /// The vertical alignment.
- protected void AddItem(Paragraph paragraph, float positionX, float positionY, TextAlignment textAlignment, VerticalAlignment verticalAlignment)
- {
- Items.Add(new HeaderFooterElement
- {
- Paragraph = paragraph,
- PositionX = positionX,
- PositionY = positionY,
- TextAlignment = textAlignment,
- VerticalAlignment = verticalAlignment
- });
- }
-
- ///
- /// Adds text to the document header or footer.
- ///
- /// the PDF document.
- /// the content to be inserted.
- /// the page to insert the text.
- private void RenderParagraph(Document document, HeaderFooterElement item, int page)
- {
- document.ShowTextAligned(
- item.Paragraph,
- item.PositionX,
- item.PositionY,
- page,
- item.TextAlignment,
- item.VerticalAlignment,
- 0
- );
- }
-
- ///
- /// Adds image to the document header or footer.
- ///
- /// the PDF document.
- /// the content to be inserted.
- /// the page to insert the image.
- private void RenderImage(PdfDocument pdfDocument, HeaderFooterElement item, int page)
- {
- PdfCanvas canvas = new PdfCanvas(pdfDocument.GetPage(page).GetLastContentStream(), pdfDocument.GetPage(page).GetResources(), pdfDocument);
- canvas.AddImage(item.ImageData, item.ImageRectangle, true);
- }
- }
-}
+ }
+ }
+ }
+
+ ///
+ /// Adds new paragraph to header/footer.
+ ///
+ /// The paragraph to be added.
+ /// The x-position.
+ /// /// The y-position.
+ /// The text alignment.
+ /// /// The vertical alignment.
+ protected void AddItem(Paragraph paragraph, float positionX, float positionY, TextAlignment textAlignment, VerticalAlignment verticalAlignment)
+ {
+ Items.Add(new HeaderFooterElement
+ {
+ Paragraph = paragraph,
+ PositionX = positionX,
+ PositionY = positionY,
+ TextAlignment = textAlignment,
+ VerticalAlignment = verticalAlignment
+ });
+ }
+
+ ///
+ /// Adds text to the document header or footer.
+ ///
+ /// the PDF document.
+ /// the content to be inserted.
+ /// the page to insert the text.
+ private void RenderParagraph(Document document, HeaderFooterElement item, int page)
+ {
+ document.ShowTextAligned(
+ item.Paragraph,
+ item.PositionX,
+ item.PositionY,
+ page,
+ item.TextAlignment,
+ item.VerticalAlignment,
+ 0
+ );
+ }
+
+ ///
+ /// Adds image to the document header or footer.
+ ///
+ /// the PDF document.
+ /// the content to be inserted.
+ /// the page to insert the image.
+ private void RenderImage(PdfDocument pdfDocument, HeaderFooterElement item, int page)
+ {
+ PdfCanvas canvas = new PdfCanvas(pdfDocument.GetPage(page).GetLastContentStream(), pdfDocument.GetPage(page).GetResources(), pdfDocument);
+ canvas.AddImage(item.ImageData, item.ImageRectangle, true);
+ }
+ }
+}
diff --git a/pdf-generator/DocumentStructures/SurveyBasePdf/Chapter.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Chapter.cs
similarity index 94%
rename from pdf-generator/DocumentStructures/SurveyBasePdf/Chapter.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Chapter.cs
index 6fbf5c860aaf73878ec5694fcf2e0c0ee9332b77..33a709e69e59bfdc311c6d99c56541630436aebd 100644
--- a/pdf-generator/DocumentStructures/SurveyBasePdf/Chapter.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Chapter.cs
@@ -3,17 +3,17 @@ using iText.Layout;
using iText.Layout.Borders;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.Models.SurveyPdf;
-using PDFGenerator.Utilities;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.SurveyPdf;
using System.Collections.Generic;
using System.Linq;
-using static PDFGenerator.Utilities.Globals;
-using static PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
-using Orientation = PDFGenerator.Utilities.Globals.Orientation;
-using Styles = PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
+using Orientation = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Orientation;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
-namespace PDFGenerator.DocumentStructures.SurveyPdfDocStructures
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.SurveyPdfDocStructures
{
public class Chapter : SurveyPdfBaseSection
{
diff --git a/pdf-generator/DocumentStructures/SurveyBasePdf/Cover.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Cover.cs
similarity index 73%
rename from pdf-generator/DocumentStructures/SurveyBasePdf/Cover.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Cover.cs
index bdf0d6fd6416a1a84f0c857b91add39b2e06fd10..4661c5d947fa80150db994f42413d71f32ea341d 100644
--- a/pdf-generator/DocumentStructures/SurveyBasePdf/Cover.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Cover.cs
@@ -1,14 +1,14 @@
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.Models.SurveyPdf;
-using PDFGenerator.Utilities;
-using static PDFGenerator.Utilities.Globals;
-using static PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
-using Orientation = PDFGenerator.Utilities.Globals.Orientation;
-using Styles = PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.SurveyPdf;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
+using Orientation = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Orientation;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
-namespace PDFGenerator.DocumentStructures.SurveyPdfDocStructures
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.SurveyPdfDocStructures
{
public class Cover : SurveyPdfBaseSection
{
diff --git a/pdf-generator/DocumentStructures/SurveyBasePdf/Footer.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Footer.cs
similarity index 78%
rename from pdf-generator/DocumentStructures/SurveyBasePdf/Footer.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Footer.cs
index 0eeae67817652026df815adf882b79d4e7a64ae3..9976a37785dda1b009cef727a88da737735b1112 100644
--- a/pdf-generator/DocumentStructures/SurveyBasePdf/Footer.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Footer.cs
@@ -5,14 +5,14 @@ using iText.Layout;
using iText.Layout.Borders;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.Models.SurveyPdf;
+using PDSLLabs.QMSL.PDFGenerator.Models.SurveyPdf;
using System.IO;
-using static PDFGenerator.Utilities.Globals;
-using Margins = PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Margins;
-using Orientation = PDFGenerator.Utilities.Globals.Orientation;
-using Styles = PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using Margins = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Margins;
+using Orientation = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Orientation;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
-namespace PDFGenerator.DocumentStructures.SurveyPdfDocStructures
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.SurveyPdfDocStructures
{
public class Footer
{
diff --git a/pdf-generator/DocumentStructures/SurveyBasePdf/Header.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Header.cs
similarity index 92%
rename from pdf-generator/DocumentStructures/SurveyBasePdf/Header.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Header.cs
index d9609ba855658e969faf4ae9f419966b3bc38098..0f03de8b7bae3c61fe1a656f7bf28a4f884a9e71 100644
--- a/pdf-generator/DocumentStructures/SurveyBasePdf/Header.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Header.cs
@@ -4,12 +4,12 @@ using iText.Kernel.Pdf;
using iText.Kernel.Pdf.Canvas;
using iText.Layout;
using iText.Layout.Element;
-using PDFGenerator.Models.SurveyPdf;
+using PDSLLabs.QMSL.PDFGenerator.Models.SurveyPdf;
using System.IO;
using System.Linq;
-using static PDFGenerator.Utilities.Conversion;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Conversion;
-namespace PDFGenerator.DocumentStructures.SurveyPdfDocStructures
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.SurveyPdfDocStructures
{
public class Header
{
diff --git a/pdf-generator/DocumentStructures/SurveyBasePdf/Imprint.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Imprint.cs
similarity index 79%
rename from pdf-generator/DocumentStructures/SurveyBasePdf/Imprint.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Imprint.cs
index b2ac7e19b35d5748873a54b704206ab0a70d4a33..1008e7a4a994955d3883358353605dc8e581fd90 100644
--- a/pdf-generator/DocumentStructures/SurveyBasePdf/Imprint.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/Imprint.cs
@@ -2,14 +2,14 @@
using iText.Layout.Borders;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.Models.SurveyPdf;
-using PDFGenerator.Utilities;
-using static PDFGenerator.Utilities.Globals;
-using Margins = PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Margins;
-using Orientation = PDFGenerator.Utilities.Globals.Orientation;
-using Styles = PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.SurveyPdf;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using Margins = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Margins;
+using Orientation = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Orientation;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
-namespace PDFGenerator.DocumentStructures.SurveyPdfDocStructures
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.SurveyPdfDocStructures
{
public class Imprint : SurveyPdfBaseSection
{
diff --git a/pdf-generator/DocumentStructures/SurveyBasePdf/PreNoteAndSummary.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/PreNoteAndSummary.cs
similarity index 87%
rename from pdf-generator/DocumentStructures/SurveyBasePdf/PreNoteAndSummary.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/PreNoteAndSummary.cs
index d7a033a884a2eff12ac625c5f9b4a10321b3604f..8e6bec31924f0dd9a4c77e90f56f614509c49375 100644
--- a/pdf-generator/DocumentStructures/SurveyBasePdf/PreNoteAndSummary.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/PreNoteAndSummary.cs
@@ -3,11 +3,11 @@ using iText.Layout;
using iText.Layout.Borders;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.Models.SurveyPdf;
-using PDFGenerator.Utilities;
-using Styles = PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.SurveyPdf;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
-namespace PDFGenerator.DocumentStructures.SurveyPdfDocStructures
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.SurveyPdfDocStructures
{
public class PreNoteAndSummary : SurveyPdfBaseSection
{
diff --git a/pdf-generator/DocumentStructures/SurveyBasePdf/SurveyPdfBaseSection.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/SurveyPdfBaseSection.cs
similarity index 87%
rename from pdf-generator/DocumentStructures/SurveyBasePdf/SurveyPdfBaseSection.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/SurveyPdfBaseSection.cs
index 40a17dbac27361847417a9f506c1f0181bbcf52d..963de519b44a74809dcddea6575ea67893393ea9 100644
--- a/pdf-generator/DocumentStructures/SurveyBasePdf/SurveyPdfBaseSection.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/SurveyPdfBaseSection.cs
@@ -1,7 +1,7 @@
using iText.Layout;
-using PDFGenerator.Utilities;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
-namespace PDFGenerator.DocumentStructures.SurveyPdfDocStructures
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.SurveyPdfDocStructures
{
public abstract class SurveyPdfBaseSection : BaseSection
{
diff --git a/pdf-generator/DocumentStructures/SurveyBasePdf/TableOfContents.cs b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/TableOfContents.cs
similarity index 90%
rename from pdf-generator/DocumentStructures/SurveyBasePdf/TableOfContents.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/TableOfContents.cs
index 97b87433a8cd96bac5d3e4f8a431cc14c265e4d6..5c34ce2204b59863de05ef8eed57d3332b215bb7 100644
--- a/pdf-generator/DocumentStructures/SurveyBasePdf/TableOfContents.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/DocumentStructures/SurveyBasePdf/TableOfContents.cs
@@ -2,11 +2,11 @@
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;
-using static PDFGenerator.Utilities.Globals;
-using static PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
-using Styles = PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Styles;
-namespace PDFGenerator.DocumentStructures.SurveyPdfDocStructures
+namespace PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.SurveyPdfDocStructures
{
public class TableOfContents : BaseTableOfContents
{
diff --git a/pdf-generator/NuGet.config b/PDSLLabs.Public.QMSL.PDFGenerator/NuGet.config
similarity index 100%
rename from pdf-generator/NuGet.config
rename to PDSLLabs.Public.QMSL.PDFGenerator/NuGet.config
diff --git a/pdf-generator/pdf-generator.csproj b/PDSLLabs.Public.QMSL.PDFGenerator/PDSLLabs.Public.QMSL.PDFGenerator.csproj
similarity index 78%
rename from pdf-generator/pdf-generator.csproj
rename to PDSLLabs.Public.QMSL.PDFGenerator/PDSLLabs.Public.QMSL.PDFGenerator.csproj
index e81f3f430dc24c27b04131234a6229a74de99706..9ec50e8c9af8927665344d888d2779b60dd5a7e5 100644
--- a/pdf-generator/pdf-generator.csproj
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/PDSLLabs.Public.QMSL.PDFGenerator.csproj
@@ -2,7 +2,7 @@
netcoreapp3.1
- PDFGenerator
+ PDSLLabs.Public.QMSL.PDFGenerator
true
1591
@@ -17,8 +17,8 @@
-
- ..\lib\PDFGenerator.Models.dll
+
+ ..\lib\PDSLLabs.QMSL.PDFGenerator.Models.dll
diff --git a/pdf-generator/Program.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Program.cs
similarity index 97%
rename from pdf-generator/Program.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Program.cs
index dc1a6ad9d188d31713df9c77969789852a9ee69c..9301e037540b017ead83b2ab174a1f9683cf0422 100644
--- a/pdf-generator/Program.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Program.cs
@@ -5,7 +5,7 @@ using Microsoft.Extensions.Logging;
using NLog.Web;
using System;
-namespace PDFGenerator
+namespace PDSLLabs.Public.QMSL.PDFGenerator
{
public class Program
{
diff --git a/pdf-generator/Properties/launchSettings.example.json b/PDSLLabs.Public.QMSL.PDFGenerator/Properties/launchSettings.example.json
similarity index 91%
rename from pdf-generator/Properties/launchSettings.example.json
rename to PDSLLabs.Public.QMSL.PDFGenerator/Properties/launchSettings.example.json
index 75b9b055f3f87e5bdf999b0581e4f0dcf58cf455..6682162e7ffb80d6d55676b71a2176a24b64383c 100644
--- a/pdf-generator/Properties/launchSettings.example.json
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Properties/launchSettings.example.json
@@ -17,7 +17,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
- "pdf-generator": {
+ "PDSLLabs.Public.QMSL.PDFGenerator": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger/index.html",
diff --git a/pdf-generator/Renderers/AbsbHomepagePdfRenderer.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Renderers/AbsbHomepagePdfRenderer.cs
similarity index 85%
rename from pdf-generator/Renderers/AbsbHomepagePdfRenderer.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Renderers/AbsbHomepagePdfRenderer.cs
index 9fc022eac1a28246e980d2c2749023ead168c746..1095fd40d26c68d1988a7a82ca8d8001472adc13 100644
--- a/pdf-generator/Renderers/AbsbHomepagePdfRenderer.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Renderers/AbsbHomepagePdfRenderer.cs
@@ -1,8 +1,8 @@
using iText.Layout;
-using PDFGenerator.DocumentStructures.AbsbHomepagePdfDocStructures;
-using PDFGenerator.Models.AbsbHomepagePdf;
+using PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.AbsbHomepagePdfDocStructures;
+using PDSLLabs.QMSL.PDFGenerator.Models.AbsbHomepagePdf;
-namespace PDFGenerator.Renderers
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Renderers
{
public class AbsbHomepagePdfRenderer : SurveyPdfRenderer
{
diff --git a/pdf-generator/Renderers/EvaluationReportRenderer.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Renderers/EvaluationReportRenderer.cs
similarity index 95%
rename from pdf-generator/Renderers/EvaluationReportRenderer.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Renderers/EvaluationReportRenderer.cs
index 312f2c4678dcc2848a2c63c207705340c00d0d84..fe1473b41498abb31c7f34d4fa8222aec5f6b235 100644
--- a/pdf-generator/Renderers/EvaluationReportRenderer.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Renderers/EvaluationReportRenderer.cs
@@ -4,15 +4,15 @@ using iText.Kernel.Pdf.Canvas;
using iText.Layout;
using iText.Layout.Element;
using iText.Layout.Properties;
-using PDFGenerator.DocumentStructures.EvaluationReport;
-using PDFGenerator.Utilities;
+using PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.EvaluationReport;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
using System.Collections.Generic;
using System.IO;
-using EvaluationReportModel = PDFGenerator.Models.EvaluationReport.EvaluationReport;
-using Margins = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Margins;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+using EvaluationReportModel = PDSLLabs.QMSL.PDFGenerator.Models.EvaluationReport.EvaluationReport;
+using Margins = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Margins;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-namespace PDFGenerator.Renderers
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Renderers
{
public class EvaluationReportRenderer : IRenderer
{
diff --git a/pdf-generator/Renderers/FactSheetRenderer.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Renderers/FactSheetRenderer.cs
similarity index 85%
rename from pdf-generator/Renderers/FactSheetRenderer.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Renderers/FactSheetRenderer.cs
index b5cfa19f183d0ca563e5d245ca7f8917c663744b..105bc878d15be91271f4927434d27c1e1d1aa49a 100644
--- a/pdf-generator/Renderers/FactSheetRenderer.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Renderers/FactSheetRenderer.cs
@@ -1,13 +1,14 @@
using iText.Kernel.Geom;
using iText.Kernel.Pdf;
using iText.Layout;
-using PDFGenerator.DocumentStructures.FactSheet;
+using PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.FactSheet;
+using PDSLLabs.QMSL.PDFGenerator.Models.FactSheet;
using System.IO;
using System.Linq;
-using FactSheetModel = PDFGenerator.Models.FactSheet.FactSheet;
-using Margins = PDFGenerator.Utilities.Globals.Constants.FactSheet.Margins;
+using FactSheetModel = PDSLLabs.QMSL.PDFGenerator.Models.FactSheet.FactSheet;
+using Margins = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.FactSheet.Margins;
-namespace PDFGenerator.Renderers
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Renderers
{
public class FactSheetRenderer : IRenderer
{
@@ -70,7 +71,7 @@ namespace PDFGenerator.Renderers
private void RenderChapters()
{
Chapter chapter = new Chapter(FactSheet.NoDataAvailable, Document);
- foreach (Models.FactSheet.PDFChapter pdfChapter in FactSheet.Chapters.Where(item => item != null))
+ foreach (PDFChapter pdfChapter in FactSheet.Chapters.Where(item => item != null))
{
chapter.UpdateChapter(pdfChapter);
chapter.Render();
diff --git a/pdf-generator/Renderers/IRenderer.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Renderers/IRenderer.cs
similarity index 83%
rename from pdf-generator/Renderers/IRenderer.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Renderers/IRenderer.cs
index 421085df766b18fdffdbfaa6cb081e74e8eda16a..9866d38844c59fc175232eb2cd55e3b4dc4b46cb 100644
--- a/pdf-generator/Renderers/IRenderer.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Renderers/IRenderer.cs
@@ -1,4 +1,4 @@
-namespace PDFGenerator.Renderers
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Renderers
{
internal interface IRenderer
{
diff --git a/pdf-generator/Renderers/SurveyBasePdfRenderer.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Renderers/SurveyBasePdfRenderer.cs
similarity index 90%
rename from pdf-generator/Renderers/SurveyBasePdfRenderer.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Renderers/SurveyBasePdfRenderer.cs
index 6284ce7b086c3e5386375fadca3a4c32a25134a1..5c5c7ce676795c5ede0dba4e043639da5253e662 100644
--- a/pdf-generator/Renderers/SurveyBasePdfRenderer.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Renderers/SurveyBasePdfRenderer.cs
@@ -1,18 +1,18 @@
using iText.Kernel.Pdf;
using iText.Layout;
-using PDFGenerator.DocumentStructures.SurveyPdfDocStructures;
-using PDFGenerator.Models.SurveyPdf;
-using PDFGenerator.Utilities;
+using PDSLLabs.Public.QMSL.PDFGenerator.DocumentStructures.SurveyPdfDocStructures;
+using PDSLLabs.Public.QMSL.PDFGenerator.Utilities;
+using PDSLLabs.QMSL.PDFGenerator.Models.SurveyPdf;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using static PDFGenerator.Utilities.Globals;
-using Constants = PDFGenerator.Utilities.Globals.Constants;
-using Margins = PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Margins;
-using Orientation = PDFGenerator.Utilities.Globals.Orientation;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using Constants = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants;
+using Margins = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf.Margins;
+using Orientation = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Orientation;
-namespace PDFGenerator.Renderers
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Renderers
{
public class SurveyPdfRenderer : IRenderer
{
diff --git a/pdf-generator/Startup.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Startup.cs
similarity index 98%
rename from pdf-generator/Startup.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Startup.cs
index ab72d92303189c51716f6d8e041053e1f2e2de40..2847c3f6d564df736dc34de6b480fe1345803f69 100644
--- a/pdf-generator/Startup.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Startup.cs
@@ -8,7 +8,7 @@ using Newtonsoft.Json.Serialization;
using System;
using System.IO;
-namespace PDFGenerator
+namespace PDSLLabs.Public.QMSL.PDFGenerator
{
public class Startup
{
diff --git a/pdf-generator/Utilities/Bookmarks.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Bookmarks.cs
similarity index 95%
rename from pdf-generator/Utilities/Bookmarks.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Bookmarks.cs
index f8a08dd72bd8bcc0feb4d0de8a32a41de79f7c90..79a0ff7061acbeda89b80be475fd2a6a60e239f4 100644
--- a/pdf-generator/Utilities/Bookmarks.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Bookmarks.cs
@@ -2,9 +2,9 @@ using iText.Kernel.Pdf;
using iText.Kernel.Pdf.Navigation;
using System;
using System.Collections.Generic;
-using static PDFGenerator.Utilities.Globals;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
-namespace PDFGenerator.Utilities
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Utilities
{
public class Bookmarks
{
diff --git a/pdf-generator/Utilities/Conversion.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Conversion.cs
similarity index 92%
rename from pdf-generator/Utilities/Conversion.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Conversion.cs
index 472f21104e5b324cc76e97c2b77ba12b11eac3ca..51855901a2a7ad229200d600cdc6591a84eb578e 100644
--- a/pdf-generator/Utilities/Conversion.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Conversion.cs
@@ -1,4 +1,4 @@
-namespace PDFGenerator.Utilities
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Utilities
{
public class Conversion
{
diff --git a/pdf-generator/Utilities/CustomSplitCharacters.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/CustomSplitCharacters.cs
similarity index 92%
rename from pdf-generator/Utilities/CustomSplitCharacters.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Utilities/CustomSplitCharacters.cs
index 5a26870606e9e249b55e8edec55187ecdee6c890..245ee7824355f841a7502b5a05949e36c1948f25 100644
--- a/pdf-generator/Utilities/CustomSplitCharacters.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/CustomSplitCharacters.cs
@@ -1,7 +1,7 @@
using iText.IO.Font.Otf;
using iText.Layout.Splitting;
-namespace PDFGenerator.Utilities
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Utilities
{
public class CustomSplitCharacters : DefaultSplitCharacters
{
diff --git a/pdf-generator/Utilities/Globals.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Globals.cs
similarity index 98%
rename from pdf-generator/Utilities/Globals.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Globals.cs
index 5662e901ebef4593e80ee2f31204e511daa1e118..6719b5b4b31878518979d1ce950203f20added04 100644
--- a/pdf-generator/Utilities/Globals.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Globals.cs
@@ -1,111 +1,111 @@
-using iText.IO.Font;
-using iText.IO.Font.Constants;
-using iText.Kernel.Colors;
-using iText.Kernel.Font;
+using iText.IO.Font;
+using iText.IO.Font.Constants;
+using iText.Kernel.Colors;
+using iText.Kernel.Font;
using iText.Kernel.Geom;
-using iText.Layout;
+using iText.Layout;
using System.Collections.Generic;
-namespace PDFGenerator.Utilities
-{
- public class Globals
- {
- public class Constants
- {
- // BaseFont in iText7 is replaced with PdfFont
- // default font in iText7 is Helvetica with size 12 pt and color black (typically known as Normal)
-
- // because Arial font (located in windows default font directory) is possibly unaccessible and not supported by iText7
- // it is replaced with Helvetica as it more or less looks like Windows Arial font
- // (refer to https://www.mikesdotnetting.com/article/81/itextsharp-working-with-fonts)
-
- private static PdfFont NormalFont => PdfFontFactory.CreateFont(StandardFonts.HELVETICA, PdfEncodings.WINANSI, true);
- private static PdfFont BoldFont => PdfFontFactory.CreateFont(StandardFonts.HELVETICA_BOLD, PdfEncodings.WINANSI, true);
- private static DeviceRgb DefaultFontColor => new DeviceRgb(0, 84, 159);
- private static DeviceRgb ImageCaptionColor => new DeviceRgb(79, 129, 189);
- public static DeviceRgb LightGreyFontColor => new DeviceRgb(156, 158, 159);
- private static DeviceRgb ExtraLightGreyFontColor => new DeviceRgb(236, 237, 237);
- private static DeviceRgb GreyFontColor => new DeviceRgb(128, 128, 128);
- public static Dictionary PageOrientation = new Dictionary { { Orientation.Portrait, PageSize.A4 }, { Orientation.Landscape, PageSize.A4.Rotate() } };
-
- public static class EvaluationReport
- {
- public static class Margins
- {
- public static float TopMargin { get; } = 56.69f;
- public static float RightMargin { get; } = 56.69f;
- public static float BottomMargin { get; } = 56.69f;
- public static float LeftMargin { get; } = 56.69f;
- }
-
- public static class Styles
- {
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Utilities
+{
+ public class Globals
+ {
+ public class Constants
+ {
+ // BaseFont in iText7 is replaced with PdfFont
+ // default font in iText7 is Helvetica with size 12 pt and color black (typically known as Normal)
+
+ // because Arial font (located in windows default font directory) is possibly unaccessible and not supported by iText7
+ // it is replaced with Helvetica as it more or less looks like Windows Arial font
+ // (refer to https://www.mikesdotnetting.com/article/81/itextsharp-working-with-fonts)
+
+ private static PdfFont NormalFont => PdfFontFactory.CreateFont(StandardFonts.HELVETICA, PdfEncodings.WINANSI, true);
+ private static PdfFont BoldFont => PdfFontFactory.CreateFont(StandardFonts.HELVETICA_BOLD, PdfEncodings.WINANSI, true);
+ private static DeviceRgb DefaultFontColor => new DeviceRgb(0, 84, 159);
+ private static DeviceRgb ImageCaptionColor => new DeviceRgb(79, 129, 189);
+ public static DeviceRgb LightGreyFontColor => new DeviceRgb(156, 158, 159);
+ private static DeviceRgb ExtraLightGreyFontColor => new DeviceRgb(236, 237, 237);
+ private static DeviceRgb GreyFontColor => new DeviceRgb(128, 128, 128);
+ public static Dictionary PageOrientation = new Dictionary { { Orientation.Portrait, PageSize.A4 }, { Orientation.Landscape, PageSize.A4.Rotate() } };
+
+ public static class EvaluationReport
+ {
+ public static class Margins
+ {
+ public static float TopMargin { get; } = 56.69f;
+ public static float RightMargin { get; } = 56.69f;
+ public static float BottomMargin { get; } = 56.69f;
+ public static float LeftMargin { get; } = 56.69f;
+ }
+
+ public static class Styles
+ {
public static Style ChapterTitle => new Style().SetFont(BoldFont).SetFontSize(16);
- public static Style ChapterSubtitle => new Style().SetFont(BoldFont).SetFontSize(12);
- public static Style ChapterSubsubtitle => new Style().SetFont(BoldFont).SetFontSize(11);
- public static Style SubjectName => new Style().SetFont(BoldFont).SetFontSize(10);
- public static Style CoverTitle => new Style().SetFont(BoldFont).SetFontSize(25);
- public static Style CoverSubtitle => new Style().SetFont(BoldFont).SetFontSize(20.5f);
- public static Style CoverDate => new Style().SetFont(NormalFont).SetFontSize(20.5f);
- public static Style CoverSubsubtitleSubject => new Style().SetFont(NormalFont).SetFontSize(16f);
+ public static Style ChapterSubtitle => new Style().SetFont(BoldFont).SetFontSize(12);
+ public static Style ChapterSubsubtitle => new Style().SetFont(BoldFont).SetFontSize(11);
+ public static Style SubjectName => new Style().SetFont(BoldFont).SetFontSize(10);
+ public static Style CoverTitle => new Style().SetFont(BoldFont).SetFontSize(25);
+ public static Style CoverSubtitle => new Style().SetFont(BoldFont).SetFontSize(20.5f);
+ public static Style CoverDate => new Style().SetFont(NormalFont).SetFontSize(20.5f);
+ public static Style CoverSubsubtitleSubject => new Style().SetFont(NormalFont).SetFontSize(16f);
public static Style Paragraph => new Style().SetFont(NormalFont).SetFontSize(11);
- public static Style Link => Small.SetFontColor(DefaultFontColor);
- public static Style Small => new Style().SetFont(NormalFont).SetFontSize(10);
- public static Style SmallBold => new Style().SetFont(BoldFont).SetFontSize(9);
- public static Style ImageCaption => new Style().SetFont(NormalFont).SetFontSize(9f).SetFontColor(ImageCaptionColor);
- }
- }
-
- public static class FactSheet
+ public static Style Link => Small.SetFontColor(DefaultFontColor);
+ public static Style Small => new Style().SetFont(NormalFont).SetFontSize(10);
+ public static Style SmallBold => new Style().SetFont(BoldFont).SetFontSize(9);
+ public static Style ImageCaption => new Style().SetFont(NormalFont).SetFontSize(9f).SetFontColor(ImageCaptionColor);
+ }
+ }
+
+ public static class FactSheet
{
- public static class Margins
- {
- public static float TopMargin { get; } = 72f;
- public static float RightMargin { get; } = 72f;
- public static float BottomMargin { get; } = 72f;
- public static float LeftMargin { get; } = 72f;
- }
-
- public static class Styles
- {
- public static Style Title => new Style().SetFont(BoldFont).SetFontSize(28).SetFontColor(DefaultFontColor);
- public static Style Subtitle => new Style().SetFont(BoldFont).SetFontSize(24).SetFontColor(LightGreyFontColor);
- public static Style ChapterTitle => new Style().SetFont(BoldFont).SetFontSize(12).SetFontColor(DefaultFontColor);
- public static Style SectionTitle => new Style().SetFont(BoldFont).SetFontSize(11).SetFontColor(DefaultFontColor);
- public static Style SectionSubtitle => new Style().SetFont(NormalFont).SetFontSize(11).SetFontColor(DefaultFontColor);
- public static Style SectionSubsubtitle => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(DefaultFontColor);
- public static Style ReportHeader => new Style().SetFont(BoldFont).SetFontSize(9).SetFontColor(DefaultFontColor);
- public static Style ReportSubHeader => new Style().SetFont(NormalFont).SetFontSize(9).SetFontColor(DefaultFontColor);
- public static Style Paragraph => new Style().SetFont(NormalFont).SetFontSize(11);
- public static Style Footer => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(LightGreyFontColor);
- public static Style Header => new Style().SetFont(NormalFont).SetFontSize(12).SetFontColor(LightGreyFontColor);
- public static Style Header_Bold => Header.SetFont(BoldFont);
- }
- }
-
- public static class SurveyPdf
+ public static class Margins
+ {
+ public static float TopMargin { get; } = 72f;
+ public static float RightMargin { get; } = 72f;
+ public static float BottomMargin { get; } = 72f;
+ public static float LeftMargin { get; } = 72f;
+ }
+
+ public static class Styles
+ {
+ public static Style Title => new Style().SetFont(BoldFont).SetFontSize(28).SetFontColor(DefaultFontColor);
+ public static Style Subtitle => new Style().SetFont(BoldFont).SetFontSize(24).SetFontColor(LightGreyFontColor);
+ public static Style ChapterTitle => new Style().SetFont(BoldFont).SetFontSize(12).SetFontColor(DefaultFontColor);
+ public static Style SectionTitle => new Style().SetFont(BoldFont).SetFontSize(11).SetFontColor(DefaultFontColor);
+ public static Style SectionSubtitle => new Style().SetFont(NormalFont).SetFontSize(11).SetFontColor(DefaultFontColor);
+ public static Style SectionSubsubtitle => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(DefaultFontColor);
+ public static Style ReportHeader => new Style().SetFont(BoldFont).SetFontSize(9).SetFontColor(DefaultFontColor);
+ public static Style ReportSubHeader => new Style().SetFont(NormalFont).SetFontSize(9).SetFontColor(DefaultFontColor);
+ public static Style Paragraph => new Style().SetFont(NormalFont).SetFontSize(11);
+ public static Style Footer => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(LightGreyFontColor);
+ public static Style Header => new Style().SetFont(NormalFont).SetFontSize(12).SetFontColor(LightGreyFontColor);
+ public static Style Header_Bold => Header.SetFont(BoldFont);
+ }
+ }
+
+ public static class SurveyPdf
{
- public static class Margins
- {
- public static float TopMargin { get; } = 56.69f;
- public static float RightMargin { get; } = 56.69f;
+ public static class Margins
+ {
+ public static float TopMargin { get; } = 56.69f;
+ public static float RightMargin { get; } = 56.69f;
public static float BottomMarginPortrait { get; } = 40f;
- public static float BottomMarginLandscape { get; } = 30f;
- public static float LeftMargin { get; } = 56.69f;
-
- public static float LeftMarginImprintLandscape { get; } = 350f;
- public static float LeftMarginImprintPortrait { get; } = 220f;
- public static float TopMarginImprintLandscape { get; } = 240f;
- public static float TopMarginImprintPortrait { get; } = 480f;
-
- public static float TopMarginChapterTitleLandscape { get; } = 30f;
+ public static float BottomMarginLandscape { get; } = 30f;
+ public static float LeftMargin { get; } = 56.69f;
+
+ public static float LeftMarginImprintLandscape { get; } = 350f;
+ public static float LeftMarginImprintPortrait { get; } = 220f;
+ public static float TopMarginImprintLandscape { get; } = 240f;
+ public static float TopMarginImprintPortrait { get; } = 480f;
+
+ public static float TopMarginChapterTitleLandscape { get; } = 30f;
public static float TopMarginChapterTitlePortrait { get; } = 300f;
- public static float TopMarginCoverLandscape { get; } = 70f;
+ public static float TopMarginCoverLandscape { get; } = 70f;
public static float TopMarginCoverPortrait { get; } = 100f;
- public static float TopMarginCover2Landscape { get; } = 50f;
+ public static float TopMarginCover2Landscape { get; } = 50f;
public static float TopMarginCover2Portrait { get; } = 90f;
public static float FooterYPositionPortrait { get; } = 40f;
@@ -149,37 +149,37 @@ namespace PDFGenerator.Utilities
}
};
- }
-
- public static class Styles
- {
- public static Style CoverTitle => new Style().SetFont(BoldFont).SetFontSize(36).SetFontColor(DefaultFontColor);
- public static Style CoverSubtitle => new Style().SetFont(BoldFont).SetFontSize(30).SetFontColor(DefaultFontColor);
- public static Style CoverFakSubtitle => new Style().SetFont(NormalFont).SetFontSize(32).SetFontColor(DefaultFontColor);
- public static Style CoverSubsubtitle => new Style().SetFont(BoldFont).SetFontSize(26).SetFontColor(DefaultFontColor);
- public static Style ChapterCoverNumber => new Style().SetFont(NormalFont).SetFontSize(300).SetFontColor(ExtraLightGreyFontColor);
- public static Style ChapterCoverTitle => new Style().SetFont(NormalFont).SetFontSize(18).SetFontColor(LightGreyFontColor);
- public static Style Title => new Style().SetFont(BoldFont).SetFontSize(14).SetFontColor(DefaultFontColor);
- public static Style TOCContent => new Style().SetFont(NormalFont).SetFontSize(12f).SetFontColor(DefaultFontColor);
+ }
+
+ public static class Styles
+ {
+ public static Style CoverTitle => new Style().SetFont(BoldFont).SetFontSize(36).SetFontColor(DefaultFontColor);
+ public static Style CoverSubtitle => new Style().SetFont(BoldFont).SetFontSize(30).SetFontColor(DefaultFontColor);
+ public static Style CoverFakSubtitle => new Style().SetFont(NormalFont).SetFontSize(32).SetFontColor(DefaultFontColor);
+ public static Style CoverSubsubtitle => new Style().SetFont(BoldFont).SetFontSize(26).SetFontColor(DefaultFontColor);
+ public static Style ChapterCoverNumber => new Style().SetFont(NormalFont).SetFontSize(300).SetFontColor(ExtraLightGreyFontColor);
+ public static Style ChapterCoverTitle => new Style().SetFont(NormalFont).SetFontSize(18).SetFontColor(LightGreyFontColor);
+ public static Style Title => new Style().SetFont(BoldFont).SetFontSize(14).SetFontColor(DefaultFontColor);
+ public static Style TOCContent => new Style().SetFont(NormalFont).SetFontSize(12f).SetFontColor(DefaultFontColor);
public static Style Paragraph => new Style().SetFont(NormalFont).SetFontSize(11).SetFontColor(DefaultFontColor);
- public static Style ParagraphBold => new Style().SetFont(BoldFont).SetFontSize(11).SetFontColor(DefaultFontColor);
- public static Style Normal => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(DefaultFontColor);
- public static Style Small => new Style().SetFont(NormalFont).SetFontSize(9).SetFontColor(DefaultFontColor);
- public static Style Footer => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(GreyFontColor);
- public static Style Explanations => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(DefaultFontColor);
- public static Style ExplanationsHeader => Explanations.SetFont(BoldFont);
+ public static Style ParagraphBold => new Style().SetFont(BoldFont).SetFontSize(11).SetFontColor(DefaultFontColor);
+ public static Style Normal => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(DefaultFontColor);
+ public static Style Small => new Style().SetFont(NormalFont).SetFontSize(9).SetFontColor(DefaultFontColor);
+ public static Style Footer => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(GreyFontColor);
+ public static Style Explanations => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(DefaultFontColor);
+ public static Style ExplanationsHeader => Explanations.SetFont(BoldFont);
}
- }
- }
-
- public enum Orientation
- {
- Portrait,
- Landscape
- }
-
+ }
+ }
+
+ public enum Orientation
+ {
+ Portrait,
+ Landscape
+ }
+
public enum OrientationMargins
{
LeftMarginImprint,
@@ -192,13 +192,13 @@ namespace PDFGenerator.Utilities
SectionHeadingFirstColumnPercentage,
PaddingBottomReportImage,
MarginTableOfContentHeadline
- }
-
- public enum OutlineLevel
- {
- Level0,
- Level1,
- Level2
- }
- }
-}
+ }
+
+ public enum OutlineLevel
+ {
+ Level0,
+ Level1,
+ Level2
+ }
+ }
+}
diff --git a/pdf-generator/Utilities/Panel.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Panel.cs
similarity index 94%
rename from pdf-generator/Utilities/Panel.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Panel.cs
index 1e23de6e7c705e6fa4d0394f785133945b83f9ff..7de2443b435102884e5b78c2d0fb26a162c595c1 100644
--- a/pdf-generator/Utilities/Panel.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/Panel.cs
@@ -3,7 +3,7 @@ using iText.Layout.Borders;
using iText.Layout.Element;
using iText.Layout.Properties;
-namespace PDFGenerator.Utilities
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Utilities
{
public class Panel
{
diff --git a/pdf-generator/Utilities/ParagraphFactory.cs b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/ParagraphFactory.cs
similarity index 92%
rename from pdf-generator/Utilities/ParagraphFactory.cs
rename to PDSLLabs.Public.QMSL.PDFGenerator/Utilities/ParagraphFactory.cs
index 8c78e226ab0eee101539e541df3d4f7e72714a6d..11a30637d8ee08993fe43757fed9566168df9a1d 100644
--- a/pdf-generator/Utilities/ParagraphFactory.cs
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/Utilities/ParagraphFactory.cs
@@ -1,120 +1,120 @@
-using iText.Layout;
-using iText.Layout.Borders;
-using iText.Layout.Element;
-using iText.Layout.Properties;
-using static PDFGenerator.Utilities.Globals;
-using static PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
-using Styles = PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
-
-namespace PDFGenerator.Utilities
-{
- public class ParagraphFactory
- {
- ///
- /// Creates a standard paragraph.
- ///
- /// The paragraph content.
- /// The created paragraph.
- public static Paragraph GetStandardParagraph(string text)
- {
- return GetCustomParagraph(text, Styles.Paragraph, 0, 9, 1.05f);
- }
-
- ///
- /// Creates a paragraph for the preface section.
- ///
- /// The paragraph content.
- /// The created paragraph.
- public static Paragraph GetPrefaceParagraph(string text)
- {
- return GetCustomParagraph(text, Styles.Paragraph, 0.5f, 10, 1.35f);
- }
-
- ///
- /// Creates a paragraph for the table header.
- ///
- /// The paragraph content.
- /// The created paragraph.
- public static Paragraph GetTableHeaderParagraph(string text)
- {
- return GetTableHeaderParagraph(text, null);
- }
-
- ///
- /// Creates a paragraph for the table header.
- ///
- /// The paragraph content.
- /// The paragraph style.
- /// The created paragraph.
- public static Paragraph GetTableHeaderParagraph(string text, Style style)
- {
- float multiplyLeading = 1.15f;
- if (style == null)
- {
- style = Styles.ChapterSubsubtitle;
- }
-
- return GetCustomParagraph(text, style, 0, 3.5f, multiplyLeading);
- }
-
- ///
- /// Creates a paragraph with custom properties.
- ///
- /// The paragraph content.
- /// The paragraph style.
- /// The paragraph top margin width.
- /// The paragraph bottom margin width.
- /// The paragraph leading value.
- /// The italic stle for a font if true.
- /// The created paragraph.
- public static Paragraph GetCustomParagraph(string text, Style font, float spacingbefore, float spacingafter, float multipliedLeading, bool isItalic = false)
- {
- Text styledText = new Text(text);
- styledText.AddStyle(font);
-
- Paragraph paragraph = new Paragraph(styledText);
- // remark: 1.5 is itext Standard
- paragraph.SetMultipliedLeading(multipliedLeading);
- paragraph.SetMarginTop(spacingbefore);
- paragraph.SetMarginBottom(spacingafter);
- paragraph.SetTextAlignment(TextAlignment.JUSTIFIED);
-
- return isItalic ? paragraph.SetItalic() : paragraph;
+using iText.Layout;
+using iText.Layout.Borders;
+using iText.Layout.Element;
+using iText.Layout.Properties;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals;
+using static PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.SurveyPdf;
+using Styles = PDSLLabs.Public.QMSL.PDFGenerator.Utilities.Globals.Constants.EvaluationReport.Styles;
+
+namespace PDSLLabs.Public.QMSL.PDFGenerator.Utilities
+{
+ public class ParagraphFactory
+ {
+ ///
+ /// Creates a standard paragraph.
+ ///
+ /// The paragraph content.
+ /// The created paragraph.
+ public static Paragraph GetStandardParagraph(string text)
+ {
+ return GetCustomParagraph(text, Styles.Paragraph, 0, 9, 1.05f);
+ }
+
+ ///
+ /// Creates a paragraph for the preface section.
+ ///
+ /// The paragraph content.
+ /// The created paragraph.
+ public static Paragraph GetPrefaceParagraph(string text)
+ {
+ return GetCustomParagraph(text, Styles.Paragraph, 0.5f, 10, 1.35f);
+ }
+
+ ///
+ /// Creates a paragraph for the table header.
+ ///
+ /// The paragraph content.
+ /// The created paragraph.
+ public static Paragraph GetTableHeaderParagraph(string text)
+ {
+ return GetTableHeaderParagraph(text, null);
+ }
+
+ ///
+ /// Creates a paragraph for the table header.
+ ///
+ /// The paragraph content.
+ /// The paragraph style.
+ /// The created paragraph.
+ public static Paragraph GetTableHeaderParagraph(string text, Style style)
+ {
+ float multiplyLeading = 1.15f;
+ if (style == null)
+ {
+ style = Styles.ChapterSubsubtitle;
+ }
+
+ return GetCustomParagraph(text, style, 0, 3.5f, multiplyLeading);
+ }
+
+ ///
+ /// Creates a paragraph with custom properties.
+ ///
+ /// The paragraph content.
+ /// The paragraph style.
+ /// The paragraph top margin width.
+ /// The paragraph bottom margin width.
+ /// The paragraph leading value.
+ /// The italic stle for a font if true.
+ /// The created paragraph.
+ public static Paragraph GetCustomParagraph(string text, Style font, float spacingbefore, float spacingafter, float multipliedLeading, bool isItalic = false)
+ {
+ Text styledText = new Text(text);
+ styledText.AddStyle(font);
+
+ Paragraph paragraph = new Paragraph(styledText);
+ // remark: 1.5 is itext Standard
+ paragraph.SetMultipliedLeading(multipliedLeading);
+ paragraph.SetMarginTop(spacingbefore);
+ paragraph.SetMarginBottom(spacingafter);
+ paragraph.SetTextAlignment(TextAlignment.JUSTIFIED);
+
+ return isItalic ? paragraph.SetItalic() : paragraph;
}
- ///
- /// Creates a paragraph with content split in two columns.
- ///
- /// The text to be rendered in the left column.
- /// The text to be rendered in the right column.
- /// The paragraph style.
+ ///
+ /// Creates a paragraph with content split in two columns.
+ ///
+ /// The text to be rendered in the left column.
+ /// The text to be rendered in the right column.
+ /// The paragraph style.
/// Optional paragraph margin top.
- /// Orientation of document
- /// Paragraph with the given content.
- public static Paragraph CreateTwoColumnParagraph(string textLeft, string textRight, Style font, Orientation pageOrientation, float marginTop = 15f)
- {
- float firstColumnWidth = Margins.OrientationMarginValues[pageOrientation][OrientationMargins.SectionHeadingFirstColumnPercentage];
- Paragraph paragraph = new Paragraph().SetTextAlignment(TextAlignment.LEFT).SetMultipliedLeading(1f).SetMarginTop(marginTop);
- Table table = new Table(new UnitValue[] { new UnitValue(UnitValue.PERCENT, firstColumnWidth), new UnitValue(UnitValue.PERCENT, 100f - firstColumnWidth) }).UseAllAvailableWidth();
-
- table.SetBorder(Border.NO_BORDER);
- Cell cLeft = new Cell();
- Cell cRight = new Cell();
- cLeft.SetBorder(Border.NO_BORDER);
- cRight.SetBorder(Border.NO_BORDER);
+ /// Orientation of document
+ /// Paragraph with the given content.
+ public static Paragraph CreateTwoColumnParagraph(string textLeft, string textRight, Style font, Orientation pageOrientation, float marginTop = 15f)
+ {
+ float firstColumnWidth = Margins.OrientationMarginValues[pageOrientation][OrientationMargins.SectionHeadingFirstColumnPercentage];
+ Paragraph paragraph = new Paragraph().SetTextAlignment(TextAlignment.LEFT).SetMultipliedLeading(1f).SetMarginTop(marginTop);
+ Table table = new Table(new UnitValue[] { new UnitValue(UnitValue.PERCENT, firstColumnWidth), new UnitValue(UnitValue.PERCENT, 100f - firstColumnWidth) }).UseAllAvailableWidth();
+
+ table.SetBorder(Border.NO_BORDER);
+ Cell cLeft = new Cell();
+ Cell cRight = new Cell();
+ cLeft.SetBorder(Border.NO_BORDER);
+ cRight.SetBorder(Border.NO_BORDER);
if (!string.IsNullOrEmpty(textLeft))
{
- cLeft.Add(new Paragraph(new Text(textLeft)).AddStyle(font).SetMultipliedLeading(1f));
- }
+ cLeft.Add(new Paragraph(new Text(textLeft)).AddStyle(font).SetMultipliedLeading(1f));
+ }
if (!string.IsNullOrEmpty(textRight))
{
cRight.Add(new Paragraph(new Text(textRight)).AddStyle(font).SetMultipliedLeading(1f));
}
- table.AddCell(cLeft);
- table.AddCell(cRight);
- paragraph.Add(table);
-
- return paragraph;
- }
- }
-}
+ table.AddCell(cLeft);
+ table.AddCell(cRight);
+ paragraph.Add(table);
+
+ return paragraph;
+ }
+ }
+}
diff --git a/pdf-generator/appsettings.Development.json b/PDSLLabs.Public.QMSL.PDFGenerator/appsettings.Development.json
similarity index 100%
rename from pdf-generator/appsettings.Development.json
rename to PDSLLabs.Public.QMSL.PDFGenerator/appsettings.Development.json
diff --git a/pdf-generator/appsettings.json b/PDSLLabs.Public.QMSL.PDFGenerator/appsettings.json
similarity index 100%
rename from pdf-generator/appsettings.json
rename to PDSLLabs.Public.QMSL.PDFGenerator/appsettings.json
diff --git a/pdf-generator/nlog.config b/PDSLLabs.Public.QMSL.PDFGenerator/nlog.config
similarity index 84%
rename from pdf-generator/nlog.config
rename to PDSLLabs.Public.QMSL.PDFGenerator/nlog.config
index 06bc674e909280972014a7668711cf08e51b4eca..18243b0cd030930a4dd6fc178e484944a9b43438 100644
--- a/pdf-generator/nlog.config
+++ b/PDSLLabs.Public.QMSL.PDFGenerator/nlog.config
@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Info"
- internalLogFile="c:\tmp\logs\pdf-generator\pdf-generator-internal-nlog.txt">
+ internalLogFile="c:\tmp\logs\pdf-generator-qmsl\pdf-generator-qmsl-internal-nlog.txt">
@@ -13,14 +13,14 @@
-
-
-
diff --git a/lib/PDFGenerator.Models.dll b/lib/PDFGenerator.Models.dll
deleted file mode 100644
index a533680ced656bbb5f32b19ebd296932329dac84..0000000000000000000000000000000000000000
Binary files a/lib/PDFGenerator.Models.dll and /dev/null differ
diff --git a/lib/PDSLLabs.QMSL.PDFGenerator.Models.dll b/lib/PDSLLabs.QMSL.PDFGenerator.Models.dll
new file mode 100644
index 0000000000000000000000000000000000000000..1323ee46cb378c4c6cbe5f5d513cf80bf05a3184
Binary files /dev/null and b/lib/PDSLLabs.QMSL.PDFGenerator.Models.dll differ
diff --git a/nomad/live.nomad b/nomad/live.nomad
index 352a22d976b729a61d97e99a9a253feb1880975f..a268e13df757ad6622575f281adb0baca8e400fd 100644
--- a/nomad/live.nomad
+++ b/nomad/live.nomad
@@ -1,5 +1,5 @@
# This should best be equal to project name, and also the binary name without extension. This defines the ${NOMAD_JOB_NAME}
-job "pdf-generator" {
+job "pdf-generator-qmsl" {
datacenters = ["rwth-app-live"]
type = "service"
@@ -9,7 +9,7 @@ job "pdf-generator" {
}
# Should probably be equal to the Job Name in most cases. This defines the ${NOMAD_GROUP_NAME}
- group "pdf-generator" {
+ group "pdf-generator-qmsl" {
count = 2
network {
@@ -19,7 +19,7 @@ job "pdf-generator" {
# Should probably be equal to the Job/Group Name in most cases. This defines the ${NOMAD_TASK_NAME}
- task "pdf-generator" {
+ task "pdf-generator-qmsl" {
driver = "raw_exec"
@@ -30,7 +30,7 @@ job "pdf-generator" {
# Currently raw_exec will execute everything directly from the created alloc dir ${NOMAD_ALLOC_DIR},
# but the content will be placed in the /local subdirectory {$NOMAD_TASK_DIR}
args = [
- "local/output/pdf-generator.dll",
+ "local/output/PDSLLabs.Public.QMSL.PDFGenerator.dll",
"local/output/appsettings.json"
]
}
@@ -48,7 +48,7 @@ job "pdf-generator" {
port = "http"
tags = [
"traefik.enable=true",
- "traefik.http.routers.pdfgenerator.entrypoints=internal",
+ "traefik.http.routers.pdfgeneratorqmsl.entrypoints=internal",
"traefik.Path=/${NOMAD_TASK_NAME}"
]
diff --git a/nomad/testing.nomad b/nomad/testing.nomad
index 04f6586e5aff8279776b37676c4140ce6a66af73..fb0443de7c96f71d703d4e9b77388100c8c680bf 100644
--- a/nomad/testing.nomad
+++ b/nomad/testing.nomad
@@ -1,5 +1,5 @@
# This should best be equal to project name, and also the binary name without extension. This defines the ${NOMAD_JOB_NAME}
-job "pdf-generator" {
+job "pdf-generator-qmsl" {
datacenters = ["rwth-app-testing"]
type = "service"
@@ -9,7 +9,7 @@ job "pdf-generator" {
}
# Should probably be equal to the Job Name in most cases. This defines the ${NOMAD_GROUP_NAME}
- group "pdf-generator" {
+ group "pdf-generator-qmsl" {
count = 2
network {
@@ -19,7 +19,7 @@ job "pdf-generator" {
# Should probably be equal to the Job/Group Name in most cases. This defines the ${NOMAD_TASK_NAME}
- task "pdf-generator" {
+ task "pdf-generator-qmsl" {
driver = "raw_exec"
@@ -30,7 +30,7 @@ job "pdf-generator" {
# Currently raw_exec will execute everything directly from the created alloc dir ${NOMAD_ALLOC_DIR},
# but the content will be placed in the /local subdirectory {$NOMAD_TASK_DIR}
args = [
- "local/output/pdf-generator.dll",
+ "local/output/PDSLLabs.Public.QMSL.PDFGenerator.dll",
"local/output/appsettings.json"
]
}
@@ -48,7 +48,7 @@ job "pdf-generator" {
port = "http"
tags = [
"traefik.enable=true",
- "traefik.http.routers.pdfgenerator.entrypoints=internal",
+ "traefik.http.routers.pdfgeneratorqmsl.entrypoints=internal",
"traefik.Path=/${NOMAD_TASK_NAME}"
]