Example #1
0
        public void ApplyMaster(string name)
        {
            MasterSpread master = guide.GetMaster(name);

            if (master != null)
            {
                page.AppliedMaster = guide.GetMaster(name);
            }
        }
Example #2
0
        void SetupSidebar()
        {
            if (sideBarMax > 0)
            {
                double maxWidth  = 40;
                double height    = GetPage(0).contentBounds.height;
                double topMargin = GetPage(0).contentBounds.top;
                double top;

                if (sideBarCount > sideBarMax)
                {
                    Log("!! sideBarCount is bigger than sideBarMax");
                }

                double spacing = (height - maxWidth) / (sideBarMax - 1);
                if (spacing > maxWidth)
                {
                    spacing = maxWidth;
                }

                top = topMargin + spacing * (sideBarCount - 1);


                MasterSpread master = GetMaster("A-Master");

                TextFrames tfs = master.TextFrames;
                foreach (TextFrame tf in tfs)
                {
                    Bounds b = new Bounds(tf.GeometricBounds);

                    if (tf.Paragraphs.Count > 0)
                    {
                        Paragraph p = (Paragraph)tf.Paragraphs[1];

                        if (((ParagraphStyle)p.AppliedParagraphStyle).Name == "SideBar")
                        {
                            //double h = b.height;
                            b.top              = top;
                            b.height           = maxWidth;
                            tf.GeometricBounds = b.raw;
                        }
                    }
                }
            }
        }
Example #3
0
        void ProcessHeader(XmlElement node)
        {
            string intro           = GetAttr(node, "intro");
            string name            = GetAttr(node, "name");
            string sun             = GetAttr(node, "sun");
            string rock            = GetAttr(node, "rock");
            string walk            = GetAttr(node, "walk");
            string history         = GetAttr(node, "history");
            string access          = GetAttr(node, "access");
            string acknowledgement = GetAttr(node, "acknowledgement");

            GuideFrame frame = GetTextFrame(Mode.SingleColumn, FrameType.Multi, true);


            frame.AddPara(name, "heading1", true);
            frame.bounds.top -= 4;
            frame.ApplyBounds();
            frame.ResizeAndPaginate();
            frame.bottomOffset += 2;

            double bottomExtra = 0;
            double iconTop     = currentPage.GetNextTop();

            bool done = false;

            string graphPath = GetAttachmentPath("graph.pdf");

            if (File.Exists(graphPath) && this.xml.SelectNodes("//climb").Count > 0)
            {
                Bounds graphBounds = new Bounds();
                graphBounds.top    = iconTop;
                graphBounds.height = GRAPHSIZE;
                graphBounds.left   = currentPage.contentBounds.left;
                graphBounds.width  = GRAPHSIZE;
                //PlaceImageInRect( graphPath, graphBounds, true, idPDFCrop.idCropContent);
                PlaceImageInRect(graphPath, graphBounds, true, idPDFCrop.idCropContentAllLayers);

                bottomExtra = graphBounds.bottom + 3;

                done = true;
            }
            if (walk.Length > 0 || sun.Length > 0 || rock.Length > 0)
            {
                done    = true;
                iconTop = DoHeaderIcon(iconTop, "walk2.pdf", walk);
                iconTop = DoHeaderIcon(iconTop, "sun2.pdf", sun);
                iconTop = DoHeaderIcon(iconTop, "rock2.pdf", rock);

                iconTop += 4;
            }

            if (done)
            {
                bottomExtra            = Math.Max(iconTop, bottomExtra);
                currentPage.nextTopMin = bottomExtra;

                MasterSpread master = GetMaster("FP-Master");

                // assume every rect needs moving
                Rectangles rects = master.Rectangles;
                foreach (Rectangle rect in rects)
                {
                    Bounds b = new Bounds(rect.GeometricBounds);
                    b.bottom             = bottomExtra - 2;
                    rect.GeometricBounds = b.raw;
                }
            }
            else
            {
                frame.bottomOffset += 2;
            }

            //DoIndentedText(walk, "Walk");
            //DoIndentedText(sun, "Sun");
            //DoIndentedText(rock, "Rock");



            DoIndentedText(acknowledgement, "Author");
            DoIndentedText(intro, "Intro");
            DoIndentedText(history, "History");
            DoIndentedText(access, "Access");

            currentPage.frames[currentPage.frames.Count - 1].bottomOffset += 1;
            //currentPage.currentY += 3;
        }