public Table PrintConsolationBidding(int idx)
        {
            Table biddingtrening = PrintBiddingTable(game.boards[idx].bidding, game.boards[idx].rozklad.dealer, game.boards[idx].players);
            Table biddingOpen    = PrintBiddingTable(vugraph.boards[idx].bidding, vugraph.boards[idx].rozklad.dealer, vugraph.boards[idx].players);
            Table biddingClosed  = PrintBiddingTable(vugraph.boards_closed[idx].bidding, vugraph.boards_closed[idx].rozklad.dealer, vugraph.boards_closed[idx].players);


            double szer   = 6.0;
            double tfszer = 4.5;

            Paragraph p_tmp = new Paragraph(); p_tmp.AddLineBreak();

            TextFrame tf1 = new TextFrame();

            tf1.Width  = Unit.FromCentimeter(tfszer);
            tf1.Height = Unit.FromCentimeter(biddingtrening.Rows.Count * 0.6 + 1.0);
            tf1.Add(biddingtrening);
            tf1.Add(p_tmp);
            Paragraph p = WriteContractLine(game.boards[idx]);

            tf1.Add(p);

            TextFrame tf2 = new TextFrame();

            //  tf2.Left = Unit.FromCentimeter(0);
            tf2.Width  = Unit.FromCentimeter(tfszer);
            tf2.Height = Unit.FromCentimeter(biddingOpen.Rows.Count * 0.6 + 1.0);
            tf2.Add(biddingOpen);

            p_tmp = new Paragraph(); p_tmp.AddLineBreak();
            tf2.Add(p_tmp);
            p = WriteContractLine(vugraph.boards[idx]);
            tf2.Add(p);

            TextFrame tf3 = new TextFrame();

            // tf3.Left = Unit.FromCentimeter(0.08);
            tf3.Width = Unit.FromCentimeter(tfszer);
            tf3.Add(biddingClosed);
            tf3.Height = Unit.FromCentimeter(biddingClosed.Rows.Count * 0.6 + 1.0);

            p_tmp = new Paragraph(); p_tmp.AddLineBreak();
            p     = WriteContractLine(vugraph.boards_closed[idx]);
            tf3.Add(p_tmp);
            tf3.Add(p);

            Table biddingTable = new Table();

            biddingTable.AddColumn(Unit.FromCentimeter(szer)); biddingTable.AddColumn(Unit.FromCentimeter(szer)); biddingTable.AddColumn(Unit.FromCentimeter(szer));
            Row row = biddingTable.AddRow();

            //biddingTable.Borders.Width = 1.0;
            //biddingTable.Borders.Color = Colors.Red;

            biddingTable[0, 0].Add(tf1);
            biddingTable[0, 1].Add(tf2);
            biddingTable[0, 2].Add(tf3);

            return(biddingTable);
        }
Exemple #2
0
        public void Prueba()
        {
            Paragraph oParagraph = new Paragraph();

            oParagraph = section.AddParagraph();
            oParagraph.Format.Alignment = ParagraphAlignment.Left;
            oParagraph.AddText("jueputa carepicha...");
            //oParagraph.Document = document;

            Section   sec = document.AddSection();
            TextFrame tf  = sec.AddTextFrame();

            tf.FillFormat.Color   = Colors.Red;
            tf.FillFormat.Visible = true;

            tf.LineFormat.Color   = Colors.Black;
            tf.LineFormat.Width   = Unit.FromMillimeter(1d);
            tf.LineFormat.Visible = true;
            tf.Left = 100;
            tf.Top  = 10;

            tf.Add(oParagraph);

            PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);

            renderer.Document = document;

            renderer.RenderDocument();
        }
Exemple #3
0
        /// <summary>
        /// Tworzy stopkę - na podstawie zmiennej tekststopki. Dodaje także nr strony "Strona X". Formatowanie na sztywno, ale zalezne od szerokosci strony.
        /// </summary>
        /// <returns>Ramka tekstowa z zawartoscią tego co ma być w stopce</returns>
        protected TextFrame SetFooter()
        {
            TextFrame frame             = new TextFrame();
            Table     footer            = new Table();
            double    szerokosc_kolumny = szerokosc_strony / 2;

            frame.Width  = Unit.FromCentimeter(szerokosc_strony);
            frame.Height = Unit.FromCentimeter(0.6);

            for (int i = 0; i < 2; i++)
            {
                footer.AddColumn(Unit.FromCentimeter(szerokosc_kolumny));
            }
            footer.AddRow();
            footer.Borders.Top.Width = 1.0;

            Paragraph p = new Paragraph();

            p.AddFormattedText(stopkaTekst, new Font("Verdana", 10));
            p.Format.Alignment = ParagraphAlignment.Left;
            footer[0, 0].Add(p);

            p = new Paragraph();
            p.AddFormattedText(napis_strona, new Font("Verdana", 10));
            p.AddPageField();
            footer[0, 1].Add(p);
            footer.Format.Alignment = ParagraphAlignment.Right;

            frame.Add(footer);

            return(frame);
        }
