Permalink
Browse files

document should be immutable

  • Loading branch information...
1 parent 99dabef commit 7492147a5c0073a1cba5229bcd22e6fbe3f873d1 @steipete steipete committed Mar 4, 2014
@@ -304,7 +304,7 @@ - (id)init {
- (UIViewController *)invokeWithDelegate:(id<PSCExampleRunnerDelegate>)delegate {
NSURL *samplesURL = [NSBundle.mainBundle.resourceURL URLByAppendingPathComponent:@"Samples"];
- PSPDFDocument *document = [PSPDFDocument documentWithURL:[samplesURL URLByAppendingPathComponent:kHackerMagazineExample]];
+ PSPDFDocument *document = [PSPDFDocument documentWithBaseURL:samplesURL files:@[kHackerMagazineExample, kPaperExampleFileName]];
document.undoEnabled = NO; // faster!
// Here we use the `pageRange` feature to skip the intermediate `NSDate` objects we had to create in the last example.
@@ -313,7 +313,6 @@ - (UIViewController *)invokeWithDelegate:(id<PSCExampleRunnerDelegate>)delegate
[pageIndexes addIndex:5];
[pageIndexes addIndex:document.pageCount + 3]; // next document!
- [document appendFile:kPaperExampleFileName]; // Append second file
document.pageRange = pageIndexes; // Define new page range.
// Merge pages into new document.
@@ -109,11 +109,10 @@ - (void)startDownload {
}
NSString *fileName = [self.request.request.URL lastPathComponent];
- NSString *destinationPath = [[self downloadDirectory] stringByAppendingPathComponent:fileName];
+ NSString *destinationPath = [self.downloadDirectory stringByAppendingPathComponent:fileName];
NSURL *destinationURL = [NSURL fileURLWithPath:destinationPath];
self.magazine.available = YES;
self.magazine.downloading = NO;
- self.magazine.fileURL = destinationURL;
self.status = PSCStoreDownloadStatusFinished;
// Start caching thumbnail and full-image sizes so that the document will render faster.
@@ -1326,13 +1326,7 @@ - (void)createTableContent {
}]];
[testSection addContent:[PSContent contentWithTitle:@"Test rotated documents" block:^UIViewController *{
- PSPDFDocument *document = [PSPDFDocument documentWithURL:[samplesURL URLByAppendingPathComponent:@"Testcase_rotated-northern.pdf"]];
- [document appendFile:@"test1.pdf"];
- [document appendFile:@"test2.pdf"];
- [document appendFile:@"test3.pdf"];
- [document appendFile:@"test4.pdf"];
- [document appendFile:@"test5.pdf"];
- [document appendFile:@"Testcase_AllPageRotations.pdf"];
+ PSPDFDocument *document = [PSPDFDocument documentWithBaseURL:samplesURL files:@[@"Testcase_rotated-northern.pdf", @"test1.pdf", @"test2.pdf", @"test3.pdf", @"test4.pdf", @"test5.pdf", @"Testcase_AllPageRotations.pdf"]];
PSPDFViewController *pdfController = [[PSPDFViewController alloc] initWithDocument:document];
return pdfController;
}]];

0 comments on commit 7492147

Please sign in to comment.