Я пытаюсь создать PDF из UIView и хорошо работает, так как «How to Convert UIView to PDF within iOS?» сделал.
Но мой iPad - это пейзаж и форма, длинная форма с высотой 3k.
Когда я конвертирую в PDF, он преобразует только размер высоты iPad, а именно 748, а не 3k, мне нужно.Создать PDF из UIView в iOS 5.1 Пейзаж не работает
Что не так? Версия iOS?
Редакция: Heres код, как @wain спросить
-(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);
}
Показать код, который вы используете. – Wain
Да, одна минута –