Pergunta

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.

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top