Exemple #4
0
        /// <summary>
        /// Gets <see cref="TextFrame`1"/> with order information in it.
        /// </summary>
        /// <param name="orderId">Order identifier.</param>
        /// <param name="orderDate">Order issue date.</param>
        /// <returns><see cref="TextFrame`1"/> with order information.</returns>
        private TextFrame AddOrderInfo(string orderId, string orderDate)
        {
            TextFrame orderInfoFrame = new TextFrame();
            Paragraph invoiceNumPar  = new Paragraph();

            invoiceNumPar.Style = "SectionHeader";
            invoiceNumPar.Format.SpaceBefore = 0;
            invoiceNumPar.AddText("INVOICE NUMBER");
            orderInfoFrame.Add(invoiceNumPar);
            orderInfoFrame.AddParagraph(orderId);
            Paragraph invoiceOrdDate = new Paragraph();

            invoiceOrdDate.Style = "SectionHeader";
            invoiceOrdDate.AddText("DATE OF ISSUE");
            orderInfoFrame.Add(invoiceOrdDate);
            orderInfoFrame.AddParagraph(orderDate);
            return(orderInfoFrame);
        }
Exemple #5
0
        /// <summary>
        /// Adds invoice terms to PDF file.
        /// </summary>
        /// <param name="invoice">A <see cref="MigraDoc`1"/> document.</param>
        /// <param name="dueDate">Order due date.</param>
        private void AddTerms(Document invoice, string dueDate)
        {
            TextFrame termFrame     = new TextFrame();
            Paragraph termParagraph = new Paragraph();

            termParagraph.AddFormattedText("TERMS\n", "SectionHeader");
            termParagraph.AddText("E.g. please pay invoice by " + dueDate);
            termFrame.Add(termParagraph);
            termFrame.Width = 400;
            termFrame.WrapFormat.DistanceTop = 700;
            termFrame.RelativeVertical       = RelativeVertical.Page;
            termFrame.WrapFormat.Style       = WrapStyle.Through;
            invoice.LastSection.Add(termFrame);
        }
Exemple #6
0
        /// <summary>
        /// Renders the element.
        /// </summary>
        /// <param name="pdfStyling">The PDF styling.</param>
        /// <param name="section">The section.</param>
        public void Render(IPdfStyling pdfStyling, Section section)
        {
            Image image = new Image(this._fileName);             // We recommend to scale down image with ImageProcessor or ImageResizer!

            //double width = this._width > pdfStyling.MaxWidthInPoints ? pdfStyling.MaxWidthInPoints : this._width;
            image.Width = this._width;
            //image.Height = Unit.FromCentimeter(heightInCentimeter);
            image.LockAspectRatio = true;

            TextFrame frame = section.AddTextFrame();

            frame.Add(image);
            frame.Height = this._height;
            frame.Width  = this._width;
        }
Exemple #7
0
        TextFrame createClosed(int nr = 1)
        {
            Table mainTable = new Table();

            mainTable.AddColumn(Unit.FromCentimeter(8.0));
            mainTable.AddColumn(Unit.FromCentimeter(9.0));
            mainTable.AddRow();

            TextFrame frame = mainTable[0, 0].AddTextFrame();

            frame.Width  = Unit.FromCentimeter(8.0);
            frame.Height = Unit.FromCentimeter(5.0);
            Paragraph p = frame.AddParagraph();

            p.AddLineBreak();
            p.AddFormattedText("Pokój otwarty - Licytacja", font_tytuly);
            p.AddLineBreak(); p.AddLineBreak();

            string[] nazwiska = new string[4];
            for (int i = 0; i < 4; i++)
            {
                nazwiska[i] = vugraph.nazwiska_[i + 4];
            }
            Table table = CreateBidding(nr, vugraph.licytacja_open, nazwiska);

            frame.MarginLeft = Unit.FromCentimeter(0.5);
            frame.Add(table);

            TextFrame frame2 = mainTable[0, 1].AddTextFrame();

            frame2.Width      = Unit.FromCentimeter(9.0);
            frame2.Height     = Unit.FromCentimeter(5.0);
            frame2.MarginLeft = Unit.FromCentimeter(0.5);
            Paragraph p2 = frame2.AddParagraph();

            p2.AddFormattedText("Komentarz : ", font_tytuly);

            Paragraph p3 = frame2.AddParagraph();

            p3.AddFormattedText(" ", font_normal);

            mainTable.Borders.Width = szerokosc_krawedzi * 1.5;

            document.LastSection.Add(mainTable);
            return(frame);
        }
