0

I use libHary to create PDF. I use this answer iOS SDK - Programmatically generate a PDF file to create pdf.

In this library method HPDF_LoadPngImageFromFile exist, but I need to load image from data (or UIImage). How can I do that?

Now the best solution for me is to right data to png file and then load it, but I thing better solution should exist.

Community
  • 1
  • 1
Paul T.
  • 4,938
  • 7
  • 45
  • 93

1 Answers1

1

LibHaru is platform independent so it does not know about about UIImage or NSData.
You have 2 options:
1. Save the UIImage/NSData to a file and then load the image from the file using HPDF_LoadPngImageFromFile method or
2. Save the UIImage to a NSData object, get a pointer to the NSData buffer ([nsdataobject bytes] method) and then use HPDF_LoadPngImageFromMem to load the image from memory.

Mihai Iancu
  • 1,818
  • 2
  • 11
  • 10