Ejemplo n.º 1
0
        private TextFrame Siegarten()
        {
            var result = new TextFrame();

            result.Width = $"{_breite_Siegart}cm";

            var paragraph = result.AddParagraph();

            paragraph.Format.Font.Size = CustomStyles.fontSizeNormal;


            paragraph.AddFormattedText("\u00A8", new Font("Wingdings"));
            paragraph.AddFormattedText("SS  ");

            paragraph.AddFormattedText("\u00A8", new Font("Wingdings"));
            paragraph.AddFormattedText("TÜ  ");

            paragraph.AddFormattedText("\u00A8", new Font("Wingdings"));
            paragraph.AddFormattedText("AS");

            paragraph.AddLineBreak();
            paragraph.AddLineBreak();

            paragraph.AddFormattedText("\u00A8", new Font("Wingdings"));
            paragraph.AddFormattedText("PS  ");

            paragraph.AddFormattedText("\u00A8", new Font("Wingdings"));
            paragraph.AddFormattedText("DS  ");

            paragraph.AddFormattedText("\u00A8", new Font("Wingdings"));
            paragraph.AddFormattedText("___");

            return(result);
        }
Ejemplo n.º 2
0
        private void PaymentSection()
        {
            Section section = Pdf.LastSection;

            Table table = section.AddTable();

            table.AddColumn(Unit.FromPoint(section.Document.PageWidth()));
            Row row = table.AddRow();

            if (Invoice.Details != null && Invoice.Details.Count > 0)
            {
                foreach (DetailRow detail in Invoice.Details)
                {
                    row.Cells[0].AddParagraph(detail.Title, ParagraphAlignment.Left, "H2-9B-Color");
                    row.Cells[0].Borders.Bottom = BorderLine;

                    row = table.AddRow();
                    TextFrame frame = null;
                    foreach (string line in detail.Paragraphs)
                    {
                        if (line == detail.Paragraphs[0])
                        {
                            frame       = row.Cells[0].AddTextFrame();
                            frame.Width = section.Document.PageWidth();
                        }
                        frame.AddParagraph(line, ParagraphAlignment.Left, "H2-9");
                    }
                }
            }

            if (Invoice.Company.HasCompanyNumber || Invoice.Company.HasVatNumber)
            {
                row = table.AddRow();

                Color shading = MigraDocHelpers.TextColorFromHtml(Invoice.TextColor);

                if (Invoice.Company.HasCompanyNumber && Invoice.Company.HasVatNumber)
                {
                    row.Cells[0].AddParagraph(string.Format("Company Number: {0}, VAT Number: {1}",
                                                            Invoice.Company.CompanyNumber, Invoice.Company.VatNumber),
                                              ParagraphAlignment.Center, "H2-9B-Inverse")
                    .Format.Shading.Color = shading;
                }
                else
                {
                    if (Invoice.Company.HasCompanyNumber)
                    {
                        row.Cells[0].AddParagraph(string.Format("Company Number: {0}", Invoice.Company.CompanyNumber),
                                                  ParagraphAlignment.Center, "H2-9B-Inverse")
                        .Format.Shading.Color = shading;
                    }
                    else
                    {
                        row.Cells[0].AddParagraph(string.Format("VAT Number: {0}", Invoice.Company.VatNumber),
                                                  ParagraphAlignment.Center, "H2-9B-Inverse")
                        .Format.Shading.Color = shading;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            //Create a presentation
            Presentation pres = new Presentation();

            //Access first slide
            Slide sld = pres.GetSlideByPosition(1);

            //Add a table
            Aspose.Slides.Table tbl = sld.Shapes.AddTable(50, 50, pres.SlideSize.Width - 100, pres.SlideSize.Height - 100, 15, 15);

            //Loop through rows
            for (int i = 0; i < tbl.RowsNumber; i++)
            {
                //Loop through cells
                for (int j = 0; j < tbl.ColumnsNumber; j++)
                {
                    //Get text frame of each cell
                    TextFrame tf = tbl.GetCell(j, i).TextFrame;
                    //Add some text
                    tf.Text = "T" + i.ToString() + j.ToString();
                    //Set font size of 10
                    tf.Paragraphs[0].Portions[0].FontHeight = 10;
                    tf.Paragraphs[0].HasBullet = false;
                }
            }

            //Write the presentation to the disk
            pres.Write("tblSLD.ppt");
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Renders the specified PDF styling.
        /// </summary>
        /// <param name="pdfStyling">The PDF styling.</param>
        /// <param name="section">The section.</param>
        public void Render(IPdfStyling pdfStyling, Section section)
        {
            TextFrame frame = section.AddTextFrame();

            frame.Top    = new Unit(_top);
            frame.Left   = new Unit(_left);
            frame.Width  = pdfStyling.MaxWidthInPoints;
            frame.Height = new Unit(_height);
            //frame.RelativeVertical = RelativeVertical.Margin;
            frame.RelativeVertical = _relativeVertical;

            Paragraph paragraph = frame.AddParagraph();

            if (string.IsNullOrWhiteSpace(_title) == false)
            {
                paragraph.AddFormattedText(_title.Trim(), TextFormat.Bold);
                paragraph.AddLineBreak();
            }

            int      count = _addressLines.Count();
            TextLine line;

            for (int i = 0; i < _addressLines.Count(); i++)
            {
                line = _addressLines.ElementAt(i);

                paragraph.AddLineBreak();
                paragraph.AddFormattedText(
                    text: line.Text,
                    textFormat: line.IsBold ? TextFormat.Bold : TextFormat.NotBold);
            }
        }
Ejemplo n.º 5
0
        public static void PrintTenshiRank(ref Document doc, vwCertificate certificate)
        {
            NumberToEnglish num          = new NumberToEnglish();
            Page            pg           = doc.Pages[1];
            TextFrame       studentFrame = pg.Shapes[2].TextFrame;
            TextFrame       stDateFrame  = pg.Shapes[3].TextFrame;
            TextFrame       rankFrame    = pg.Shapes[4].TextFrame;
            TextFrame       authFrame    = pg.Shapes[5].TextFrame;

            studentFrame.TextRange.Text = certificate.FullName;
            studentFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitGrowToFit;
            studentFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow;

            stDateFrame.TextRange.Text = String.Format("{0:MMMM} {1}{2}", Convert.ToDateTime(certificate.FromDate), num.changeNumericToWords(Convert.ToDateTime(certificate.FromDate).Day), Convert.ToDateTime(certificate.FromDate).Year);
            stDateFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitGrowToFit;
            stDateFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow;

            rankFrame.TextRange.Text = certificate.RankText;
            rankFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitGrowToFit;
            rankFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow;

            authFrame.TextRange.Text = $"{AuthenticityString}{certificate.ID}";

            doc.PrintOutEx();
        }
Ejemplo n.º 6
0
        public static void PrintRank(ref Document doc, vwCertificate certificate)
        {
            Page pg = doc.Pages[1];

            TextFrame studentFrame = pg.Shapes[2].TextFrame;
            TextFrame schoolFrame  = pg.Shapes[4].TextFrame;
            TextFrame stDateFrame  = pg.Shapes[5].TextFrame;
            TextFrame rankFrame    = pg.Shapes[3].TextFrame;
            TextFrame authFrame    = pg.Shapes[6].TextFrame;


            studentFrame.TextRange.Text = certificate.FullName;
            studentFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitGrowToFit;
            studentFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow;

            schoolFrame.TextRange.Text = certificate.Dojo;
            schoolFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitGrowToFit;
            schoolFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow;

            stDateFrame.TextRange.Text = Convert.ToDateTime(certificate.FromDate).ToString(DateFormat);
            stDateFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitGrowToFit;
            stDateFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow;

            rankFrame.TextRange.Text = certificate.RankText;
            rankFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitGrowToFit;
            rankFrame.AutoFitText    = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow;

            authFrame.TextRange.Text = $"{AuthenticityString}{certificate.ID}";

            doc.PrintOutEx();
        }
Ejemplo n.º 7
0
        private void Footer(IPdfStyling pdfStyling, Section section)
        {
            TextFrame footer = section.AddTextFrame();

            footer.RelativeVertical = RelativeVertical.Margin;

            footer.Height = Unit.FromCentimeter(3.5);
            footer.Width  = pdfStyling.MaxWidthInPoints;
            footer.Top    = pdfStyling.MaxHeightInPoints - Unit.FromCentimeter(1);

            Paragraph p = footer.AddParagraph();

            p.AddText("Alle Rezepte auf");
            p.Format.SpaceBefore = 0;
            p.Format.SpaceAfter  = 0;
            p.Format.Font.Color  = pdfStyling.ParagraphSmallColor;
            p.Format.Alignment   = ParagraphAlignment.Center;

            Paragraph website = footer.AddParagraph();

            website.AddText("www.rimuss.ch");
            website.Format.SpaceBefore = 0;
            website.Format.SpaceAfter  = 0;
            website.Format.Font.Color  = Color.FromCmyk(38, 46, 82, 36);
            website.Format.Alignment   = ParagraphAlignment.Center;
        }
Ejemplo n.º 8
0
        private void AddNotes()
        {
            //Written total
            TextFrame textFrame = section.AddTextFrame();

            textFrame.Width            = "17cm";
            textFrame.Left             = ShapePosition.Left;
            textFrame.WrapFormat.Style = WrapStyle.None;
            textFrame.AddParagraph();
            section.AddParagraph();
            Paragraph paragraph = section.AddParagraph();

            paragraph.Format.Font.Size = "10pt";
            paragraph.Format.Font.Name = "Arial";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Alignment = ParagraphAlignment.Left;
            paragraph.AddText(documentContent.totalWritten);
            section.AddParagraph();
            paragraph = section.AddParagraph();
            paragraph.Format.Font.Size = "10pt";
            paragraph.Format.Font.Name = "Arial";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Alignment = ParagraphAlignment.Left;
            paragraph.AddText(documentContent.taxNote);
            paragraph = section.AddParagraph();
            paragraph.Format.Font.Size = "10pt";
            paragraph.Format.Font.Name = "Arial";
            paragraph.Format.Alignment = ParagraphAlignment.Left;
            paragraph.AddText(documentContent.notes);
        }
Ejemplo n.º 9
0
        private void CreateHeader()
        {
            // Create the text frame for the address
            headerFrame                    = section.AddTextFrame();
            headerFrame.Height             = "1.0cm";
            headerFrame.Width              = "7.0cm";
            headerFrame.Left               = ShapePosition.Left;
            headerFrame.RelativeHorizontal = RelativeHorizontal.Margin;
            headerFrame.Top                = "1.0cm";
            headerFrame.RelativeVertical   = RelativeVertical.Page;

            // Put sender in address frame
            Paragraph paragraph = headerFrame.AddParagraph(Definition.Title.Text);

            paragraph.Style             = "Reference";
            paragraph.Format.Font.Name  = "Times New Roman";
            paragraph.Format.Font.Size  = 7;
            paragraph.Format.SpaceAfter = 3;

            // Add the print date field
            paragraph = section.AddParagraph();
            paragraph.Format.SpaceBefore = "1cm";
            paragraph.Style = "Reference";
            paragraph.AddFormattedText(Definition.SubTitle.Text, TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddText("Beep Reports, ");
            paragraph.AddDateField("dd.MM.yyyy");
        }
Ejemplo n.º 10
0
        public static void verticalBarCode()
        {
            string   reportFilename = "verticalBarCode.pdf";
            Document document       = new Document();

            Console.WriteLine(document.DefaultPageSetup.LeftMargin);
            Section section = document.AddSection();

            section.PageSetup.TopMargin  = Unit.FromPoint(30);
            section.PageSetup.LeftMargin = Unit.FromPoint(20);

            TextFrame leftTF = section.AddTextFrame();

            leftTF.Orientation      = TextOrientation.Downward;
            leftTF.WrapFormat.Style = WrapStyle.None;
            // leftTF.MarginLeft = Unit.FromInch(1);
            //leftTF.MarginRight = Unit.FromInch(1);

            //make sure the font is embedded
            var  options = new XPdfFontOptions(PdfFontEncoding.Unicode);
            Font fontEan = new Font("mrvcode39s", 20);

            leftTF.AddParagraph().AddFormattedText("*12343*", fontEan);
            // Now generate a pdf
            PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);

            // Set the MigraDoc document
            pdfRenderer.Document = document;

            // Create the PDF document
            pdfRenderer.RenderDocument();

            // Save the PDF document...
            pdfRenderer.Save(reportFilename);
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
0
        void PageSender()
        {
            addressframe                    = section.AddTextFrame();
            addressframe.Height             = "3.0cm";
            addressframe.Width              = "7.0cm";
            addressframe.Top                = "5.0cm";
            addressframe.Left               = ShapePosition.Left;
            addressframe.RelativeHorizontal = RelativeHorizontal.Margin;
            addressframe.RelativeVertical   = RelativeVertical.Page;

            paragraph = section.AddParagraph();
            paragraph.Format.SpaceBefore = "3.0cm";
            paragraph.Style = "Reference";
            paragraph.AddFormattedText("Date:", TextFormat.Bold);
            paragraph.AddText(DateTime.Now.ToString(" MMM dd, yyyy"));
            paragraph.Format.Alignment = ParagraphAlignment.Right;

            paragraph = section.AddParagraph();
            paragraph.AddFormattedText("Prepared by:", TextFormat.Bold);
            paragraph.Format.SpaceAfter = "0.2cm";
            paragraph = section.AddParagraph();
            paragraph.AddFormattedText(clsUsers.getLoginDetails(HRMSCore.Username));
            paragraph = section.AddParagraph();
            paragraph.AddFormattedText("Philippines First Insurance Co., Inc.", TextFormat.Bold);
            paragraph = section.AddParagraph();
            paragraph.AddFormattedText("7F STI Holdings Center");
            paragraph = section.AddParagraph();
            paragraph.AddFormattedText("6764 Ayala Avenue, 1226 Makati City, Philippines");
            paragraph = section.AddParagraph();
            paragraph.AddFormattedText("HR OFFICE", TextFormat.Bold);
            paragraph.Format.SpaceAfter = "0.5cm";
        }
Ejemplo n.º 13
0
        private Table SetTableStyle(ref Section section, Color tableColor)
        {
            TextFrame frame = section.AddTextFrame();

            frame.MarginTop = new Unit(6, UnitType.Centimeter);
            frame.Width     = new Unit(16, UnitType.Centimeter);

            //TABLE LABEL
            Paragraph p = frame.AddParagraph();

            p.AddFormattedText("Purchased goods:", TextFormat.Bold);

            frame.AddParagraph("").AddLineBreak();

            //TABLE
            Table table = frame.AddTable();

            table.Style               = "Table";
            table.Borders.Color       = tableColor;
            table.Borders.Width       = 0.25;
            table.Borders.Left.Width  = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent     = 0;
            return(table);
        }
Ejemplo n.º 14
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();
        }
Ejemplo n.º 15
0
        public void Print()
        {
            foreach (var frame in TextFrames)
            {
                TextFrame     value1 = null;
                ListTextFrame value2;
                if (frame is TextFrame)
                {
                    value1 = frame as TextFrame;
                }
                else if (frame is ListTextFrame)
                {
                    value2 = frame as ListTextFrame;
                }
                else
                {
                    throw new NotImplementedException();
                }

                if (_output != null)
                {
                    _output.WriteLine($"{value1?.ToString()}: {value1?.Value}", Severity.Info);
                }
            }
        }
Ejemplo n.º 16
0
        public GuideFrame CreateTextFrame(Mode mode, FrameType type)
        {
            Bounds newBounds = contentBounds.Clone();

            newBounds.top    = GetNextTop();
            newBounds.height = 10;


            TextFrame textFrame = page.TextFrames.Add(miss, idLocationOptions.idAtEnd, miss);

            textFrame.GeometricBounds = newBounds.raw;
            textFrame.TextFramePreferences.FirstBaselineOffset = idFirstBaseline.idLeadingOffset;

            if (mode == Mode.TwoColumns)
            {
                textFrame.TextFramePreferences.TextColumnCount = 2;
            }

            //$.global.textFrames.push( myTextFrame );

            GuideFrame frame = new GuideFrame(textFrame, this.guide, this, mode, type);

            frame.bounds = newBounds;

            //currentFrame = frame;
            frames.Add(frame);

            //currentMode = mode;

            return(frame);
        }
Ejemplo n.º 17
0
        ///<summary></summary>
        public static void DrawString(TextFrame frameContainer, string text, MigraDoc.DocumentObjectModel.Font font, float xPos, float yPos)
        {
            TextFrame frame = new TextFrame();
            Paragraph par   = frame.AddParagraph();

            par.Format.Font = font.Clone();
            par.AddText(text);
            frame.RelativeVertical   = RelativeVertical.Page;
            frame.RelativeHorizontal = RelativeHorizontal.Page;
            frame.MarginLeft         = Unit.FromInch(xPos / 100);
            frame.MarginTop          = Unit.FromInch(yPos / 100);
            frame.Top   = TopPosition.Parse("0 in");
            frame.Left  = LeftPosition.Parse("0 in");
            frame.Width = frameContainer.Width;
            FontStyle fontstyle = FontStyle.Regular;

            if (font.Bold)
            {
                fontstyle = FontStyle.Bold;
            }
            System.Drawing.Font fontSystem = new System.Drawing.Font(font.Name, (float)font.Size.Point, fontstyle);
            float fontH  = fontSystem.Height;
            Unit  bottom = Unit.FromInch((yPos + fontH) / 100);

            if (frameContainer.Height < bottom)
            {
                frameContainer.Height = bottom;
            }
            frame.Height = frameContainer.Height;
            //LineFormat lineformat=new LineFormat();
            //lineformat.Width=1;
            //frame.LineFormat=lineformat;
            frameContainer.Elements.Add(frame);
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
        ///<summary></summary>
        public static void DrawString(TextFrame frameContainer, string text, MigraDoc.DocumentObjectModel.Font font, RectangleF rectF,
                                      ParagraphAlignment alignment)
        {
            TextFrame frame = new TextFrame();
            Paragraph par   = frame.AddParagraph();

            par.Format.Font      = font.Clone();
            par.Format.Alignment = alignment;
            par.AddText(text);
            frame.RelativeVertical   = RelativeVertical.Page;
            frame.RelativeHorizontal = RelativeHorizontal.Page;
            frame.MarginLeft         = Unit.FromInch(rectF.Left / 100);
            frame.MarginTop          = Unit.FromInch(rectF.Top / 100);
            frame.Top   = TopPosition.Parse("0 in");
            frame.Left  = LeftPosition.Parse("0 in");
            frame.Width = Unit.FromInch(rectF.Right / 100f);        //    frameContainer.Width;
            Unit bottom = Unit.FromInch(rectF.Bottom / 100f);

            if (frameContainer.Height < bottom)
            {
                frameContainer.Height = bottom;
            }
            frame.Height = frameContainer.Height;
            //LineFormat lineformat=new LineFormat();
            //lineformat.Width=1;
            //frame.LineFormat=lineformat;
            frameContainer.Elements.Add(frame);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Adds a new text frame to the collection.
        /// </summary>
        public TextFrame AddTextFrame()
        {
            TextFrame textFrame = new TextFrame();

            Add(textFrame);
            return(textFrame);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Places <see cref="TextFrame`1"/> with order information and <see cref="TextFrame`1"/> with products table on the same line
        /// by placing them inside table with two rows. Also places string with total order amount after the table.
        /// </summary>
        /// <param name="invoice">A <see cref="MigraDoc`1"/> document.</param>
        /// <param name="orderInfoFrame">A <see cref="TextFrame`1"/> with order information.</param>
        /// <param name="tableFrame">A <see cref="TextFrame`1"/> with products table.</param>
        /// <param name="totalAmount">Total order amount.</param>
        private void PlaceOrderInfoAndProductsTableOnSameLine(Document invoice, TextFrame orderInfoFrame,
                                                              TextFrame tableFrame, string totalAmount)
        {
            Table table = new Table();

            table.AddColumn(Unit.FromCentimeter(4));
            table.AddColumn(Unit.FromCentimeter(20));
            Row row = table.AddRow();

            row[0].Add(orderInfoFrame);
            row[1].Add(tableFrame);
            invoice.LastSection.Add(table);

            Paragraph invoiceTotalPar = new Paragraph();

            invoiceTotalPar.Format.Alignment = ParagraphAlignment.Right;
            invoiceTotalPar.Style            = "SectionHeader";
            invoiceTotalPar.AddText("INVOICE TOTAL");
            invoice.LastSection.Add(invoiceTotalPar);
            Paragraph totalNumPar = new Paragraph();

            totalNumPar.Format.Alignment = ParagraphAlignment.Right;
            totalNumPar.Format.Font.Size = 18;
            totalNumPar.AddText("$" + totalAmount);
            invoice.LastSection.Add(totalNumPar);
        }
Ejemplo n.º 22
0
        ///<summary></summary>
        public static void DrawBitmap(TextFrame frameContainer, System.Drawing.Bitmap bitmap, float xPos, float yPos)
        {
            string imageFileName = PrefC.GetRandomTempFile(".tmp");

            bitmap.SetResolution(100, 100);           //prevents framework from scaling it.
            bitmap.Save(imageFileName);
            TextFrame frame = new TextFrame();

            frame.AddImage(imageFileName);
            frame.RelativeVertical   = RelativeVertical.Page;
            frame.RelativeHorizontal = RelativeHorizontal.Page;
            frame.MarginLeft         = Unit.FromInch(xPos / 100);
            frame.MarginTop          = Unit.FromInch(yPos / 100);
            frame.Top   = TopPosition.Parse("0 in");
            frame.Left  = LeftPosition.Parse("0 in");
            frame.Width = frameContainer.Width;
            Unit bottom = Unit.FromInch((yPos + (double)bitmap.Height) / 100);

            if (frameContainer.Height < bottom)
            {
                frameContainer.Height = bottom;
            }
            frame.Height = frameContainer.Height;
            //LineFormat lineformat=new LineFormat();
            //lineformat.Width=1;
            //frame.LineFormat=lineformat;
            frameContainer.Elements.Add(frame);
        }
Ejemplo n.º 23
0
        public static void DrawRectangle(TextFrame frameContainer, System.Drawing.Color color, float xPos, float yPos, float width, float height)
        {
            MigraDoc.DocumentObjectModel.Color colorx = ConvertColor(color);
            TextFrame frameRect = new TextFrame();

            frameRect.LineFormat.Color = colorx;
            frameRect.Height           = Unit.FromInch(height / 100);
            frameRect.Width            = Unit.FromInch(width / 100);
            TextFrame frame = new TextFrame();

            frame.Elements.Add(frameRect);
            frame.RelativeVertical   = RelativeVertical.Page;
            frame.RelativeHorizontal = RelativeHorizontal.Page;
            frame.MarginLeft         = Unit.FromInch(xPos / 100);
            frame.MarginTop          = Unit.FromInch(yPos / 100);
            frame.Top   = TopPosition.Parse("0 in");
            frame.Left  = LeftPosition.Parse("0 in");
            frame.Width = frameContainer.Width;
            Unit bottom = Unit.FromInch((yPos + height) / 100);

            if (frameContainer.Height < bottom)
            {
                frameContainer.Height = bottom;
            }
            frame.Height = frameContainer.Height;
            frameContainer.Elements.Add(frame);
        }
        public static string GetVerticalAlignmentStyle(TextFrame textFrame, AutoShape parentShape)
        {
            // workaround with padding for div/p case

            string paddingTop = "";
            var    textFrameFormatEffective = textFrame.TextFrameFormat.GetEffective();

            float paraHeights = 0;

            foreach (var para in textFrame.Paragraphs)
            {
                paraHeights += para.GetRect().Height;
            }

            switch (textFrame.TextFrameFormat.GetEffective().AnchoringType)
            {
            case TextAnchorType.Bottom:
                paddingTop = string.Format("padding-top: {0}px;", parentShape.Height - paraHeights - textFrameFormatEffective.MarginTop - textFrameFormatEffective.MarginBottom);
                break;

            case TextAnchorType.Center:
                paddingTop = string.Format("padding-top: {0}px;", (parentShape.Height - paraHeights - textFrameFormatEffective.MarginTop - textFrameFormatEffective.MarginBottom) / 2);
                break;
            }

            return(paddingTop);
        }
Ejemplo n.º 25
0
        public void AddMetaData(MetaData metaData)
        {
            foreach (var textFrame in CreateTextFramesFromMetaData(metaData))
            {
                //TODO: needs testing

                //we are only allowing fields to be updated if what they are being updated with is not empty
                if (!string.IsNullOrEmpty(textFrame.Content))
                {
                    TextFrame tempTextFrame = textFrame;

                    TextFrame existingFrame = (from frame in _container.OfType <TextFrame>()
                                               where frame.Descriptor.Id == tempTextFrame.Descriptor.Id
                                               select frame).FirstOrDefault();


                    if (existingFrame != null)
                    {
                        _container.Remove(existingFrame);
                    }

                    _container.Add(textFrame);
                }
            }
        }
        public static void AddFrame(this EditID3File file, string id, string text)
        {
            TextFrame frame = FrameFactory.GetFrame(id) as TextFrame;

            frame.Text = text;

            file.V2Tag.Add(frame);
        }
Ejemplo n.º 27
0
        internal void AddTextBox(Point center)
        {
            var textFrame = new TextFrame(new Layers.Components.Point(center.X, center.Y), "Votre texte ici...");

            layerModel.Components.Add(textFrame);
            RaisePropertyChanged("DraggableComponents");
            RaisePropertyChanged("AddDraggableComponent"); // To update the view through LayerContainer.xaml.cs
        }
Ejemplo n.º 28
0
        //TODO: Remove 2nd paprameter and auto detect encoding
        private void UpdateFrame(TextFrame fixme, Encoding srcEncoding)
        {
            var oldValue = fixme.Value;
            var newValue = LangUtil.FixEncoding(oldValue, srcEncoding);

            fixme.Value        = newValue;
            fixme.EncodingType = _encoding;
        }
Ejemplo n.º 29
0
        internal TextFrameRenderer(XGraphics gfx, TextFrame textframe, FieldInfos fieldInfos)
            : base(gfx, textframe, fieldInfos)
        {
            _textframe = textframe;
            TextFrameRenderInfo renderInfo = new TextFrameRenderInfo();

            renderInfo.DocumentObject = _shape;
            _renderInfo = renderInfo;
        }
Ejemplo n.º 30
0
        internal TextFrameRenderer(XGraphics gfx, TextFrame textframe, FieldInfos fieldInfos)
            : base(gfx, textframe, fieldInfos)
        {
            this.textframe = textframe;
            TextFrameRenderInfo renderInfo = new TextFrameRenderInfo();

            renderInfo.shape = this.shape;
            this.renderInfo  = renderInfo;
        }
Ejemplo n.º 31
0
 public TextFrameWriter(TextFrame frameToWrite, string frameID, FrameHeaderWriter headerWriter, EncodingScheme encoding)
     : base(frameToWrite, headerWriter,frameID, encoding)
 {
 }