关于如何在申请表上显示国防军的许多资源。 我现在正在做的是从<代码>上建立一个国防军。 UIViews。
例如,我有<条码> 查询/编码>,包括文本概览、<条码>、<条码>、<条码>、<条码>、<条码>、<条码>、<条码>、以便我能够转换<>条块状>。 www.un.org/Depts/DGACM/index_french.htm
我检查了。 页: 1 然而,它只是就向人民抵抗力量的档案撰写文章。
The problem I am facing is that the content I want to write to a file as PDF is a lot. If I write them to the PDF piece by piece, it is going to be huge work to do.
That s why I am looking for a way to write UIViews
to PDFs or even bitmaps.
我在Stack Overflow内部尝试了从其他Q/A复制的源代码。 但是,这只给我一个空白的PDF,其编号为
-(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, aView.bounds, nil);
UIGraphicsBeginPDFPage();
// draws rect to the view and thus this is captured by UIGraphicsBeginPDFContextToData
[aView drawRect:aView.bounds];
// 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);
}