- Posts: 3
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Development and suggestions about third part tool integration.
Cordova, Xamarin, Basic4Android topics are listed here.
Cordova, Xamarin, Basic4Android topics are listed here.
PNG To PDF Conversion (Xamarin iOS)
- FabienLheriau
- Topic Author
- Offline
- New Member
-
Less
More
IP: 192.168.0.71
8 years 11 months ago #12250
by FabienLheriau
PNG To PDF Conversion (Xamarin iOS) was created by FabienLheriau
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.
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.
IP: 192.168.0.71
8 years 11 months ago #12254
by emanuele
Replied by emanuele on topic PNG To PDF Conversion (Xamarin iOS)
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.
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.
- FabienLheriau
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 3
- Thank you received: 0
IP: 192.168.0.71
8 years 11 months ago #12255
by FabienLheriau
Replied by FabienLheriau on topic PNG To PDF Conversion (Xamarin iOS)
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
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
- FabienLheriau
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 3
- Thank you received: 0
IP: 192.168.0.71
8 years 11 months ago #12257
by FabienLheriau
Replied by FabienLheriau on topic PNG To PDF Conversion (Xamarin iOS)
I have a solution :
I'm using PDFPageContent, AddResImage and DrawImage but with this bindings
so by replacing the type PDF_PAGE_IMAGE with IntPtr.
Thansk for your help anyway,
Fabien.
I'm using PDFPageContent, AddResImage and DrawImage but with this bindings
Code:
[Export("drawImage:")]
void DrawImage(IntPtr image);
Code:
[Export("addResImage:")]
IntPtr AddResImage(PDFDocImage image);
Thansk for your help anyway,
Fabien.
Time to create page: 0.407 seconds