internal void Add(byte[] jpegImage, double posx, double posy, double DPI) { if (DPI <= 0) { throw new Exception("DPI must be greater than zero."); } string hash = BitConverter.ToInt32(MD5.Create().ComputeHash(jpegImage), 12).ToString("X"); PdfImage pi = (PdfImage)this.PdfDocument.images[hash]; if (pi == null) { pi = this.PdfDocument.NewImage(jpegImage, hash); this.PdfDocument.images.Add(hash, pi); } if (!this.Images.Contains(pi)) { this.Images.Add(pi); } PdfImageContent pic = new PdfImageContent(pi, posx, this.Height - posy, DPI); this.PdfStream.StreamObjectElements.Add(pic); }
internal void Add(byte[] jpegImage, double posx, double posy, double DPI) { if (DPI <= 0) throw new Exception("DPI must be greater than zero."); string hash = BitConverter.ToInt32(MD5.Create().ComputeHash(jpegImage), 12).ToString("X"); PdfImage pi = (PdfImage)this.PdfDocument.images[hash]; if (pi == null) { pi= this.PdfDocument.NewImage(jpegImage,hash); this.PdfDocument.images.Add(hash, pi); } if (!this.Images.Contains(pi)) this.Images.Add(pi); PdfImageContent pic = new PdfImageContent(pi, posx, this.Height - posy, DPI); this.PdfStream.StreamObjectElements.Add(pic); }