Exemple #1
0
 /// <summary>
 /// Add Pattern Resources to the pdf page
 /// </summary>
 internal void AddResource(PdfPattern patterns, int contentRef)
 {
     foreach (PdfPatternEntry pat in patterns.Patterns.Values)
     {
         patternRef += string.Format("/{0} {1} 0 R", pat.pattern, pat.objectNum);
     }
     if (contentRef > 0)
     {
         contents = string.Format("/Contents {0} 0 R", contentRef);
     }
 }
Exemple #2
0
        public void Start()
        {
            // Create the anchor for all pdf objects
            CompressionConfig cc = RdlEngineConfig.GetCompression();

            anchor = new PdfAnchor(cc != null);

            //Create a PdfCatalog
            string lang;

            if (r.ReportDefinition.Language != null)
            {
                lang = r.ReportDefinition.Language.EvaluateString(this.r, null);
            }
            else
            {
                lang = null;
            }
            catalog = new PdfCatalog(anchor, lang);

            //Create a Page Tree Dictionary
            pageTree = new PdfPageTree(anchor);

            //Create a Font Dictionary
            fonts = new PdfFonts(anchor);

            //Create a Pattern Dictionary
            patterns = new PdfPattern(anchor);

            //Create an Image Dictionary
            images = new PdfImages(anchor);

            //Create an Outline Dictionary
            outline = new PdfOutline(anchor);

            //Create the info Dictionary
            info = new PdfInfo(anchor);

            //Set the info Dictionary.
            info.SetInfo(r.Name, r.Author, r.Description, "");          // title, author, subject, company

            //Create a utility object
            pdfUtility = new PdfUtility(anchor);

            //write out the header
            int size = 0;

            tw.Write(pdfUtility.GetHeader("1.5", out size), 0, size);
            filesize = size;
        }
Exemple #3
0
/// <summary>
/// Page Polygon
/// </summary>
/// <param name="pts"></param>
/// <param name="si"></param>
/// <param name="url"></param>
/// <param name="patterns"></param>
        internal void AddPolygon(PointF[] pts, StyleInfo si, string url, PdfPattern patterns)
        {
            if (si.BackgroundColor.IsEmpty)
            {
                return;         // nothing to do
            }
            // Get the fill color - could be a gradient or pattern etc...
            Color  c     = si.BackgroundColor;
            double red   = c.R;
            double green = c.G;
            double blue  = c.B;

            red   = Math.Round((red / 255), 3);
            green = Math.Round((green / 255), 3);
            blue  = Math.Round((blue / 255), 3);

            //Fill the polygon with the background color first...
            elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                                  "\r\nq\t{0} {1} {2} RG\t{0} {1} {2} rg\t",
                                  red, green, blue); // color
            AddPoints(elements, pts);

            //if we have a pattern paint it now...
            if (si.PatternType != patternTypeEnum.None)
            {
                string p = patterns.GetPdfPattern(si.PatternType.ToString());
                c     = si.Color;
                red   = Math.Round((c.R / 255.0), 3);
                green = Math.Round((c.G / 255.0), 3);
                blue  = Math.Round((c.B / 255.0), 3);
                elements.AppendFormat("\r\nq");
                elements.AppendFormat("\r\n /CS1 cs");
                elements.AppendFormat("\r\n {0} {1} {2} /{3} scn", red, green, blue, p);
                elements.AppendFormat("\r\n {0} {1} {2} RG", red, green, blue);
                AddPoints(elements, pts);
            }
            elements.AppendFormat("\tQ");
        }
        public void Start()
        {
            // Create the anchor for all pdf objects
            CompressionConfig cc = RdlEngineConfig.GetCompression();
            anchor = new PdfAnchor(cc != null);

            //Create a PdfCatalog
            string lang;
            if (r.ReportDefinition.Language != null)
                lang = r.ReportDefinition.Language.EvaluateString(this.r, null);
            else
                lang = null;
            catalog= new PdfCatalog(anchor, lang);

            //Create a Page Tree Dictionary
            pageTree= new PdfPageTree(anchor);

            //Create a Font Dictionary
            fonts = new PdfFonts(anchor);

            //Create a Pattern Dictionary
            patterns = new PdfPattern(anchor);

            //Create an Image Dictionary
            images = new PdfImages(anchor);

            //Create an Outline Dictionary
            outline = new PdfOutline(anchor);

            //Create the info Dictionary
            info=new PdfInfo(anchor);

            //Set the info Dictionary.
            info.SetInfo(r.Name,r.Author,r.Description,"");	// title, author, subject, company

            //Create a utility object
            pdfUtility=new PdfUtility(anchor);

            //write out the header
            int size=0;
            tw.Write(pdfUtility.GetHeader("1.5",out size),0,size);
            filesize = size;
        }
        //25072008 GJL Draw a pie
        internal void AddPie(float x, float y, float height, float width, StyleInfo si, string url, PdfPattern patterns, string tooltip)
        {
            // Draw background rectangle if needed
            if (!si.BackgroundColor.IsEmpty && height > 0 && width > 0)
            {	// background color, height and width are specified
                AddFillRect(x, y, width, height, si, patterns);
            }

            AddBorder(si, x, y, height, width);			// add any required border

            //Do something...



            if (url != null)
                p.AddHyperlink(x, pSize.yHeight - y, height, width, url);

            if (!string.IsNullOrEmpty(tooltip))
                p.AddToolTip(x, pSize.yHeight - y, height, width, tooltip);

            return;
        }
