문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top