Pergunta

I've some text entered by user in my app and image is captured from camera. I want to create a PDF using the text and image? I know how to create a PDF as mentioned in URL PDF Creation

But I don't know how to create a PDF using both text and image. Can some one suggest me good tutorial or some sample piece of code?

Foi útil?

Solução

On the lines of the example provided at the link you mentioned, you can do something like-

CGContextSelectFont (pdfContext, "Arial", 12, kCGEncodingMacRoman);
CGContextSetTextDrawingMode (pdfContext, kCGTextFill);
CGContextSetRGBFillColor (pdfContext, 0, 0, 0, 1);
const char *text = "my text";
CGContextShowTextAtPoint (pdfContext, 50, 375, text, strlen(text)); //Display wherever you want to

You can use CGContextDrawImage in a similar fashion to display the image.

HTH,

Akshay

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