|
|
the following code tries to insert a bitmap into an existing PDF document on the first page at the location that the user had clicked. What I am expecting is that the bitmap image is saved in the document at the desired location (here the mouse clicked coordinates) but when I look at the document, it has not saved the bitmap anywhere. What am I doing wrong?
var doc = Patagames.Pdf.Net.PdfDocument.Load(@"C:\PDF\OldFile.PDF"); var docImgObj =PdfImageObject.Create(doc); var bi = bmpSign.LockBits( new System.Drawing.Rectangle(0, 0, bmpSign.Width, bmpSign.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
//Create PdfBitmap object from .Net bitmap var bitmap =newPdfBitmap( bi.Width, bi.Height, BitmapFormats.FXDIB_Argb, bi.Scan0, bi.Stride);
docImgObj.SetMatrix(1, 0, 0, 1, (float)ptMouseClick.X, (float)ptMouseClick.location.Y); docImgObj.Transform(bmpSign.Width, 0, 0, bmpSign.Height, 0, 0);
doc.Pages[0].PageObjects.InsertObject(docImgObj);
doc.Save(@"C:\PDF\UpdatedForm.pdf", 0);
|