ios - how to create multiple pages pdf programmatically in iPhone -
i have 1 image array , trying create pdf images.how can create multiple pages pdf file. checked 1 tutorial not working me. how create multiple page pdf in ios6? please me
this works me:
nsarray *pagearray = yourimagearray; nsmutabledata *pdfdata = [nsmutabledata data]; uigraphicsbeginpdfcontexttodata(pdfdata, cgrectmake(0, 0, 595, 842), nil); (uiimage *theimage in pagearray) { uigraphicsbeginpdfpage(); nsdata *jpegdata = uiimagejpegrepresentation(theimage, 0.5); cgdataproviderref dp = cgdataprovidercreatewithcfdata((__bridge cfdataref)jpegdata); cgimageref cgimage = cgimagecreatewithjpegdataprovider(dp, null, true, kcgrenderingintentdefault); [[uiimage imagewithcgimage:cgimage] drawinrect:cgrectmake(0, 0, theimage.size.width, theimage.size.height)]; } uigraphicsendpdfcontext(); return pdfdata;
Comments
Post a Comment