简体   繁体   中英

How to create pdf programmatically in specific format?

在此输入图像描述

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!

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 :)

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM