logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Post a reply
From:
Message

Maximum number of characters in each post is: 32767
Bold Italic Underline   Highlight Quote Choose Language for Syntax Highlighting Insert Image Insert an existing Attachment or upload a new File... Create Link   Unordered List Ordered List   Left Justify Center Justify Right Justify   Outdent Indent   More BBCode Tags
Font Color Font Size
Security Image:
Enter The Letters From The Security Image:
  Preview Post Cancel

Last 10 Posts (In reverse order)
Paul Rayman Posted: Monday, September 5, 2016 6:06:54 PM(UTC)
 
mukesh Posted: Monday, August 29, 2016 2:38:00 PM(UTC)
 
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);