Esempio n. 1
0
        /// <summary>
        /// process list as last page of creating PDF
        /// </summary>
        /// <param name="toc"></param>
        /// <param name="doc"></param>
        private static void processDocumentLinkedList(List <KeyValuePair <string, int> > toc, Document doc)
        {
            PdfFont font = PdfFontFactory.CreateFont(StandardFonts.HELVETICA);
            PdfFont bold = PdfFontFactory.CreateFont(StandardFonts.HELVETICA_BOLD);

            doc.Add(new AreaBreak(AreaBreakType.NEXT_PAGE));
            Paragraph p = new Paragraph().SetFont(bold).Add("Obsah");

            doc.Add(p);

            List <TabStop> tabStops = new List <TabStop>();

            tabStops.Add(new TabStop(580, TabAlignment.RIGHT, new iText.Kernel.Pdf.Canvas.Draw.DottedLine()));
            foreach (KeyValuePair <string, int> entry in toc)
            {
                p = new iText.Layout.Element.Paragraph()
                    .AddTabStops(tabStops)
                    .Add(entry.Key)
                    .Add(new Tab())
                    .Add(entry.Value.ToString())
                    .SetAction(PdfAction.CreateGoTo(PdfExplicitRemoteGoToDestination.CreateFit(entry.Value)));

                doc.Add(p);
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            FileInfo file = new FileInfo(DEST);

            file.Directory.Create();


            PdfWriter writer = new PdfWriter(DEST);

            PdfDocument pdf = new PdfDocument(writer);

            Document document = new Document(pdf, PageSize.A4);

            document.SetMargins(20, 20, 20, 20);

            PdfFont italized = PdfFontFactory.CreateFont(StandardFonts.TIMES_BOLDITALIC);
            PdfFont normal   = PdfFontFactory.CreateFont(StandardFonts.TIMES_ROMAN);

            /*string date = "8/2/2021";
             * string name = "Farmacia Satos";
             * string adress = "Blvd los Poeta Juticalpa Olancho";
             * string RTN = "1601-1979-025635";*/
            string testA = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
            string testB = "ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss";
            //int length = 110;


            Paragraph p = new Paragraph(char.MinValue + "\n\n\n\n\n\n\n\n\n\n\n");

            /* p.Add(char.MinValue + "                               8/2/2021\n\n\n");
             * p.Add(char.MinValue + "                                   Farmacia Satos\n\n");
             * p.Add(char.MinValue + "                                   Blvd lost poeta Juticalpa Olancho                                               1601-1979-025635");*/

            //p.Add("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
            //p.Add("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS");
            //p.Add("ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss");


            Console.WriteLine(testB.Length + " this is b length");
            Console.WriteLine(testA.Length + " this is a length");



            p.SetFontSize(9);

            document.Add(p);

            document.Close();
        }
Esempio n. 3
0
        private void Print <T>(bool isRaw, List <T> selectedPersons, int rawpagesCount = 0) where T : IPerson
        {
            var filePath = Path.Combine(Constants.WorkingDirectory, typeof(T) == typeof(Rozhodci) ? "vyplatni-listina-rozhodci.pdf" : "vyplatni-listina-ceta.pdf");

            using (var writer = new PdfWriter(filePath))
            {
                using (var pdf = new PdfDocument(writer))
                {
                    var doc = new Document(pdf, PageSize.A4.Rotate());
                    doc.SetMargins(23, 38, 20, 38);
                    var pagesCount = (int)Math.Ceiling((double)selectedPersons.Count / 10);
                    if (pagesCount == 0)
                    {
                        pagesCount = 1;
                    }
                    if (isRaw)
                    {
                        pagesCount = rawpagesCount;
                    }

                    var font = PdfFontFactory.CreateFont(iText.IO.Font.Constants.StandardFonts.HELVETICA, PdfEncodings.CP1250);
                    var bold = PdfFontFactory.CreateFont(iText.IO.Font.Constants.StandardFonts.HELVETICA_BOLD, PdfEncodings.CP1250);

                    var mainHeaderTitle    = _settings.IsClubNameEnabled ? _settings.ClubName : new string('.', 80);
                    var documentMainHeader = new Paragraph($"TJ, Sportovní klub, Atletický oddíl, Atletický klub: {mainHeaderTitle}")
                                             .SetFont(bold).SetFontSize(16).SetTextAlignment(TextAlignment.CENTER);
                    var listinaHeadText = "VÝPLATNÍ LISTINA ODMĚN ";
                    listinaHeadText += typeof(T) == typeof(Rozhodci) ? "ROZHODČÍCH" : "TECHNICKÉ ČETY";
                    var vyplatniListinaHead = new Paragraph(listinaHeadText)
                                              .SetFont(bold).SetFontSize(16).SetTextAlignment(TextAlignment.CENTER).SetMarginTop(-3);
                    var rules = new Paragraph(
                        "Níže podepsaní účastníci soutěže souhlasili s uvedením svých osobních údajů na této výplatní listině (jméno, příjmení, datum narození a adresa).")
                                .SetFont(font).SetFontSize(9).SetTextAlignment(TextAlignment.CENTER).SetMarginTop(-1).SetMarginBottom(1);
                    var evidenceText =
                        new Paragraph(
                            $"Tyto údaje budou součástí evidence {new string('.', 123)} a budou jen pro vnitřní potřebu.")
                        .SetFont(font).SetFontSize(9).SetTextAlignment(TextAlignment.CENTER).SetMarginTop(-1);

                    var aboutcompetition = new Table(UnitValue.CreatePercentArray(new[] { 52.15f, 47.85f })).SetMarginTop(1).UseAllAvailableWidth();
                    aboutcompetition.AddCell(_settings.IsCompetitionNameEnabled
                                                ? AboutCompetitionCell($"Název soutěže: {_settings.CompetitionName}", bold)
                                                : AboutCompetitionCell($"Název soutěže {new string('.', 89)}", bold));

                    if (_settings.IsCompetitionDateEnabled)
                    {
                        if (_settings.CompetitionStartDate.HasValue && _settings.CompetitionEndDate == null)
                        {
                            aboutcompetition.AddCell(
                                AboutCompetitionCell($"Datum konání soutěže: {_settings.CompetitionStartDate.Value:dd.MM.yyyy}", bold));
                        }
                        else if (_settings.CompetitionStartDate.HasValue && _settings.CompetitionEndDate.HasValue)
                        {
                            aboutcompetition.AddCell(AboutCompetitionCell(
                                                         $"Datum konání soutěže: {_settings.CompetitionStartDate.Value:dd.MM.yyyy} - {_settings.CompetitionEndDate.Value:dd.MM.yyyy}",
                                                         bold));
                        }
                        else
                        {
                            aboutcompetition.AddCell(AboutCompetitionCell($"Datum konání soutěže {new string('.', 70)}", bold));
                        }
                    }
                    else
                    {
                        aboutcompetition.AddCell(AboutCompetitionCell($"Datum konání soutěže {new string('.', 70)}", bold));
                    }

                    var aboutcompetition2 = new Table(UnitValue.CreatePercentArray(new[] { 52.15f, 47.85f })).SetMarginTop(3).UseAllAvailableWidth();
                    if (_settings.IsCompetitionTimeEnabled)
                    {
                        if (_settings.CompetitionStartTime.HasValue && _settings.CompetitionEndTime == null)
                        {
                            aboutcompetition2.AddCell(
                                AboutCompetitionCell($"Doba konání soutěže: {_settings.CompetitionStartTime.Value:HH:mm} - ", bold));
                        }
                        else if (_settings.CompetitionStartTime.HasValue && _settings.CompetitionEndTime.HasValue)
                        {
                            aboutcompetition2.AddCell(AboutCompetitionCell(
                                                          $"Doba konání soutěže: {_settings.CompetitionStartTime.Value:HH:mm} - {_settings.CompetitionEndTime.Value:HH:mm}",
                                                          bold));
                        }
                        else
                        {
                            aboutcompetition2.AddCell(AboutCompetitionCell($"Doba konání soutěže {new string('.', 78)}", bold));
                        }
                    }
                    else
                    {
                        aboutcompetition2.AddCell(AboutCompetitionCell($"Doba konání soutěže {new string('.', 78)}", bold));
                    }

                    aboutcompetition2.AddCell(_settings.IsCompetitionPlaceEnabled
                                                ? AboutCompetitionCell($"Místo konání soutěže: {_settings.CompetitionPlace}", bold)
                                                : AboutCompetitionCell($"Místo konání soutěže {new string('.', 72)}", bold));

                    #region TableHead

                    var pdfNumber = new Cell(2, 1).SetTextAlignment(TextAlignment.CENTER)
                                    .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                    .SetFont(font)
                                    .SetPadding(0)
                                    .SetBorder(new SolidBorder(1));
                    pdfNumber.Add(new Paragraph("Pořadové"));
                    pdfNumber.Add(new Paragraph("číslo"));

                    var nameCell = new Cell().SetTextAlignment(TextAlignment.LEFT)
                                   .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                   .SetFont(font)
                                   .SetHeight(17)
                                   .SetBorder(new SolidBorder(1.2f))
                                   .SetBorderBottom(new GrooveBorder(DeviceCmyk.BLACK, 1, 0.5f))
                                   .SetPadding(0);
                    nameCell.Add(new Paragraph("Jméno a příjmení")).SetPaddingLeft(17);
                    var addressCell = new Cell().SetTextAlignment(TextAlignment.LEFT)
                                      .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                      .SetFont(font)
                                      .SetHeight(17)
                                      .SetBorder(new SolidBorder(1.2f))
                                      .SetBorderTop(Border.NO_BORDER)
                                      .SetPadding(0);
                    addressCell.Add(new Paragraph("Přesná adresa")).SetPaddingLeft(17);

                    var birthDate = new Cell(2, 1).SetTextAlignment(TextAlignment.CENTER)
                                    .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                    .SetFont(font)
                                    .SetPadding(0);
                    birthDate.Add(new Paragraph("Datum"));
                    birthDate.Add(new Paragraph("narození"));

                    var awardCell = new Cell(2, 1).SetTextAlignment(TextAlignment.CENTER)
                                    .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                    .SetFont(font)
                                    .SetPadding(0);
                    awardCell.Add(new Paragraph("Odměna"));
                    awardCell.Add(new Paragraph("Kč"));

                    var signCell = new Cell(2, 1).SetTextAlignment(TextAlignment.CENTER)
                                   .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                   .SetFont(font)
                                   .SetPadding(0);
                    signCell.Add(new Paragraph("Potvrzení o přijetí odměny"));
                    signCell.Add(new Paragraph("Podpis"));

                    #endregion

                    #region Tabulka Bottom

                    var emptyCell = new Cell().SetBorder(Border.NO_BORDER).SetPadding(0f);

                    var sumtextCell = new Cell(1, 2).SetFont(bold).SetFontSize(15).SetTextAlignment(TextAlignment.RIGHT)
                                      .SetBackgroundColor(ColorConstants.LIGHT_GRAY).SetPadding(0);
                    sumtextCell.Add(new Paragraph("CELKEM VYPLACENO: ")).SetPaddingRight(2);

                    var last = new Paragraph(
                        "Vyplatil...............................................     Dne...............................................     Podpis...............................................")
                               .SetFont(font)
                               .SetFontSize(12)
                               .SetMarginTop(8);

                    #endregion

                    for (int i = 0; i < pagesCount; i++)
                    {
                        doc.Add(documentMainHeader);
                        doc.Add(vyplatniListinaHead);
                        doc.Add(rules);
                        doc.Add(evidenceText);
                        doc.Add(aboutcompetition);
                        doc.Add(aboutcompetition2);

                        #region Table

                        var rozhodciTable = new Table(new float[] { 65, 355, 100, 80, 170 })
                                            .UseAllAvailableWidth()
                                            .SetMarginTop(6f)
                                            .SetFontSize(FontSize);

                        rozhodciTable.SetWidth(765f);
                        rozhodciTable.SetBorder(Border.NO_BORDER);
                        rozhodciTable.AddCell(pdfNumber);
                        rozhodciTable.AddCell(nameCell);
                        rozhodciTable.AddCell(birthDate);
                        rozhodciTable.AddCell(awardCell);
                        rozhodciTable.AddCell(signCell);
                        rozhodciTable.AddCell(addressCell);

                        for (int j = 0; j < 10; j++)
                        {
                            var index         = j + i * 10;
                            var pdfNumberData = new Cell(2, 1).SetTextAlignment(TextAlignment.CENTER)
                                                .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                                .SetFont(font)
                                                .SetFontSize(15)
                                                .SetHeight(30)
                                                .SetPadding(0)
                                                .SetBorder(new SolidBorder(1))
                                                .SetBorderLeft(new SolidBorder(1));
                            pdfNumberData.Add(new Paragraph((j + 1).ToString()));

                            var nameCellData = new Cell().SetTextAlignment(TextAlignment.LEFT)
                                               .SetFont(font)
                                               .SetHeight(15)
                                               .SetBorder(new SolidBorder(1.2f))
                                               .SetBorderBottom(new GrooveBorder(DeviceCmyk.BLACK, 1, 0.5f))
                                               .SetPadding(0);

                            var addressCellData = new Cell().SetTextAlignment(TextAlignment.LEFT)
                                                  .SetFont(font)
                                                  .SetHeight(15)
                                                  .SetBorder(new SolidBorder(1.2f))
                                                  .SetBorderTop(Border.NO_BORDER)
                                                  .SetPadding(0);

                            var birthDateData = new Cell(2, 1).SetTextAlignment(TextAlignment.CENTER)
                                                .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                                .SetFont(font)
                                                .SetPadding(0)
                                                .SetHeight(30);

                            var awardCellData = new Cell(2, 1).SetTextAlignment(TextAlignment.CENTER)
                                                .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                                .SetFont(font)
                                                .SetPadding(0)
                                                .SetHeight(30);

                            var signCellData = new Cell(2, 1).SetTextAlignment(TextAlignment.CENTER)
                                               .SetVerticalAlignment(VerticalAlignment.MIDDLE)
                                               .SetFont(font)
                                               .SetPadding(0)
                                               .SetHeight(30);
                            signCellData.Add(new Paragraph(""));

                            if (!isRaw && selectedPersons.Count > index)
                            {
                                nameCellData.Add(new Paragraph(selectedPersons[index].FullName)).SetPaddingLeft(17);
                                addressCellData.Add(new Paragraph($"{selectedPersons[index].Address}, {selectedPersons[index].City}"))
                                .SetPaddingLeft(17);
                                birthDateData.Add(new Paragraph(selectedPersons[index].BirthDate.ToShortDateString()));
                                awardCellData.Add(new Paragraph(selectedPersons[index].Reward.HasValue
                                                                        ? selectedPersons[index].Reward.Value.ToString()
                                                                        : ""));
                            }
                            else
                            {
                                nameCellData.Add(new Paragraph("")).SetPaddingLeft(17);
                                addressCellData.Add(new Paragraph("")).SetPaddingLeft(17);
                                birthDateData.Add(new Paragraph(""));
                                awardCellData.Add(new Paragraph(""));
                            }


                            rozhodciTable.AddCell(pdfNumberData);
                            rozhodciTable.AddCell(nameCellData);
                            rozhodciTable.AddCell(birthDateData);
                            rozhodciTable.AddCell(awardCellData);
                            rozhodciTable.AddCell(signCellData);
                            rozhodciTable.AddCell(addressCellData);
                        }

                        #endregion

                        var sumCell = new Cell().SetBackgroundColor(ColorConstants.LIGHT_GRAY)
                                      .SetPadding(0)
                                      .SetFont(bold)
                                      .SetFontSize(15)
                                      .SetTextAlignment(TextAlignment.CENTER)
                                      .SetVerticalAlignment(VerticalAlignment.MIDDLE);
                        sumCell.Add(selectedPersons.Count <= i * 10 + 10
                                                        ? new Paragraph(!isRaw ? CountSum(selectedPersons.GetRange(i * 10, selectedPersons.Count - i * 10)) : "")
                                                        : new Paragraph(!isRaw ? CountSum(selectedPersons.GetRange(i * 10, 10)) : ""));

                        rozhodciTable.AddCell(emptyCell);
                        rozhodciTable.AddCell(sumtextCell);
                        rozhodciTable.AddCell(sumCell);
                        rozhodciTable.AddCell(emptyCell);
                        doc.Add(rozhodciTable);

                        doc.Add(last);
                    }

                    doc.Close();
                }
            }

            Browser.OpenLink(filePath);
        }
Esempio n. 4
0
        public ActionResult PdfResultsView(string all)
        {
            // Must have write permissions to the path folder
            PdfWriter   writer   = new PdfWriter("C:\\demo.pdf");
            PdfDocument pdf      = new PdfDocument(writer);
            Document    document = new Document(pdf);
            Paragraph   header   = new Paragraph("HEADER")
                                   .SetTextAlignment(TextAlignment.CENTER)
                                   .SetFontSize(20);

            document.Add(header);
            document.Close();


            //using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
            //{
            //    Document document = new Document(PageSize.A4, 10, 10, 10, 10);

            //    PdfWriter writer = PdfWriter.GetInstance(document, memoryStream);
            //    document.Open();
            //    Story modelStory = new Story();
            //    DropdownModel model = new DropdownModel();

            //    //Create a single column table
            //    var t = new PdfPTable(1);

            //    //Tell it to fill the page horizontally
            //    t.WidthPercentage = 100;

            //    //Create a single cell
            //    var c = new PdfPCell();

            //    //Tell the cell to vertically align in the middle
            //    c.VerticalAlignment = Element.ALIGN_MIDDLE;

            //    //Tell the cell to fill the page vertically
            //    c.MinimumHeight = document.PageSize.Height - (document.BottomMargin + document.TopMargin);

            //    //Create a test paragraph
            //    //var p = new Paragraph("                    EBook Custom Favorite Recipes from whatscookingtreasures.com");
            //    //Add it a couple of times
            //    //c.AddElement(p);

            //    var imagePath1 = Server.MapPath("~/content/album.jpg");

            //    iTextSharp.text.Image pic1 = iTextSharp.text.Image.GetInstance(imagePath1);
            //    //pic1.BorderWidth = 0;
            //    pic1.BorderColor = Color.WHITE;

            //    c.AddElement(pic1);

            //    //Add the cell to the paragraph
            //    t.AddCell(c);

            //    //Add the table to the document
            //    document.Add(t);
            //    document.NewPage();



            //    string[] rowschosen = all.Split('|');
            //    int length = rowschosen.Length;

            //    for (int i = 0; i < length; i++)
            //    {
            //        var jatakaID = Convert.ToInt16(rowschosen[i]);
            //        GetLookups myGetLookups = new GetLookups();

            //        modelStory = myGetLookups.GetSpecificStory(jatakaID);
            //        var Stories = modelStory.Stories;

            //        Paragraph para = new Paragraph(Stories);
            //        para.Font = FontFactory.GetFont(FontFactory.HELVETICA, 14f);
            //        document.Add(para);
            //        if (i != length - 1)
            //        {
            //            document.NewPage();
            //        }

            //    }



            //    document.Close();
            //    byte[] bytes = memoryStream.ToArray();
            //    memoryStream.Close();
            //    Response.Clear();
            //    Response.ContentType = "application/pdf";

            //    string pdfName = "User";
            //    Response.AddHeader("Content-Disposition", "attachment; filename=" + pdfName + ".pdf");
            //    Response.ContentType = "application/pdf";
            //    Response.Buffer = true;
            //    Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
            //    Response.BinaryWrite(bytes);
            //    Response.End();
            //    Response.Close();
            //}



            return(View());
        }
Esempio n. 5
0
        private async void btnToPDF_Click(object sender, EventArgs e)
        {
            DateTime dateFrom = new DateTime(DateFrom.Value.Year, DateFrom.Value.Month, DateFrom.Value.Day, 00, 00, 01, 01);
            DateTime dateTo   = new DateTime(DateTo.Value.Year, DateTo.Value.Month, DateTo.Value.Day, 23, 59, 59, 59);


            var request = new Data.Requests.CompletedServicesSearchByDateRequest()
            {
                DateFrom     = dateFrom,
                DateTo       = dateTo,
                carServiceID = _carServiceID.GetValueOrDefault()
            };


            var model = await _EarningsOfCompletedServicesByDateService.Get <Data.Model.EarningsOfCompletedServices>(request);

            if (model.servicesList.Count() == 0)
            {
                MessageBox.Show("U odabranom periodu nema zarade niti od jedne usluge, te nije moguće procesirati izvještaj!", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            var fileName = request.DateFrom.ToString("dd.MM.yyyy") + "_" + request.DateTo.ToString("dd.MM.yyyy") + ".pdf";
            var path     = "..\\..\\Reports\\izvjestaj_o_zaradi_" + fileName;

            PdfWriter   writer   = new PdfWriter(path);
            PdfDocument pdf      = new PdfDocument(writer);
            Document    document = new Document(pdf);

            iText.Layout.Element.Paragraph header = new iText.Layout.Element.Paragraph("Izvještaj o zaradi od obavljenih usluga u periodu " + request.DateFrom.ToString("dd.MM.yyyy.")
                                                                                       + " - " + request.DateTo.ToString("dd.MM.yyyy.")).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
            document.Add(header);

            float[] columnWidths             = { 5, 4 };
            iText.Layout.Element.Table table = new iText.Layout.Element.Table(UnitValue.CreatePercentArray(columnWidths));
            table.SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.CENTER);

            Cell[] headerFooter = new Cell[] {
                new Cell().SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetBackgroundColor(new DeviceGray(0.75f)).Add(new Paragraph("Usluga")),
                new Cell().SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetBackgroundColor(new DeviceGray(0.75f)).Add(new Paragraph("Zarada(u KM)")),
            };

            foreach (Cell hfCell in headerFooter)
            {
                table.AddHeaderCell(hfCell);
            }

            foreach (var x in model.servicesList)
            {
                table.AddCell(new Cell().SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).Add(new Paragraph(x.ServiceName)));
                table.AddCell(new Cell().SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).Add(new Paragraph(x.Earnings.ToString())));
            }



            document.Add(table);

            double suma = 0;

            foreach (var s in model.servicesList)
            {
                suma += s.Earnings;
            }

            Cell sum = new Cell(1, 7)
                       .Add(new Paragraph("Ukupno: " + suma.ToString() + " KM"))
                       .SetFontSize(13)
                       .SetFontColor(DeviceGray.BLACK)
                       .SetBackgroundColor(DeviceGray.WHITE)
                       .SetTextAlignment(TextAlignment.RIGHT)
                       .SetBold();

            document.Add(sum);


            MessageBox.Show("Uspješno ste kreirali izvještaj", "Kreiranje izvještaja", MessageBoxButtons.OK, MessageBoxIcon.Information);


            document.Close();

            System.Diagnostics.Process.Start(path);
        }