Is it possible to create a pdf with different page sizes in iOS - Objective C? -
i've done multiple times pdf pages @ same size. possible mixed sizes pdf on ios? (like example fixed width , multiple heights pages)
i'm finding lot of discordant answers around, , few data on platform-specific capabilities.
it has been easy adding every page different mediabox.
// start pdf file nsmutabledata *pdffile = [[nsmutabledata alloc] init]; cgdataconsumerref pdfconsumer = cgdataconsumercreatewithcfdata((cfmutabledataref)pdffile); cgrect mediabox = cgrectmake(0, 0, pagesize.width, pagesize.height); cgcontextref pdfcontext = cgpdfcontextcreate(pdfconsumer, &mediabox, null); cgcontextbeginpage(pdfcontext, &mediabox); cgcontextdrawimage(pdfcontext, imagebox, [image cgimage]); cgcontextendpage(pdfcontext); // change mediabox cgcontextbeginpage(pdfcontext, &mediabox); ... etc.... cgcontextendpage(pdfcontext); // close pdf cgcontextrelease(pdfcontext); cgdataconsumerrelease(pdfconsumer);
Comments
Post a Comment