Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Windows 8.1, 10, WindowsPhone, Windows UWP
  • Page:
  • 1

TOPIC:

Add an Image on PDF 6 years 10 months ago #12427

  • Pja
  • Pja's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 45
  • Thank you received: 0
Hi,

I want to add an image on pdf.
I have used the below method for iOS :
struct PDFV_POS pos;
[m_view vGetPos:&pos :imagePoint.x * m_scale :imagePoint.y * m_scale];


// Create the cache file
NSString *tp = NSTemporaryDirectory();
tp = [tp stringByAppendingPathComponent:@"cache.dat"];
[m_doc setCache:tp];

// Create the PDFPage instance of the current page
PDFPage *page = [m_doc page:pageNo];

// Create the CGImageRef of the image
CGImageRef ref = [[UIImage imageWithData:imageData] CGImage];

// Get PDFDocImage instance from CGImageRef (keeping alpha channel)
PDFDocImage *i = [m_doc newImage:ref :YES];


// Define the image rect
PDF_RECT rect;

rect.left = pos.x;
rect.right = pos.x + imageRect.size.width;
rect.top = pos.y;
rect.bottom = pos.y + imageRect.size.height;

// Add the image

[page addAnnotBitmap:i :&rect];

// Re-render the current page
[m_view vRenderSync:pageNo];
[self refresh];
Can you provide me the same implementation for windows.?

Please Log in or Create an account to join the conversation.

Last edit: by Pja.

Add an Image on PDF 6 years 10 months ago #12428

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
Please check this article Add Bitmap annotation to a page (Windows)

You can change the part that loads the image based on your requirements.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum