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
MischaS  
#1 Posted : Tuesday, July 5, 2016 7:29:11 AM(UTC)
Quote
MischaS

Rank: Newbie

Groups: Registered
Joined: 6/29/2016(UTC)
Posts: 3

Thanks: 1 times
Hi,

i want to insert an image into a Pdf document. The image gets inserted using the below code.
However, other page content gets lost. How do I avoid this?

Code:

var form = new PdfForms();
var doc = PdfDocument.Load("filepath", form);

Bitmap bmp = new Bitmap(logo, 165, 38);
var bi = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly,
PixelFormat.Format32bppArgb);

var bitmap = new PdfBitmap(bmp.Width, bmp.Height, BitmapFormats.FXDIB_Argb, bi.Scan0, bi.Stride);

var image = PdfImageObject.Create(doc);
image.SetBitmap(bitmap);
image.SetMatrix(1, 0, 0, 1, 0, 0);
image.Transform(165, 0, 0, bmp.Height, 50, 700);

var page = doc.Pages[0];

page.PageObjects.InsertObject(image, -1);
page.GenerateContent();
Paul Rayman  
#2 Posted : Monday, September 5, 2016 6:09:39 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
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.