PNG To PDF Conversion (Xamarin iOS) - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Development and suggestions about third part tool integration.
Cordova, Xamarin, Basic4Android topics are listed here.
  • Page:
  • 1

TOPIC: PNG To PDF Conversion (Xamarin iOS)

PNG To PDF Conversion (Xamarin iOS) 1 year 8 months ago #12250

  • FabienL
  • FabienL's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0
Hi,
Currently, I'm trying to convert a png/jpg file to a pdf in a Xamarin iOS project. I already made some bindings to use your Obj-C functions like addAnnotBitmap but it doest not seem to make the job. Maybe I'm not doing the right operations or the right "Init" functions before adding a annotation or image.
Can you provide me a example of How to add an image to a pdf file in Xamarin iOS ? I have a png/jpg file and I want to put it on a PDFDoc and save the doc as a pdf file.
Thanks,
FabienL.

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

PNG To PDF Conversion (Xamarin iOS) 1 year 8 months ago #12254

  • emanuele
  • emanuele's Avatar
  • Online
  • Moderator
  • Moderator
  • Posts: 526
  • Karma: 20
  • Thank you received: 60
Hi,

if I correctly understood, you need to create a new file starting from an image (png or jpg), but addAnnotBitmap method creates an annotation in a valid pdf instance, so you cannot use this method to create a file.
You should first create a pdf file with an empty page, then you can use addAnnotBitmap method to add the image as annotation.

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

PNG To PDF Conversion (Xamarin iOS) 1 year 8 months ago #12255

  • FabienL
  • FabienL's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0
Thanks for your answer,

I have created a new pdf file with Create and SetCache in a path with a new page with the right size. I have an image file that I have translated to a PDFDocImage with NewImageJPEG and with that I'm using AddAnnotBitmap to add it to the page and I'm saving the doc at the end. But the resulting pdf file is just a white page at the size of the image.
I tried another way of doing this : using PageContent and DrawImage but I cannot bind the type PDF_PAGE_IMAGE to the xamarin bindings library.
I'm stuck.
FabienL

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

PNG To PDF Conversion (Xamarin iOS) 1 year 8 months ago #12257

  • FabienL
  • FabienL's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0
I have a solution :
I'm using PDFPageContent, AddResImage and DrawImage but with this bindings
[Export("drawImage:")]
void DrawImage(IntPtr image);
[Export("addResImage:")]
IntPtr AddResImage(PDFDocImage image);
so by replacing the type PDF_PAGE_IMAGE with IntPtr.

Thansk for your help anyway,
Fabien.

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

  • Page:
  • 1
Powered by Kunena Forum