0

PSPDFkit 7.0 バージョンを使用して、PDF ファイルを作成しました。

このファイルは、すべてのブラウザーと PDF ビューアー アプリケーションで完全に機能します。しかし、問題の 1 つは、IOS デバイス ブラウザの safari、Chrome、および Firefox でこのドキュメントが表示されないことです。空のドキュメントを表示しています。

しかし、この PDF を iBook、ファイル ブラウザ、およびその他の PDF ビューア アプリケーションで開くと、完全に機能します。

次のように私のコード:

- (void)pdfDocumentDidSave:(PSPDFDocument *)document {
    NSLog(@"Successfully saved document.");

            //Get path directory
            NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
            NSString *documentsDirectory = [paths objectAtIndex:0];

            //Create PDF_Documents directory
            documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"PDF_Documents"];
            [[NSFileManager defaultManager] createDirectoryAtPath:documentsDirectory withIntermediateDirectories:YES attributes:nil error:nil];

            NSString *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory, @"hello123.pdf"];


    // Create default configuration
    PSPDFProcessorConfiguration *configuration = [[PSPDFProcessorConfiguration alloc] initWithDocument:document];

[configuration modifyAnnotationsOfTypes:PSPDFAnnotationTypeAll change:PSPDFAnnotationChangeEmbed];


    // Start the conversion from `document` to `scaledDocumentURL`
    [PSPDFProcessor generatePDFFromConfiguration:configuration securityOptions:nil outputFileURL:[NSURL URLWithString:filePath] progressBlock:nil error:NULL];


}
4

1 に答える 1