Exemple #8
0
        TextFrame createOpen(int nr = 1)
        {
            Table mainTable = new Table();

            mainTable.AddColumn(Unit.FromCentimeter(8.0));
            mainTable.AddColumn(Unit.FromCentimeter(9.0));
            mainTable.AddRow();

            TextFrame frame = mainTable[0, 0].AddTextFrame();

            frame.Width  = Unit.FromCentimeter(8.0);
            frame.Height = Unit.FromCentimeter(5.0);
            Paragraph p = frame.AddParagraph();

            p.AddFormattedText("Pokój zamknięty - Licytacja", font_tytuly);
            p.AddLineBreak(); p.AddLineBreak();

            Table table = CreateBidding(nr, vugraph.licytacja_closed, vugraph.nazwiska_);

            frame.MarginLeft = Unit.FromCentimeter(1.0);
            frame.MarginTop  = Unit.FromCentimeter(0.5);
            frame.Add(table);

            TextFrame frame2 = mainTable[0, 1].AddTextFrame();

            frame2.Width     = Unit.FromCentimeter(9.0);
            frame2.Height    = Unit.FromCentimeter(5.0);
            frame2.MarginTop = Unit.FromCentimeter(0.5);
            frame.MarginLeft = Unit.FromCentimeter(0.5);
            Paragraph p2 = frame2.AddParagraph();

            p2.AddFormattedText("Komentarz : ", font_tytuly);
            p2.AddLineBreak();
            Paragraph p3 = frame2.AddParagraph();

            p3.AddFormattedText(" ", font_normal);

            mainTable.Borders.Width = szerokosc_krawedzi * 1.5;

            document.LastSection.Add(mainTable);
            return(frame);
        }
Exemple #9
0
        /// <summary>
        /// Gets <see cref="TextFrame`1"/> with ordered products table in it.
        /// </summary>
        /// <param name="orderProducts">List of ordered products.</param>
        /// <returns><see cref="TextFrame`1"/> with ordered products table.</returns>
        private TextFrame AddProductsTable(List <OrderProduct> orderProducts)
        {
            Table table = new Table();

            table.Format.Font.Size = 10;
            table.TopPadding       = Unit.FromCentimeter(0.2);
            table.Shading.Color    = new Color(243, 243, 243);
            table.Borders.Width    = 0.5;

            table.AddColumn(Unit.FromCentimeter(6));
            table.AddColumn(Unit.FromCentimeter(2.5));
            table.AddColumn(Unit.FromCentimeter(2.5));
            table.AddColumn(Unit.FromCentimeter(2.5));

            Row row = table.AddRow();

            row.Style         = "TableContent";
            row.Shading.Color = Colors.DodgerBlue;
            row.Height        = Unit.FromCentimeter(0.8);
            string[] tableHeaders = new string[] { "DESCRIPTION", "UNIT COST", "QUANTITY", "AMOUNT" };
            for (int i = 0; i < tableHeaders.Length; i++)
            {
                row.Cells[i].AddParagraph(tableHeaders[i]);
            }
            for (int i = 0; i < orderProducts.Count; i++)
            {
                row        = table.AddRow();
                row.Height = Unit.FromCentimeter(0.7);
                row.Cells[0].AddParagraph(orderProducts[i].product.name);
                row.Cells[1].AddParagraph("$" + orderProducts[i].product.unitCost.ToString());
                row.Cells[2].AddParagraph(orderProducts[i].quantity.ToString());
                row.Cells[3].AddParagraph("$" + orderProducts[i].totalAmount.ToString());
            }
            TextFrame tableFrame = new TextFrame();

            tableFrame.Height = Unit.FromCentimeter(0.8) * table.Rows.Count;
            tableFrame.Add(table);
            return(tableFrame);
        }