Jean-Luc Godard
Jean-Luc Godard

Reputation: 1883

how to convert jpeg file to pdf file in iphone?

I want to convert jepg file into pdf file in an iphone application...

Do anyone know any link or tutorial or any idea about this?

Upvotes: 2

Views: 6616

Answers (1)

Ole Begemann
Ole Begemann

Reputation: 135550

All you can do is load the image file and draw it into a newly created PDF context:

  1. Load the JPEG file into a UIImage.
  2. Create a new PDF context with CGPDFContextCreate() or CGPDFContextCreateWithURL().
  3. Add a page to the PDF context with CGPDFContextBeginPage().
  4. Draw the image into the PDF context. You will probably have to play a bit with the coordinate systems and the size of the image, depending on how you want the image to appear in the PDF.
  5. Call CGPDFContextEndPage() and CGPDFContextClose().

Upvotes: 5

Related Questions