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

Notification

Icon
Error

New Topic Post Reply
Options
Go to last post Go to first unread
mukesh  
#1 Posted : Monday, August 29, 2016 2:38:00 PM(UTC)
Quote
mukesh

Rank: Member

Groups: Registered
Joined: 7/14/2016(UTC)
Posts: 20
United States

Thanks: 4 times
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);
Paul Rayman  
#2 Posted : Monday, September 5, 2016 6:06:54 PM(UTC)
Quote
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Quick Reply Show Quick Reply
Users browsing this topic
Guest
Similar Topics
Ho to avoid losing content when inserting image into PdfDocument? (Common Questions)
by MischaS 7/5/2016 7:29:11 AM(UTC)
New Topic Post Reply
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.