Compare commits
No commits in common. "2a67fc2582d8aa131afc770a32cdf79e9ce3b563" and "2ff89e17c58deb3071cfdf277206da7b4c4c15ac" have entirely different histories.
2a67fc2582
...
2ff89e17c5
@ -71,16 +71,42 @@ namespace ZPDuszynska.Controllers
|
|||||||
public IActionResult Tabliczki()
|
public IActionResult Tabliczki()
|
||||||
{
|
{
|
||||||
Tabliczka1Model model = new Tabliczka1Model();
|
Tabliczka1Model model = new Tabliczka1Model();
|
||||||
model.Line1_1 = "ŚP. ";
|
model.Line1_1 = "Z głębokim żalem zawiadamiamy, że dnia ";
|
||||||
model.Line1_2 = "Zbigniew";
|
model.Line1_2 = "1 stycznia ";
|
||||||
|
model.Line1_3 = "2025 roku";
|
||||||
|
|
||||||
model.Line2_1 = "KOWALSKI";
|
model.Line2_1 = "odszedł od nas na zawsze w wieku ";
|
||||||
|
model.Line2_2 = "66 ";
|
||||||
|
model.Line2_3 = "lat";
|
||||||
|
|
||||||
model.Line3_1 = "żył lat ";
|
model.Line3_1 = "ŚP. ";
|
||||||
model.Line3_2 = "99 ";
|
model.Line3_2 = "JAN";
|
||||||
model.Line3_3 = "zm. 01 I 2025";
|
|
||||||
|
model.Line4_1 = "KOWALSKI";
|
||||||
|
|
||||||
|
model.Line11_1 = "";
|
||||||
|
model.Line11_2 = "";
|
||||||
|
|
||||||
|
model.Line5_1 = "Dom Żałoby: ";
|
||||||
|
|
||||||
|
model.Line6_1 = "Wystawienie Zmarłego w Kościele o godz. ";
|
||||||
|
model.Line6_2 = "13.30";
|
||||||
|
|
||||||
|
model.Line7_1 = "Msza Święta Żałobna odprawiona zostanie w Kościele w Milejowie";
|
||||||
|
|
||||||
|
model.Line8_1 = "dnia ";
|
||||||
|
model.Line8_2 = "8 marca ";
|
||||||
|
model.Line8_3 = "2025r. (";
|
||||||
|
model.Line8_4 = "sobota";
|
||||||
|
model.Line8_5 = ") o godz. ";
|
||||||
|
model.Line8_6 = "14.00";
|
||||||
|
model.Line8_7 = ", po której nastąpi";
|
||||||
|
|
||||||
|
model.Line9_1 = "odprowadzenie Zmarłego na miejscowy cmentarz rzymskokatolicki";
|
||||||
|
|
||||||
|
model.Line10_1 = "Pogrążona w smutku ";
|
||||||
|
model.Line10_2 = "NAJBLIŻSZA RODZINA";
|
||||||
|
|
||||||
model.Line4_1 = "Prosi o modlitwę";
|
|
||||||
|
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
@ -212,7 +238,7 @@ namespace ZPDuszynska.Controllers
|
|||||||
[Authorize]
|
[Authorize]
|
||||||
public ActionResult Tabliczki(Tabliczka1Model model)
|
public ActionResult Tabliczki(Tabliczka1Model model)
|
||||||
{
|
{
|
||||||
string inputPath = "tabliczka_template.pdf";
|
string inputPath = "nekrolog_template.pdf";
|
||||||
|
|
||||||
iTextSharp.text.pdf.PdfReader reader = new iTextSharp.text.pdf.PdfReader(inputPath);
|
iTextSharp.text.pdf.PdfReader reader = new iTextSharp.text.pdf.PdfReader(inputPath);
|
||||||
Rectangle size = reader.GetPageSizeWithRotation(1);
|
Rectangle size = reader.GetPageSizeWithRotation(1);
|
||||||
@ -228,31 +254,97 @@ namespace ZPDuszynska.Controllers
|
|||||||
MyTextLine l1 = new MyTextLine
|
MyTextLine l1 = new MyTextLine
|
||||||
{
|
{
|
||||||
texts = new List<MyText>() {
|
texts = new List<MyText>() {
|
||||||
new MyText { text = model.Line1_1, fontBold = false, fontSize = 40 },
|
new MyText { text = model.Line1_1, fontBold = false, fontSize = 34 },
|
||||||
new MyText { text = model.Line1_2, fontBold = true, fontSize = 90 }}
|
new MyText { text = model.Line1_2, fontBold = true, fontSize = 34 },
|
||||||
|
new MyText { text = model.Line1_3, fontBold = false, fontSize = 34 } }
|
||||||
};
|
};
|
||||||
MyTextLine l2 = new MyTextLine
|
MyTextLine l2 = new MyTextLine
|
||||||
{
|
{
|
||||||
texts = new List<MyText>() {
|
texts = new List<MyText>() {
|
||||||
new MyText { text = model.Line2_1, fontBold = true, fontSize = 130 }}
|
new MyText { text = model.Line2_1, fontBold = false, fontSize = 34 },
|
||||||
|
new MyText { text = model.Line2_2, fontBold = true, fontSize = 44 },
|
||||||
|
new MyText { text = model.Line2_3, fontBold = false, fontSize = 34 } }
|
||||||
};
|
};
|
||||||
MyTextLine l3 = new MyTextLine
|
MyTextLine l3 = new MyTextLine
|
||||||
{
|
{
|
||||||
texts = new List<MyText>() {
|
texts = new List<MyText>() {
|
||||||
new MyText { text = model.Line3_1, fontBold = false, fontSize = 60 },
|
new MyText { text = model.Line3_1, fontBold = false, fontSize = 50 },
|
||||||
new MyText { text = model.Line3_2, fontBold = true, fontSize = 60 },
|
new MyText { text = model.Line3_2, fontBold = true, fontSize = 90 } }
|
||||||
new MyText { text = model.Line3_3, fontBold = false, fontSize = 60 } }
|
|
||||||
};
|
};
|
||||||
|
MyTextLine l5 = new MyTextLine
|
||||||
|
{
|
||||||
|
texts = new List<MyText>() {
|
||||||
|
new MyText { text = model.Line5_1, fontBold = false, fontSize = 32 } }
|
||||||
|
};
|
||||||
|
MyTextLine l6 = new MyTextLine
|
||||||
|
{
|
||||||
|
texts = new List<MyText>() {
|
||||||
|
new MyText { text = model.Line6_1, fontBold = false, fontSize = 32 },
|
||||||
|
new MyText { text = model.Line6_2, fontBold = true, fontSize = 32 } }
|
||||||
|
};
|
||||||
|
MyTextLine l7 = new MyTextLine
|
||||||
|
{
|
||||||
|
texts = new List<MyText>() {
|
||||||
|
new MyText { text = model.Line7_1, fontBold = false, fontSize = 32 } }
|
||||||
|
};
|
||||||
|
MyTextLine l8 = new MyTextLine
|
||||||
|
{
|
||||||
|
texts = new List<MyText>() {
|
||||||
|
new MyText { text = model.Line8_1, fontBold = false, fontSize = 32 },
|
||||||
|
new MyText { text = model.Line8_2, fontBold = true, fontSize = 32 },
|
||||||
|
new MyText { text = model.Line8_3, fontBold = false, fontSize = 32 },
|
||||||
|
new MyText { text = model.Line8_4, fontBold = true, fontSize = 32 },
|
||||||
|
new MyText { text = model.Line8_5, fontBold = false, fontSize = 32 },
|
||||||
|
new MyText { text = model.Line8_6, fontBold = true, fontSize = 32 },
|
||||||
|
new MyText { text = model.Line8_7, fontBold = false, fontSize = 32 } }
|
||||||
|
};
|
||||||
|
MyTextLine l9 = new MyTextLine
|
||||||
|
{
|
||||||
|
texts = new List<MyText>() {
|
||||||
|
new MyText { text = model.Line9_1, fontBold = false, fontSize = 32 } }
|
||||||
|
};
|
||||||
|
MyTextLine l10 = new MyTextLine
|
||||||
|
{
|
||||||
|
texts = new List<MyText>() {
|
||||||
|
new MyText { text = model.Line10_1, fontBold = false, fontSize = 20 },
|
||||||
|
new MyText { text = model.Line10_2, fontBold = true, fontSize = 20 } }
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(model.Line11_1 + model.Line11_2))
|
||||||
|
{
|
||||||
MyTextLine l4 = new MyTextLine
|
MyTextLine l4 = new MyTextLine
|
||||||
{
|
{
|
||||||
texts = new List<MyText>() {
|
texts = new List<MyText>() {
|
||||||
new MyText { text = model.Line4_1, fontBold = false, fontSize = 50 } }
|
new MyText { text = model.Line4_1, fontBold = true, fontSize = 110 } }
|
||||||
};
|
};
|
||||||
|
MyTextLine l11 = new MyTextLine
|
||||||
|
{
|
||||||
|
texts = new List<MyText>() {
|
||||||
|
new MyText { text = model.Line11_1, fontBold = false, fontSize = 30 },
|
||||||
|
new MyText { text = model.Line11_2, fontBold = true, fontSize = 40 } }
|
||||||
|
};
|
||||||
|
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 70, 415, 700, l4);
|
||||||
|
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 70, 290, 700, l11);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MyTextLine l4 = new MyTextLine
|
||||||
|
{
|
||||||
|
texts = new List<MyText>() {
|
||||||
|
new MyText { text = model.Line4_1, fontBold = true, fontSize = 150 } }
|
||||||
|
};
|
||||||
|
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 70, 415, 700, l4);
|
||||||
|
}
|
||||||
|
|
||||||
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 270, 480, 515-70, l1);
|
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 70, 550, 700, l1);
|
||||||
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 210, 400, 500, l2);
|
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 70, 523, 700, l2);
|
||||||
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 145, 250, 550, l3);
|
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 70, 490, 600, l3);
|
||||||
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 125, 170, 590, l4);
|
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 70, 240, 700, l5);
|
||||||
|
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 70, 215, 700, l6);
|
||||||
|
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 70, 190, 700, l7);
|
||||||
|
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 70, 165, 700, l8);
|
||||||
|
AddTextToPdf(cb, PdfPCell.ALIGN_CENTER, 70, 140, 700, l9);
|
||||||
|
AddTextToPdf(cb, PdfPCell.ALIGN_RIGHT, 70, 102, 720, l10);
|
||||||
|
|
||||||
document.Close();
|
document.Close();
|
||||||
var result = ms.ToArray();
|
var result = ms.ToArray();
|
||||||
@ -261,47 +353,11 @@ namespace ZPDuszynska.Controllers
|
|||||||
writer.Close();
|
writer.Close();
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
|
||||||
Response.Headers["Content-Disposition"] = "inline; filename=Tabliczka.pdf";
|
Response.Headers["Content-Disposition"] = "inline; filename=Nekrolog.pdf";
|
||||||
//return File(result.ToArray(), "application/pdf");
|
return File(result.ToArray(), "application/pdf");
|
||||||
return File(CreateMirroredPdf(result.ToArray()), "application/pdf");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] CreateMirroredPdf(byte[] pdfBytes)
|
|
||||||
{
|
|
||||||
using (MemoryStream inputStream = new MemoryStream(pdfBytes))
|
|
||||||
using (MemoryStream outputStream = new MemoryStream())
|
|
||||||
{
|
|
||||||
PdfReader reader = new PdfReader(inputStream);
|
|
||||||
Document document = new Document(reader.GetPageSizeWithRotation(1));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
PdfWriter writer = PdfWriter.GetInstance(document, outputStream);
|
|
||||||
document.Open();
|
|
||||||
PdfContentByte cb = writer.DirectContent;
|
|
||||||
|
|
||||||
for (int i = 1; i <= reader.NumberOfPages; i++)
|
|
||||||
{
|
|
||||||
document.NewPage();
|
|
||||||
PdfImportedPage page = writer.GetImportedPage(reader, i);
|
|
||||||
float pageWidth = reader.GetPageSize(i).Width;
|
|
||||||
|
|
||||||
// **🔹 Lustrzane odbicie strony w poziomie**
|
|
||||||
cb.SaveState();
|
|
||||||
cb.ConcatCTM(-1, 0, 0, 1, pageWidth, 0);
|
|
||||||
cb.AddTemplate(page, 0, 0);
|
|
||||||
cb.RestoreState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
document.Close(); // Musimy jawnie zamknąć dokument!
|
|
||||||
reader.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return outputStream.ToArray(); // Zwracamy PDF jako `byte[]`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public IActionResult Privacy()
|
public IActionResult Privacy()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
@ -358,7 +414,6 @@ namespace ZPDuszynska.Controllers
|
|||||||
// cell.MinimumHeight = height;
|
// cell.MinimumHeight = height;
|
||||||
// cell.FixedHeight = height;
|
// cell.FixedHeight = height;
|
||||||
cell.Border = PdfPCell.NO_BORDER;
|
cell.Border = PdfPCell.NO_BORDER;
|
||||||
//cell.Border = PdfPCell.BOTTOM_BORDER|PdfPCell.LEFT_BORDER | PdfPCell.RIGHT_BORDER | PdfPCell.TOP_BORDER;
|
|
||||||
table.AddCell(cell);
|
table.AddCell(cell);
|
||||||
table.TotalWidth = width;
|
table.TotalWidth = width;
|
||||||
table.WriteSelectedRows(0, -1, x, y, cb);
|
table.WriteSelectedRows(0, -1, x, y, cb);
|
||||||
|
|||||||
@ -4,13 +4,39 @@
|
|||||||
{
|
{
|
||||||
public string Line1_1 { get; set; }
|
public string Line1_1 { get; set; }
|
||||||
public string Line1_2 { get; set; }
|
public string Line1_2 { get; set; }
|
||||||
|
public string Line1_3 { get; set; }
|
||||||
|
|
||||||
public string Line2_1 { get; set; }
|
public string Line2_1 { get; set; }
|
||||||
|
public string Line2_2 { get; set; }
|
||||||
|
public string Line2_3 { get; set; }
|
||||||
|
|
||||||
public string Line3_1 { get; set; }
|
public string Line3_1 { get; set; }
|
||||||
public string Line3_2 { get; set; }
|
public string Line3_2 { get; set; }
|
||||||
public string Line3_3 { get; set; }
|
|
||||||
|
|
||||||
public string Line4_1 { get; set; }
|
public string Line4_1 { get; set; }
|
||||||
|
|
||||||
|
public string Line11_1 { get; set; }
|
||||||
|
public string Line11_2 { get; set; }
|
||||||
|
|
||||||
|
public string Line5_1 { get; set; }
|
||||||
|
|
||||||
|
public string Line6_1 { get; set; }
|
||||||
|
public string Line6_2 { get; set; }
|
||||||
|
|
||||||
|
public string Line7_1 { get; set; }
|
||||||
|
|
||||||
|
public string Line8_1 { get; set; }
|
||||||
|
public string Line8_2 { get; set; }
|
||||||
|
public string Line8_3 { get; set; }
|
||||||
|
public string Line8_4 { get; set; }
|
||||||
|
public string Line8_5 { get; set; }
|
||||||
|
public string Line8_6 { get; set; }
|
||||||
|
public string Line8_7 { get; set; }
|
||||||
|
|
||||||
|
public string Line9_1 { get; set; }
|
||||||
|
|
||||||
|
public string Line10_1 { get; set; }
|
||||||
|
public string Line10_2 { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,16 +35,6 @@
|
|||||||
},
|
},
|
||||||
"publishAllPorts": true,
|
"publishAllPorts": true,
|
||||||
"useSSL": true
|
"useSSL": true
|
||||||
},
|
|
||||||
"WSL": {
|
|
||||||
"commandName": "WSL2",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"launchUrl": "https://localhost:7223",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
|
||||||
"ASPNETCORE_URLS": "https://localhost:7223;http://localhost:5169"
|
|
||||||
},
|
|
||||||
"distributionName": ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
|
|||||||
@ -10,22 +10,55 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<section>
|
<section>
|
||||||
<form id="account" method="post" action="@Url.Action("Tabliczki", "Home")" target="_blank">
|
<form id="account" method="post" action="@Url.Action("Nekrologi", "Home")" target="_blank">
|
||||||
<div class="d-flex gap-2 mb-3">
|
<div class="d-flex gap-2 mb-3">
|
||||||
<input asp-for="Line1_1" class="form-control" aria-required="true" />
|
<input asp-for="Line1_1" class="form-control" aria-required="true" />
|
||||||
<input asp-for="Line1_2" class="form-control fw-bold" aria-required="true" />
|
<input asp-for="Line1_2" class="form-control fw-bold" aria-required="true" />
|
||||||
|
<input asp-for="Line1_3" class="form-control" aria-required="true" />
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex gap-2 mb-3">
|
<div class="d-flex gap-2 mb-3">
|
||||||
<input asp-for="Line2_1" class="form-control fw-bold" aria-required="true" />
|
<input asp-for="Line2_1" class="form-control" aria-required="true" />
|
||||||
|
<input asp-for="Line2_2" class="form-control fw-bold" aria-required="true" />
|
||||||
|
<input asp-for="Line2_3" class="form-control" aria-required="true" />
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex gap-2 mb-3">
|
<div class="d-flex gap-2 mb-3">
|
||||||
<input asp-for="Line3_1" class="form-control" aria-required="true" />
|
<input asp-for="Line3_1" class="form-control" aria-required="true" />
|
||||||
<input asp-for="Line3_2" class="form-control fw-bold" aria-required="true" />
|
<input asp-for="Line3_2" class="form-control fw-bold" aria-required="true" />
|
||||||
<input asp-for="Line3_3" class="form-control" aria-required="true" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex gap-2 mb-3">
|
<div class="d-flex gap-2 mb-3">
|
||||||
<input asp-for="Line4_1" class="form-control" aria-required="true" />
|
<input asp-for="Line4_1" class="form-control fw-bold" aria-required="true" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="d-flex gap-2 mb-3">
|
||||||
|
<input asp-for="Line11_1" class="form-control" aria-required="true" />
|
||||||
|
<input asp-for="Line11_2" class="form-control fw-bold" aria-required="true" />
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2 mb-3">
|
||||||
|
<input asp-for="Line5_1" class="form-control" aria-required="true" />
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2 mb-3">
|
||||||
|
<input asp-for="Line6_1" class="form-control" aria-required="true" />
|
||||||
|
<input asp-for="Line6_2" class="form-control fw-bold" aria-required="true" />
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2 mb-3">
|
||||||
|
<input asp-for="Line7_1" class="form-control" aria-required="true" />
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2 mb-3">
|
||||||
|
<input asp-for="Line8_1" class="form-control" aria-required="true" />
|
||||||
|
<input asp-for="Line8_2" class="form-control fw-bold" aria-required="true" />
|
||||||
|
<input asp-for="Line8_3" class="form-control" aria-required="true" />
|
||||||
|
<input asp-for="Line8_4" class="form-control fw-bold" aria-required="true" />
|
||||||
|
<input asp-for="Line8_5" class="form-control" aria-required="true" />
|
||||||
|
<input asp-for="Line8_6" class="form-control fw-bold" aria-required="true" />
|
||||||
|
<input asp-for="Line8_7" class="form-control" aria-required="true" />
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2 mb-3">
|
||||||
|
<input asp-for="Line9_1" class="form-control" aria-required="true" />
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2 mb-3">
|
||||||
|
<input asp-for="Line10_1" class="form-control" aria-required="true" />
|
||||||
|
<input asp-for="Line10_2" class="form-control fw-bold" aria-required="true" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button id="login-submit" type="submit" class="w-100 btn btn-lg btn-primary">Generuj</button>
|
<button id="login-submit" type="submit" class="w-100 btn btn-lg btn-primary">Generuj</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -35,9 +35,6 @@
|
|||||||
<None Update="nekrolog_template.pdf">
|
<None Update="nekrolog_template.pdf">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Update="tabliczka_template.pdf">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="times.ttf">
|
<None Update="times.ttf">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user