मेरे पास एक लंबा HTML पृष्ठ है और इसे एक बहुआयामी पीडीएफ फ़ाइल में परिवर्तित करना चाहता था।आईओएस - एचटीएमएल सामग्री से बहु पृष्ठ पीडीएफ बनाना
मैंने दिए गए स्ट्रिंग सामग्री के लिए apple और here - how to make multi page PDF में दिए गए निर्देशों का पालन किया है।
लेकिन एनएसएसटींग (कुछ डेटा के साथ) स्वरूपण एक HTML पृष्ठ बनाने से कठिन है। मैंने इस एचटीएमएल को बनाया है और इसे UIWebView में प्रदर्शित किया है।
अब मैं इस HTML से मल्टी पेज पीडीएफ फ़ाइल में एक पीडीएफ बनाना चाहता हूं।
मैं जिस कोड का उपयोग कर रहा हूं वह एकल पीडीएफ बना सकता है।
- (void)createPDFfromUIView:(UIWebView *)aView saveToDocumentsWithFileName:(NSString*)aFilename { // Creates a mutable data object for updating with binary data, like a byte array NSMutableData *pdfData = [NSMutableData data]; // Points the pdf converter to the mutable data object and to the UIView to be converted UIGraphicsBeginPDFContextToData(pdfData, aView.bounds, nil); UIGraphicsBeginPDFPage(); CGContextRef pdfContext = UIGraphicsGetCurrentContext(); // draws rect to the view and thus this is captured by UIGraphicsBeginPDFContextToData [aView.layer renderInContext:pdfContext]; // remove PDF rendering context UIGraphicsEndPDFContext(); // Retrieves the document directories from the iOS device NSArray* documentDirectories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES); NSString* documentDirectory = [documentDirectories objectAtIndex:0]; NSString* documentDirectoryFilename = [documentDirectory stringByAppendingPathComponent:aFilename]; // instructs the mutable data object to write its context to a file on disk [pdfData writeToFile:documentDirectoryFilename atomically:YES]; NSLog(@"documentDirectoryFileName: %@",documentDirectoryFilename); }
क्या कोई भी कुछ मदद दे सकता है?
वेहरंग आप आदमी हैं। मैंने अभी नमूना ऐप और यह सब कुछ देखा जो मैं ढूंढ रहा था। लेकिन मेरी आवश्यकता बदल गई और कुछ और किया। लेकिन यह कमाल है। मैं भविष्य में इसका इस्तेमाल कर सकता हूं। प्रयास और विशेष रूप से चीजों को समझाते हुए धन्यवाद। – Viraj
इस ढांचे के साथ समस्या यह है कि यह किसी भी टेक्स्ट बॉक्स में किसी भी डेटा को कैप्चर नहीं करेगा। वे सभी खाली हो जाएंगे। – GuybrushThreepwood
यह बहुत अच्छा काम करता है !!! ज़बर्दस्त मर्द !!! – Rudi