Pandey_Laxman
Pandey_Laxman

Reputation: 3908

How to create pdf programmatically in specific format?

enter image description here

I have all the data in NSData object but I dont know how to create a pdf that will display in this format. The main problem is that product does not have a fixed content size, there will be more and more depending upon the customer, how much he/she purchases.

I don't want to make uiview like below format because if do so then how do captured entire uitableview in .png format.

Please give the logic how to create pdf for below format. Thanks a ton!

Upvotes: 3

Views: 1902

Answers (3)

DivineDesert
DivineDesert

Reputation: 6954

There are two ways to create PDFs in iOS:

If you want text in your PDF, you need to use Quartz 2D There is no API that helps you to draw in tabular format. You need to draw lines, text by calculating x and y positions, all done manually. If you have fixed set of fields then only you can follow this approach.

Else, you can create a html page for your required format, and then set this page in PDF as an image, a very simple approach.

Both will be done using Quartz 2D

Hope this helps :)

Upvotes: 7

iCreative
iCreative

Reputation: 1506

There are two ways to draw PDF.

http://www.ioslearner.com/generate-pdf-programmatically-iphoneipad/

The UIKit Api creates a nice clean & smooth PDF. While Quartz2D framework creates a little blur pdf. So you need to be sure before using it.

Let me know if it works or any issues.

Upvotes: 1

Lithu T.V
Lithu T.V

Reputation: 20021

Best place to start here and then here

need to draw a table with lines and add text and image to it also :)

For info refer

and docs

Upvotes: 1

Related Questions