/// <summary>
/// Page Polygon
/// </summary>
/// <param name="pts"></param>
/// <param name="si"></param>
/// <param name="url"></param>
/// <param name="patterns"></param>
        internal void AddPolygon(PointF[] pts, StyleInfo si, string url, PdfPattern patterns)
        {
            if (si.BackgroundColor.IsEmpty)
                return;         // nothing to do
            
            // Get the fill color - could be a gradient or pattern etc...
            Color c = si.BackgroundColor;
            double red = c.R;
            double green = c.G;
            double blue = c.B;
            red = Math.Round((red / 255), 3);
            green = Math.Round((green / 255), 3);
            blue = Math.Round((blue / 255), 3);

            //Fill the polygon with the background color first...			
            elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                "\r\nq\t{0} {1} {2} RG\t{0} {1} {2} rg\t", 
                red, green, blue);		// color
            AddPoints(elements, pts);

            //if we have a pattern paint it now...
            if (si.PatternType != patternTypeEnum.None)
            {
                string p = patterns.GetPdfPattern(si.PatternType.ToString());
                c = si.Color;
                red = Math.Round((c.R / 255.0), 3);
                green = Math.Round((c.G / 255.0), 3);
                blue = Math.Round((c.B / 255.0), 3);
                elements.AppendFormat("\r\nq");
                elements.AppendFormat("\r\n /CS1 cs");
                elements.AppendFormat("\r\n {0} {1} {2} /{3} scn", red, green, blue, p);
                elements.AppendFormat("\r\n {0} {1} {2} RG", red, green, blue);
                AddPoints(elements, pts);
            }
            elements.AppendFormat("\tQ");
        }
		internal void AddFillRect(float x,float y, float width, float height,StyleInfo si,PdfPattern patterns)
		{
			// Get the fill color - could be a gradient or pattern etc...
			Color c = si.BackgroundColor;
			double red=c.R;
			double green=c.G; 
			double blue=c.B;
			red = Math.Round((red/255),3);
			green = Math.Round((green/255),3);
			blue = Math.Round((blue/255),3);
			
			
			//Fill the rectangle with the background color first...			
			elements.AppendFormat(NumberFormatInfo.InvariantInfo,
				"\r\nq\t{0} {1} {2} RG\t{0} {1} {2} rg\t{3} {4} {5} {6} re\tf\tQ\t",
				red, green, blue,		// color
				x, pSize.yHeight-y-height, width, height);	// positioning	
			
            //if we have a pattern paint it now...
            if (si.PatternType != patternTypeEnum.None)
			{			
				string p = patterns.GetPdfPattern(si.PatternType.ToString());                
				c = si.Color;              
				red = Math.Round((c.R/255.0),3);
				green = Math.Round((c.G/255.0),3);
				blue = Math.Round((c.B/255.0),3);
				elements.AppendFormat("\r\nq");			
				elements.AppendFormat("\r\n /CS1 cs");
				elements.AppendFormat("\r\n {0} {1} {2} /{3} scn",red,green,blue,p);
				elements.AppendFormat("\r\n {0} {1} {2} RG",red,green,blue);
				elements.AppendFormat("\r\n {0} {1} {2} {3} re\tf",x, pSize.yHeight-y-height, width, height);
				elements.AppendFormat("\tQ");
			}
		}
Exemple #8
0
        //25072008 GJL Draw a pie
        internal void AddPie(float x, float y, float height, float width, StyleInfo si, string url, PdfPattern patterns, string tooltip)
        {
            // Draw background rectangle if needed
            if (!si.BackgroundColor.IsEmpty && height > 0 && width > 0)
            {   // background color, height and width are specified
                AddFillRect(x, y, width, height, si, patterns);
            }

            AddBorder(si, x, y, height, width);                 // add any required border

            //Do something...



            if (url != null)
            {
                p.AddHyperlink(x, pSize.yHeight - y, height, width, url);
            }

            if (!string.IsNullOrEmpty(tooltip))
            {
                p.AddToolTip(x, pSize.yHeight - y, height, width, tooltip);
            }

            return;
        }
Exemple #9
0
        internal void AddFillRect(float x, float y, float width, float height, StyleInfo si, PdfPattern patterns)
        {
            // Get the fill color - could be a gradient or pattern etc...
            Color  c     = si.BackgroundColor;
            double red   = c.R;
            double green = c.G;
            double blue  = c.B;

            red   = Math.Round((red / 255), 3);
            green = Math.Round((green / 255), 3);
            blue  = Math.Round((blue / 255), 3);


            //Fill the rectangle with the background color first...
            elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                                  "\r\nq\t{0} {1} {2} RG\t{0} {1} {2} rg\t{3} {4} {5} {6} re\tf\tQ\t",
                                  red, green, blue,                              // color
                                  x, pSize.yHeight - y - height, width, height); // positioning

            //if we have a pattern paint it now...
            if (si.PatternType != patternTypeEnum.None)
            {
                string p = patterns.GetPdfPattern(si.PatternType.ToString());
                c     = si.Color;
                red   = Math.Round((c.R / 255.0), 3);
                green = Math.Round((c.G / 255.0), 3);
                blue  = Math.Round((c.B / 255.0), 3);
                elements.AppendFormat("\r\nq");
                elements.AppendFormat("\r\n /CS1 cs");
                elements.AppendFormat("\r\n {0} {1} {2} /{3} scn", red, green, blue, p);
                elements.AppendFormat("\r\n {0} {1} {2} RG", red, green, blue);
                elements.AppendFormat("\r\n {0} {1} {2} {3} re\tf", x, pSize.yHeight - y - height, width, height);
                elements.AppendFormat("\tQ");
            }
        }
Exemple #10
0
		/// <summary>
		/// Add Pattern Resources to the pdf page
		/// </summary>
		internal void AddResource(PdfPattern patterns,int contentRef)
		{
			foreach (PdfPatternEntry pat in patterns.Patterns.Values)
			{
				patternRef+=string.Format("/{0} {1} 0 R",pat.pattern,pat.objectNum);
			}
			if(contentRef>0)
			{
				contents=string.Format("/Contents {0} 0 R",contentRef);
			}
			
		}