Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Development and suggestions about third part tool integration.
Cordova, Xamarin, Basic4Android topics are listed here.
  • Page:
  • 1

TOPIC:

Add image as attachment 6 years 3 months ago #13296

  • anchalsahu
  • anchalsahu's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Hi,

I want to allow a user to select an image from the device and attach it to the pdf file.

Is it possible? Can you please share details about this feature?

Thanks,
Anchal

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

Add image as attachment 6 years 3 months ago #13299

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
Dear Anchal,
To include such a feature you should customize the Objective-C/Java framework .

You need to implement the image selection yourself based on your requirements.

To add an image attachment, you can use the method Page.AddAnnotAttachment
page.AddAnnotAttachment("/mnt/sdcard/image.png",  0, new float[]{300,500,330,530})
/**
	 * add a file as an attachment to page.<br/>
	 * you should re-render page to display modified data.<br/>
	 * this can be invoked after ObjsStart or Render or RenderToBmp.<br/>
	 * this method require professional or premium license, and Document.SetCache invoked.
	 * @param path absolute path name to the file.
	 * @param icon icon display to the page. values as:<br/>
	 * 0: PushPin<br/>
	 * 1: Graph<br/>
	 * 2: Paperclip<br/>
	 * 3: Tag<br/>
	 * @param rect 4 elements: left, top, right, bottom in PDF coordinate system.
	 * @return true or false.<br/>
	 * the added annotation can be obtained by Page.GetAnnot(Page.GetAnnotCount() - 1), if this method return true. 
	 */
    final public boolean AddAnnotAttachment(String path, int icon, float[] rect)

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

Add image as attachment 6 years 3 months ago #13306

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Here is also the Obj-C example to add an attachement:
    PDF_RECT rect;
    rect.left = 100;
    rect.top = 100;
    rect.right = 150;
    rect.bottom = 150;
    PDFPage *page = [m_doc page:m_cur_page];
    [page addAnnotAttachment:[[NSBundle mainBundle] pathForResource:@"image" ofType:@"png"] :0 :&rect];
    [m_doc save];

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

  • Page:
  • 1
Powered by Kunena Forum