내 응용 프로그램에서 사용자는 그의 목록에 정보를 추가 할 수 있으며 마침내 그 목록을 다른 사람에게 전자 메일로 보내려고합니다. 나는 그 목록을 어떻게 내보낼 수 있을까? pdf 또는 txt 파일로 내보낼 수 있습니까?텍스트 또는 pdf로 내보내기
0
A
답변
1
좋아, 불행히도 나는 그것을 참조하지 대한 죄송 답을 볼 수있는 페이지를 잃었다. 이 마법의 코드입니다 : 이미 내 XIB 파일에서 만든 현재의 UILabel의 나에 UIView를 사용할 수 있다면 난 그냥 대신있는 NSString의, 궁금해
-(void)createPDFfromUIView:(UIView*)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, mainView.bounds, nil);
UIGraphicsBeginPDFPage();
CGContextRef pdfContext = UIGraphicsGetCurrentContext();
// draws rect to the view and thus this is captured by UIGraphicsBeginPDFContextToData
[mainView.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);
}
1
iOS5를 검색하는 경우 this Link을 확인하십시오.
http://www.raywenderlich.com/6581/how-to-create-a-pdf-with-quartz-2d-in-ios-5-tutorial-part-1
편집이 같은 UI
elements
를 사용 : 나는이 코드를 사용
[yourView.layer renderInContext:UIGraphicsGetCurrentContext()]
관련 문제
- 1. SVG 요소를 PDF로 내보내기?
- 2. 클라이언트 또는 서버 측에서 pdf로 내보내기?
- 3. PHP 폼 데이터를 Excel 또는 PDF로 내보내기
- 4. jqplot 차트를 PDF로 내보내기
- 5. .NET WinForms 양식을 PDF로 내보내기?
- 6. 크리스탈 리포트를 pdf로 내보내기
- 7. Java JTable PDF로 내보내기
- 8. html을 PHP로 PDF로 내보내기?
- 9. Google 차트를 PDF로 내보내기
- 10. ASP.Net 페이지를 PDF로 내보내기
- 11. 보고서를 직접 PDF로 내보내기
- 12. ASP.Net 페이지를 PDF로 내보내기
- 13. as3 pdf로 내보내기?
- 14. 이미지를 PDF로 내보내기
- 15. DataWindow를 PDF로 내보내기
- 16. Ext.net GridPanel PDF로 내보내기
- 17. DataGrid를 PDF로 내보내기 C#
- 18. PDF로 로컬 폴더로 내보내기
- 19. struts 1.x의 PDF로 내보내기
- 20. .Net Windows 양식을 PDF로 내보내기
- 21. 그리드 뷰 데이터를 PDF로 내보내기
- 22. Crystal Reports - MVC에서 PDF로 내보내기
- 23. MOSS 2007 Wiki MS Word 또는 PDF로 내보내기
- 24. 사용자 정의 속성을 org 모드로 PDF로 내보내기
- 25. 형식으로 Excel, Word 및 PDF로 데이터 내보내기
- 26. android에서 텍스트 또는 xml로 데이터베이스 파일 내보내기
- 27. Photoshop에서 PDF로 연결 : 텍스트 품질 Degradaton
- 28. 버튼 클릭시 JSP 출력을 PDF로 내보내기
- 29. jbutton actionevent로 netbeans에서 pdf로 ireport 내보내기
- 30. jsp의 디스플레이 태그를 사용하여 이미지를 pdf로 내보내기
감사 SIBA, 나는 그 전에 튜토리얼 빨간색 * textToDraw = @ "Hello World" – Rudi
http://stackoverflow.com/questions/9554670/how-to-export-uiview-to-pdf-file 이것이 도움이 될 것입니다. –