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:
- i created html template basic structure invoice
- the template filled data using grmustache
- 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:
- do know how fix page break problem?
- can recommend solution create pdfs on ios?
- 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
Post a Comment