コード例 #1
0
        /// <summary>
        /// Add image to the page.  Adds a new XObject Image and a reference to it.
        /// </summary>
        /// <returns>string Image name</returns>
        internal string AddImage(PdfImages images, string name, int contentRef, StyleInfo si,
                                 ImageFormat imf, float x, float y, float width, float height, RectangleF clipRect,
                                 byte[] im, int samplesW, int samplesH, string url, string tooltip)
        {
            //MITEK:START----------------------------------
            //Duc Phan added 20 Dec, 2007 clip image
            if (!clipRect.IsEmpty)
            {
                elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                                      "\r\nq\t{0} {1} {2} {3} re W n",
                                      clipRect.X + pSize.leftMargin, pSize.yHeight - clipRect.Y - clipRect.Height - pSize.topMargin, clipRect.Width, clipRect.Height);
            }
            //MITEK:END----------------------------------

            string imgname = images.GetPdfImage(this.p, name, contentRef, imf, im, samplesW, samplesH);

            elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                                  "\r\nq\t{2} 0 0 {3} {0} {1} cm\t",
                                  x, pSize.yHeight - y - height, width, height);              // push graphics state, positioning

            elements.AppendFormat(NumberFormatInfo.InvariantInfo, "\t/{0} Do\tQ\t", imgname); // do the image then pop graphics state
            //MITEK:START----------------------------------

            //Duc Phan added 20 Dec, 2007 clip image
            if (!clipRect.IsEmpty)
            {
                elements.AppendFormat("\tQ\t");   //pop graphics state
            }

            //MITEK:END----------------------------------


            if (url != null)
            {
//				p.AddHyperlink(x, pSize.yHeight-y, height, width, url);
                p.AddHyperlink(x + pSize.leftMargin,
                               pSize.yHeight - y - pSize.topMargin,
                               height, width, url);// Duc Phan modified 4 Sep, 2007 to account for the page margin
            }
            if (tooltip != null)
            {
                p.AddToolTip(x + pSize.leftMargin,
                             pSize.yHeight - y - pSize.topMargin,
                             height, width, tooltip);
            }


            // Border goes around the image padding
            AddBorder(si, x - si.PaddingLeft, y - si.PaddingTop,
                      height + si.PaddingTop + si.PaddingBottom,
                      width + si.PaddingLeft + si.PaddingRight);                // add any required border

            return(imgname);
        }
コード例 #2
0
ファイル: RenderPdf.cs プロジェクト: eksotama/odd-reports
        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;
        }
コード例 #3
0
ファイル: PdfElements.cs プロジェクト: steev90/opendental
        /// <summary>
        /// Add image to the page.  Adds a new XObject Image and a reference to it.
        /// </summary>
        /// <returns>string Image name</returns>
        internal string AddImage(PdfImages images, string name, int contentRef, StyleInfo si,
                                 ImageFormat imf, float x, float y, float width, float height,
                                 byte[] im, int samplesW, int samplesH, string url)
        {
            string imgname = images.GetPdfImage(this.p, name, contentRef, imf, im, samplesW, samplesH);

            elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                                  "\r\nq\t{2} 0 0 {3} {0} {1} cm\t",
                                  x, pSize.yHeight - y - height, width, height);              // push graphics state, positioning

            elements.AppendFormat(NumberFormatInfo.InvariantInfo, "\t/{0} Do\tQ\t", imgname); // do the image then pop graphics state

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

            // Border goes around the image padding
            AddBorder(si, x - si.PaddingLeft, y - si.PaddingTop,
                      height + si.PaddingTop + si.PaddingBottom,
                      width + si.PaddingLeft + si.PaddingRight);                // add any required border

            return(imgname);
        }
コード例 #4
0
ファイル: RenderPdf.cs プロジェクト: net-haus/My-FyiReporting
        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;
        }
コード例 #5
0
ファイル: RenderPdf.cs プロジェクト: myersBR/My-FyiReporting
        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;

            if (r.ItextPDF)
            {
                PdfWriter writer = PdfWriter.GetInstance(pdfdocument, ms);
                pdfdocument.Open();
                cb = writer.DirectContent;
                pdfdocument.AddAuthor(r.Author);
                pdfdocument.AddCreationDate();
                pdfdocument.AddCreator("Majorsilence Reporting");
                pdfdocument.AddSubject(r.Description);
                pdfdocument.AddTitle(r.Name);

            }
            else
            {
                tw.Write(pdfUtility.GetHeader("1.5", out size), 0, size);
            }

            //
            filesize = size;
        }
コード例 #6
0
ファイル: RenderPdf.cs プロジェクト: myersBR/My-FyiReporting
        /// <summary>
        /// Add image to the page.
        /// </summary>
        /// <returns>string Image name</returns>
        private void iAddImage(PdfImages images, string name, int contentRef, StyleInfo si,
            ImageFormat imf, float x, float y, float width, float height, RectangleF clipRect,
            byte[] im, int samplesW, int samplesH, string url, string tooltip)
        {

            iTextSharp.text.Image pdfImg = iTextSharp.text.Image.GetInstance(im);
            pdfImg.ScaleAbsolute(width, height); //zoom		  
            pdfImg.SetAbsolutePosition(x, _pSize.yHeight - y - height);//Set position
            pdfdocument.Add(pdfImg);
            //add url
            if (url != null)
                pdfdocument.Add(new Annotation(x, _pSize.yHeight - y - _pSize.topMargin, width + x, height, url));
            //add tooltip
            if (!string.IsNullOrEmpty(tooltip))
                pdfdocument.Add(new Annotation(x, _pSize.yHeight - y - _pSize.topMargin, width + x, height, tooltip));
            iAddBorder(si, x - si.PaddingLeft, y - si.PaddingTop,
                height + si.PaddingTop + si.PaddingBottom,
                width + si.PaddingLeft + si.PaddingRight);			// add any required border
        }
コード例 #7
0
		/// <summary>
		/// Add image to the page.  Adds a new XObject Image and a reference to it.
		/// </summary>
		/// <returns>string Image name</returns>
		internal string AddImage(PdfImages images, string name, int contentRef, StyleInfo si,
            ImageFormat imf, float x, float y, float width, float height, RectangleF clipRect,
			byte[] im, int samplesW, int samplesH, string url,string tooltip)
		{
            //MITEK:START---------------------------------- 
            //Duc Phan added 20 Dec, 2007 clip image 
            if (!clipRect.IsEmpty)
            {
                elements.AppendFormat(NumberFormatInfo.InvariantInfo,
                                      "\r\nq\t{0} {1} {2} {3} re W n",
                                      clipRect.X + pSize.leftMargin, pSize.yHeight - clipRect.Y - clipRect.Height - pSize.topMargin, clipRect.Width, clipRect.Height);
            }
            //MITEK:END---------------------------------- 
            
            string imgname = images.GetPdfImage(this.p, name, contentRef, imf, im, samplesW, samplesH);
			
			elements.AppendFormat(NumberFormatInfo.InvariantInfo,
				"\r\nq\t{2} 0 0 {3} {0} {1} cm\t",
				x, pSize.yHeight-y-height, width, height);	// push graphics state, positioning

			elements.AppendFormat(NumberFormatInfo.InvariantInfo, "\t/{0} Do\tQ\t", imgname);	// do the image then pop graphics state
            //MITEK:START---------------------------------- 

            //Duc Phan added 20 Dec, 2007 clip image 
            if (!clipRect.IsEmpty)
            {
                elements.AppendFormat("\tQ\t");   //pop graphics state 
            }

            //MITEK:END---------------------------------- 


			if (url != null)
//				p.AddHyperlink(x, pSize.yHeight-y, height, width, url);
                p.AddHyperlink(x + pSize.leftMargin, 
                               pSize.yHeight - y - pSize.topMargin, 
                               height, width, url);// Duc Phan modified 4 Sep, 2007 to account for the page margin 

            if(tooltip != null)
                p.AddToolTip(x + pSize.leftMargin,
                              pSize.yHeight - y - pSize.topMargin,
                              height, width, tooltip);


            // Border goes around the image padding
			AddBorder(si, x-si.PaddingLeft, y-si.PaddingTop, 
                height + si.PaddingTop+ si.PaddingBottom, 
                width + si.PaddingLeft + si.PaddingRight);			// add any required border

			return imgname;
		}
コード例 #8
0
		/// <summary>
		/// Add image to the page.  Adds a new XObject Image and a reference to it.
		/// </summary>
		/// <returns>string Image name</returns>
		internal string AddImage(PdfImages images, string name, int contentRef, StyleInfo si,
			ImageFormat imf, float x,float y, float width, float height, 
			byte[] im, int samplesW, int samplesH, string url)
		{
			string imgname = images.GetPdfImage(this.p, name, contentRef, imf, im, samplesW, samplesH);
			
			elements.AppendFormat(NumberFormatInfo.InvariantInfo,
				"\r\nq\t{2} 0 0 {3} {0} {1} cm\t",
				x, pSize.yHeight-y-height, width, height);	// push graphics state, positioning

			elements.AppendFormat(NumberFormatInfo.InvariantInfo, "\t/{0} Do\tQ\t", imgname);	// do the image then pop graphics state

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

            // Border goes around the image padding
			AddBorder(si, x-si.PaddingLeft, y-si.PaddingTop, 
                height + si.PaddingTop+ si.PaddingBottom, 
                width + si.PaddingLeft + si.PaddingRight);			// add any required border

			return imgname;
		}