objective c - iOS create PDF invoice -


i want create pdf invoice inside ios app (either in objective-c or swift).
main problem invoice might have several pages, difficult realize existing apis apple (coregraphics, quartz 2d, etc).

by now, have barely working solution:

  1. i created html template basic structure invoice
  2. the template filled data using grmustache
  3. i load generated html file uiwebview , save pdf (i used ndhtmltopdf this)

so far, good.

the problem solution page breaks don't work properly. there tables , images , page break cut's off tables or images.
have tried use page-break-inside: avoid; css property images , tables uiwebview seems ignore them completely...

my question is:

  1. do know how fix page break problem?
  2. can recommend solution create pdfs on ios?
  3. should design invoice in storyboard , generate pdf uiview? page breaks here?

i prefer have template (e.g. html), fill data , save pdf, rather doing in code.

i wrote pdf reporting component myself presumably similar requirements:

  • templating done via html / css
  • static header / footer on each page

you can achieve uiprintpagerenderer , uiviewprintformatter apis, downside of getting app rejected in app store review, since you're using private apple apis. approach might viable in academic setting or if developing in-house apps.

there tutorials on how i'm not going repeat, me these resources quite useful:


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -