iOS Component which generates PDF file from a view.
- UIView with background color and subviews
- UILabel with text and background colors
- UIImageView with image or background color
- Add CoreText framework to the project.
- Add ViewToPDF.m and ViewToPDF.h files to the project.
- Include (#import) ViewToPDF.h file to the ViewController from which you would like to render PDF file.
- NSString *fullPDFPath - full path to the rendered PDF file
-
initWithView:(UIView*)view andPDFFileName:(NSString*)PDFFileName parameters: 1.1 view - UIView to render PDF from 1.2 PDFFileName - name of the PDF file
-
render - render PDF file from specified view
// Create and instance of viewToPDF
ViewToPDF *viewToPDF = [[ViewToPDF alloc] initWithView:self.reportView andPDFFileName:@"my_pdg.pdf"];
// Render method renders PDF file from the reportView view
[viewToPDF render];
// This property showf the full path to rendered PDF file
NSLog(@"PDF File path: %@",viewToPDF.fullPDFPath);