Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4334358
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:31:04+00:00 2026-05-21T10:31:04+00:00

I ask sorry if this argument has already been covered, but after some research

  • 0

I ask sorry if this argument has already been covered, but after some research i found nothing precise.

I need to make a document based application, where the document is actually not a single file but a structured collection of files, in a directory. The windows will show a pdf contained in the folder, with a specific filename, and enrich it with informations from the other files in the folder.
I cannot use pdf annotations to achieve this, i really need to keep the files separated from the pdf.

What’s the best approach to achieve this? All the sample code i found use a single file..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:31:04+00:00Added an answer on May 21, 2026 at 10:31 am

    You can use NSFileWrapper as a package directory in document-based applications.

    In your application Info.plist file, state that your document type is a package or bundle (key LSTypeIsPackage with value YES).

    In your NSDocument subclass, implement the following methods for reading and writing. In this example, I’m assuming the corresponding model instance variables are pdfData and signatureBitmapData, which are stored in the package directory under MainDocument.pdf and SignatureBitmap.png, respectively.

    - (BOOL)readFromFileWrapper:(NSFileWrapper *)dirWrapper
                         ofType:(NSString *)typeName
                          error:(NSError **)outError
    {
    
        NSFileWrapper *wrapper;
        NSData *data;
    
        wrapper = [[dirWrapper fileWrappers] objectForKey:@"MainDocument.pdf"];
        data = [wrapper regularFileContents];
        self.pdfData = data;
    
        wrapper = [[dirWrapper fileWrappers] objectForKey:@"SignatureBitmap.png"];
        data = [wrapper regularFileContents];
        self.signatureBitmapData = data;
    
        …
    
        return YES;
    }
    
    - (NSFileWrapper *)fileWrapperOfType:(NSString *)typeName
                                   error:(NSError **)outError
    {
        NSFileWrapper *dirWrapper = [[[NSFileWrapper alloc]
            initDirectoryWithFileWrappers:nil] autorelease];
    
        [dirWrapper addRegularFileWithContents:self.pdfData
            preferredFilename:@"MainDocument.pdf"];
    
        [dirWrapper addRegularFileWithContents:self.signatureBitmapData
            preferredFilename:@"SignatureBitmap.png"];
    
        …
    
        return dirWrapper;
    }
    

    From the user perspective, the package directory shows up in Finder as if it were a single file, much like Xcode .xcodeproj directories or application bundles.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this has been answered already, but I could not find an appropriate
I'm sorry if this question has been asked before, but I'm not even sure
Sorry to ask this yet again. I've been reading the related topics here for
I'm sorry if this question is a dumb one, but I must ask. In
I'm sorry to have to ask something like this but python's mechanize documentation seems
Sorry, I'm not even sure how to ask this exactly... but I wrote a
The reason I ask is that Stack Overflow has been Slashdotted , and Redditted
I am very new to this and i am sorry to ask this question.
I’m a beginner in Ruby, so I’m sorry to ask something so simple, but
OK, I know that this has been asked previously, so please forgive me for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.