skip to Main Content

I’m developing a Next.js application where users can take notes on pictures, and I’m looking for a way to allow users to export these notes (structured as image + text pairs) directly to Apple Notes. So far, I’ve tried several approaches, but none seem ideal. I’m hoping someone can suggest better solutions or improvements.

Question:

Has anyone encountered a similar situation or found a better way to export structured data (like image + text) to Apple Notes from a web app? Are there any workarounds or other APIs that might support this kind of integration?

Any guidance or suggestions would be greatly appreciated!

Here are the options I’ve tried so far:

Copy and Paste:

I copy the information (text + image) to the user’s clipboard. They can manually paste this into Apple Notes.

Issue: This solution is not very user-friendly and requires manual intervention.

URL Scheme (Only works for text):

iPhone: mobilenotes://add?title=My%20Note%20Title&content=This%20is%20the%20body%20of%20the%20note%20on%20iOS

Mac: notes://add?title=My%20Mac%20Note%20Title&content=This%20is%20the%20body%20of%20the%20note%20on%20macOS

Issue: This only allows text export; images cannot be included using this approach.

Using the Share API:

This allows the user to select Apple Notes as the app where the content will be saved. It works well but has limitations.

Issue: The Share API can only handle a structure like: one title, one text block and then the images in a combination (but not text – image, text – image blocks … etc.

3

Answers


  1. Chosen as BEST ANSWER

    Using Navigator: clipboard

    It is possible to save html to the clipboard.

    1. Format the notes in a structured html
    2. Create a button with a click event
    3. In this click event use the structured html and navigator.clipboard.write to save the html into the users clipboard
    4. The User will now be able to paste the content into their notes and they will be formatted perfectly.

    Small Code Example

        // first create the clipboard item - use .then to fetch the data because otherwise it will not work on ios
        const clipboardItem = new ClipboardItem({
            'text/html': getYourContent().then((htmlContent) => {
                return new Blob([htmlContent], { type: 'text/html' });
            }),
        });
    
        navigator.clipboard.write([clipboardItem]);
    
    
        const getYourContent = () => {
            // fetch content if you really use this
            // small html example:
            const htmlContent = `
                  <h1>Header</h1>
                  <p>$paragraph</p>
                  <br/>
                  <img src="https:/picture.com" />
            `;
            
            return htmlContent
        }
    

  2. I think you can generate your note using markdown format (notion, apple notes etc support it) and then you can use the share api to open the file using notes

    Login or Signup to reply.
  3. On macOS, you could create RTFD bundles.

    Rich Text Format Directory (RTFD) bundles, such as those created by TextEdit rich text documents with images, can be imported into Apple Notes on macOS with formatting and images preserved. The bundle is essentially a directory with a standard Rich Text Format (.rtf) file, along with attachments (such as images).

    If you can package and allow downloading content from your application as RTFD bundles, they can be easily imported by the user, by just opening them in Apple Notes. I would suggest creating a rich text document in TextEdit (on macOS) and adding images, then opening the resulting RTFD bundle in Apple Notes. If this solution works for you, you can inspect the underlying file structure of the bundle to see how you can make an export of your application data that matches the RTFD bundle structure.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search