google cloud print - How can I create a PDF programmatically in iOS -


this question has answer here:

i want create pdf labels , image , table set of rows in ios programmatically.

please suggest idea this.

how can enable google cloud priniting in ios programmatically?

void createpdffile (cgrect pagerect, const char *filename)  {    // code block sets our pdf context can draw cgcontextref pdfcontext; cfstringref path; cfurlref url; cfmutabledictionaryref mydictionary = null;  // create cfstring filename provide method when call path = cfstringcreatewithcstring (null, filename,                                   kcfstringencodingutf8);  // create cfurl using cfstring defined url = cfurlcreatewithfilesystempath (null, path,                                      kcfurlposixpathstyle, 0); cfrelease (path); // dictionary contains options 'signing' pdf mydictionary = cfdictionarycreatemutable(null, 0,                                          &kcftypedictionarykeycallbacks,                                          &kcftypedictionaryvaluecallbacks);  cfdictionarysetvalue(mydictionary, kcgpdfcontexttitle, cfstr("my pdf file")); cfdictionarysetvalue(mydictionary, kcgpdfcontextcreator, cfstr("my name")); // create our pdf context cfurl, cgrect provide, , above defined dictionary pdfcontext = cgpdfcontextcreatewithurl (url, &pagerect, mydictionary); // cleanup our mess cfrelease(mydictionary); cfrelease(url); // done creating our pdf context, it's time draw  // starts our first page cgcontextbeginpage (pdfcontext, &pagerect);  // draws black rectangle around page inset 50 on sides cgcontextstrokerect(pdfcontext, cgrectmake(50, 50, pagerect.size.width - 100, pagerect.size.height - 100));  // code block create image draw page const char *picture = "picture"; cgimageref image; cgdataproviderref provider; cfstringref picturepath; cfurlref pictureurl;  picturepath = cfstringcreatewithcstring (null, picture,                                          kcfstringencodingutf8); pictureurl = cfbundlecopyresourceurl(cfbundlegetmainbundle(), picturepath, cfstr("png"), null); cfrelease(picturepath); provider = cgdataprovidercreatewithurl (pictureurl); cfrelease (pictureurl); image = cgimagecreatewithpngdataprovider (provider, null, true, kcgrenderingintentdefault); cgdataproviderrelease (provider); cgcontextdrawimage (pdfcontext, cgrectmake(200, 200, 207, 385),image); cgimagerelease (image); // end image code  // adding text on top of image added cgcontextselectfont (pdfcontext, "helvetica", 16, kcgencodingmacroman); cgcontextsettextdrawingmode (pdfcontext, kcgtextfill); cgcontextsetrgbfillcolor (pdfcontext, 0, 0, 0, 1); const char *text = "hello world!"; cgcontextshowtextatpoint (pdfcontext, 260, 390, text, strlen(text)); // end text  // done drawing page, let's end // add many pages wanted using cgcontextbeginpage/cgcontextendpage cgcontextendpage (pdfcontext);  // done our context now, release cgcontextrelease (pdfcontext); 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -