Search Results

Search found 2 results on 1 pages for 'pennylane'.

Page 1/1 | 1 

  • iTextSharp Overlay Image

    - by pennylane
    Hi guys I have an instance where I have a logo image as part of some artwork.. If a user uploads a new logo I have a form field which is larger than the default logo. I then use that form field to position the new image. The problem is I need to set the background colour of that form field to white so that it covers the old logo in the event that the new image is smaller than the old logo.. what I have done is: foreach (var imageField in imageReplacements) { fields.SetFieldProperty(imageField.Key, "bgcolor", iTextSharp.text.Color.WHITE, null); fields.RegenerateField(imageField.Key); PdfContentByte overContent = stamper.GetOverContent(imageField.Value.PageNumber); float[] logoArea = fields.GetFieldPositions(imageField.Key); if (logoArea != null) { iTextSharp.text.Rectangle logoRect = new iTextSharp.text.Rectangle(logoArea[1], logoArea[2], logoArea[3], logoArea[4]); var logo = iTextSharp.text.Image.GetInstance(imageField.Value.Location); if (logo.Width >= logoRect.Width || logo.Height >= logoRect.Height) { logo.ScaleToFit(logoRect.Width, logoRect.Height); } logo.Alignment = iTextSharp.text.Image.ALIGN_LEFT; logo.SetAbsolutePosition(logoRect.Left, logoArea[2] + (logoRect.Height - logo.ScaledHeight) / 2); // left: logoArea[3] - logo.ScaledWidth + (logoRect.Width - logo.ScaledWidth) / 2 overContent.AddImage(logo); } } The problem with this is that the background colour of the field is set to white and the image then doesn't appear.. i remove the SetFieldProperty and RegenerateField commands and the image replacement works fine.. is there a way to set a stacking order on layers?

    Read the article

  • ASP.NET Image Upload Parameter Not Valid. Exception

    - by pennylane
    Hi Guys, Im just trying to save a file to disk using a posted stream from jquery uploadify I'm also getting Parameter not valid. On adding to the error message so i can tell where it blew up in production im seeing it blow up on: var postedBitmap = new Bitmap(postedFileStream) any help would be most appreciated public string SaveImageFile(Stream postedFileStream, string fileDirectory, string fileName, int imageWidth, int imageHeight) { string result = ""; string fullFilePath = Path.Combine(fileDirectory, fileName); string exhelp = ""; if (!File.Exists(fullFilePath)) { try { using (var postedBitmap = new Bitmap(postedFileStream)) { exhelp += "got past bmp creation" + fullFilePath; using (var imageToSave = ImageHandler.ResizeImage(postedBitmap, imageWidth, imageHeight)) { exhelp += "got past resize"; if (!Directory.Exists(fileDirectory)) { Directory.CreateDirectory(fileDirectory); } result = "Success"; postedBitmap.Dispose(); imageToSave.Save(fullFilePath, GetImageFormatForFile(fileName)); } exhelp += "got past save"; } } catch (Exception ex) { result = "Save Image File Failed " + ex.Message + ex.StackTrace; Global.SendExceptionEmail("Save Image File Failed " + exhelp, ex); } } return result; }

    Read the article

1