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:

PNG To PDF Conversion (Xamarin iOS) 7 years 1 week ago #12250

  • FabienLheriau
  • FabienLheriau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • 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) 7 years 1 week ago #12254

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
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) 7 years 1 week ago #12255

  • FabienLheriau
  • FabienLheriau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • 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) 7 years 1 week ago #12257

  • FabienLheriau
  • FabienLheriau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • 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