private void OnBeginPrint(object obj, Gtk.BeginPrintArgs args)
 {
     print.NPages = 1;  // crea cantidad de copias del reporte
     // para imprimir horizontalmente el reporte
     print.PrintSettings.Orientation = PageOrientation.Landscape;
     //Console.WriteLine(print.PrintSettings.Orientation.ToString());
 }
Exemple #2
0
        private void OnBeginPrint(object obj, Gtk.BeginPrintArgs args)
        {
            string contents;
            double height;

            PrintContext context = args.Context;

            height = context.Height;

            linesPerPage = (int)Math.Floor(height / fontSize);
            contents     = System.IO.File.ReadAllText(fileName);

            lines = contents.Split('\n');

            numLines = lines.Length;
            numPages = (numLines - 1) / linesPerPage + 1;

            print.NPages = numPages;
        }
        private void OnBeginPrint(object obj, Gtk.BeginPrintArgs args)
        {
            string contents;
            double height;

            PrintContext context = args.Context;

            height = context.Height;

            linesPerPage = (int)Math.Floor(height / fontSize);
            contents     = LoadFile("DemoPrinting.cs");

            lines = contents.Split('\n');

            numLines = lines.Length;
            numPages = (numLines - 1) / linesPerPage + 1;

            print.NPages = numPages;
        }
Exemple #4
0
        public void BeginPrint(object o, Gtk.BeginPrintArgs args)
        {
            // Print shapes in the PageHeader section
            Console.WriteLine("$$$$$$$$$$$$$$ Page Header");
            this.pageHeader.Draw(args.Context,
                                 this.data,
                                 this.dataTables,
                                 this.svgDocument.PageDetailSection.Y,
                                 false);

            // Print shapes in the PageDetail section
            Console.WriteLine("$$$$$$$$$$$$$$ Page Detail");
            this.pageDetail.Draw(args.Context,
                                 this.data,
                                 this.dataTables,
                                 this.svgDocument.PageFooterSection.Y,
                                 false);

            // Print shapes in the PageFooter section
            Console.WriteLine("$$$$$$$$$$$$$$ Page Footer");
            this.pageFooter.Draw(args.Context,
                                 this.data,
                                 this.dataTables,
                                 this.printOperation.PrintSettings.PaperSize.GetHeight(Unit.Mm),
                                 false);

            Console.WriteLine("PH: " + this.pageHeader.PagesToAdd);
            Console.WriteLine("PD: " + this.pageDetail.PagesToAdd);
            Console.WriteLine("PF: " + this.pageFooter.PagesToAdd);
            int numberOfPagesToAdd = this.pageHeader.PagesToAdd +
                                     this.pageDetail.PagesToAdd + this.pageFooter.PagesToAdd;

            PrintOperation op = o as PrintOperation;

            op.NPages = op.NPages + numberOfPagesToAdd;

            this.pageHeader.ResetDataTablesToDraw();
            this.pageDetail.ResetDataTablesToDraw();
            this.pageFooter.ResetDataTablesToDraw();
        }
 void HandlePrintBeginPrint(object o, BeginPrintArgs args)
 {
     printing.NPages = pages.Count;
 }
        void HandleM_printBeginPrint(object o, BeginPrintArgs args)
        {
            string contents;
            double height;

            // Get the Context of the Print Operation
            PrintContext context = args.Context;

            // Get the Height of the Context
            height = context.Height;

            StringBuilder builder = new StringBuilder();

            // From the FontSize and the Height of the Page determine the Lines available per page
            m_linesPerPage = (int)Math.Floor(height / (m_fontSize + 0.5)) - 4;
            int charsPerLine = 80;
               	contents = Utilities.HTMLtoText(m_cache.LongDesc);
            contents = GLib.Markup.EscapeText (contents);
            builder.Append("<b>");
            builder.Append(Utilities.getCoordString(m_cache.Lat, m_cache.Lon));
            builder.Append("</b>\n");
            builder.Append(Geocache.GetCTypeString(m_cache.TypeOfCache));
            builder.Append("\n");
            builder.Append(Catalog.GetString("<b>A cache by:</b>"));
            builder.Append(" ");
            builder.Append(m_cache.PlacedBy);
            builder.Append("\t");
            builder.Append(Catalog.GetString("<b>Hidden on:</b>"));
            builder.Append(" ");
            builder.Append(m_cache.Time.ToShortDateString());
            builder.Append("\n");
            builder.Append(Catalog.GetString("<b>Cache Size:</b>"));
            builder.Append(" ");
            builder.Append(m_cache.Container);
            builder.Append("\t");
            builder.Append(Catalog.GetString("<b>Difficulty:</b>"));
            builder.Append(" ");
            builder.Append(m_cache.Difficulty.ToString("0.0"));
            builder.Append("\t");
            builder.Append(Catalog.GetString("<b>Terrain:</b>"));
            builder.Append(" ");
            builder.Append(m_cache.Difficulty.ToString("0.0"));
            builder.Append("\n\n");
            if (!String.IsNullOrEmpty(m_cache.ShortDesc))
            {
                builder.Append(Catalog.GetString("<b>Short Description:</b>"));
                builder.Append("\n\n");
                WordWrapText(HTMLtoPango(m_cache.ShortDesc), builder, charsPerLine);
                builder.Append("\n\n");
            }
            builder.Append(Catalog.GetString("<b>Long Description:</b>"));
            builder.Append("\n\n");
            WordWrapText (HTMLtoPango(m_cache.LongDesc), builder, charsPerLine);
            builder.Append("\n\n");
            if (!String.IsNullOrEmpty(m_cache.Notes))
            {
                builder.Append(Catalog.GetString("<b>Notes:</b>"));
                builder.Append("\n\n");
                builder.Append(GLib.Markup.EscapeText(m_cache.Notes));
                builder.Append("\n\n");
            }
            if (!String.IsNullOrEmpty(m_cache.Hint))
            {
                builder.Append(Catalog.GetString("<b>Hint:</b>"));
                builder.Append("\n\n");
                string hint = Utilities.HTMLtoText(m_cache.Hint);
                hint = GLib.Markup.EscapeText(hint);
                WordWrapText(hint, builder, charsPerLine);
            }
            contents = builder.ToString();
            // Split the Content into seperate lines
            m_Lines = contents.Split('\n');

            // Get the Number of lines
            m_numLines = m_Lines.Length;

            // Calculate the Number of Pages by how many lines there are and how many lines are available per page
            m_numPages = (m_numLines - 1) / m_linesPerPage + 1;

            // Tell the Print Operation how many pages there are
            m_print.NPages = m_numPages;
        }
Exemple #7
0
		void HandleBeginPrint (object o, BeginPrintArgs args)
		{
			PrintOperation op = (PrintOperation)o;
			op.NPages = 1;
		}
 void HandlePrintBeginPrint(object o, BeginPrintArgs args)
 {
     printing.NPages = 1;
 }
 void OnBeginPrint(object obj, Gtk.BeginPrintArgs args)
 {
     print.NPages = 1;             // crea cantidad de copias del reporte
 }