I recently downloaded a resume template file for Pages, which has a some "shapes" in it and I'd like to add my own icons as shapes (for Github, StackExchange, etc), which I haven't come across any docs about.
I tried importing an
.eps
file, but it just comes in as an image. Pages doesn't import .svg
s.
Looked in
/Applications/Pages.app/Contents/Resources
And found
-rw-r--r--@ 1 root wheel 4.9M Mar 17 2022 shape_library.json
Which is full of vector paths:
"178": {
"id": 178,
"shapePath": "M 478.593750 125.187500 C 416.293752 125.187500 399.593709 186.399994 399.593750 210.500000 C 399.593750 248.899999 422.693705 268.293742 435.593750 290.593750 C 437.793750 294.293750 434.706266 298.906298 430.406250 298.406250 C 350.606252 289.506250 305.412435 324.687501 274.312500 325.187500 C 256.412500 325.487500 227.393692 277.506254 204.093750 296.906250 C 187.893751 310.306250 184.693736 486.906254 314.593750 486.906250 C 444.393748 486.906250 485.500020 486.906250 485.500000 486.906250 C 485.500000 486.906250 595.406250 483.906311 595.406250 391.406250 C 595.406250 298.906250 539.406250 300.987528 539.406250 271.687500 C 539.406250 242.387499 591.606242 244.693736 595.406250 236.593750 C 599.606250 227.693750 582.312510 222.006271 582.312500 219.406250 C 582.312500 216.806250 600.106201 201.087508 595.406250 193.687500 C 590.906250 186.687500 582.187459 201.999990 556.187500 195.000000 C 553.487500 194.300000 551.512606 192.200014 550.812500 189.500000 C 545.912500 170.199999 536.193629 125.187523 478.593750 125.187500 Z M 478.593750 125.187500",
"localizationKey": "Rubber Duck_178",
"categories": {
"37": {
"position": 56
}
}
},
But this is obviously not meant to be edited.
Pages doesn't have a directory in /Library/Application\ Support/
or ~/Library/Application\ Support/
.
What am I missing?
# UPDATE
Based on answer from @grg, I found my way into the db
that stores the user-defined shapes and am hoping to make some updates there.
1. Get into the db
sqlite3 ~/"Library/Containers/com.apple.iWork.Pages/Data/Library/Application Support/com.apple.iWork.CloudKitStorage/com.apple.iWork.TSKCloudKitPrivateZone.db"
2. Look around
sqlite> pragma table_info(TSDUserDefinedShapeLibraryShape);
0|identifier|TEXT|0||1
1|cloudKitMetadata|TEXT|0||0
2|needs_first_fetch|INTEGER|0|0|0
3|TSDUserDefinedShapeLibraryBezierPathStringKey|TEXT|0||0
4|TSDUserDefinedShapeLibraryName
sqlite> select identifier, TSDUserDefinedShapeLibraryNameKey from TSDUserDefinedShapeLibraryShape;
E52A91BC-3774-45AE-B7A8-456EA04E4C0B|Envelope
E19F63AC-23B4-4495-B401-A83544A7AF37|Globe
7C133FEE-8C55-45B5-BB6A-D7A264898555|Location
9B7722F5-8029-4454-A8CA-AE6202BB5CA6|triangle
3. Make a modification
update TSDUserDefinedShapeLibraryShape set TSDUserDefinedShapeLibraryNameKey = "not a circle" where TSDUserDefinedShapeLibraryNameKey = 'triangle';
4. Confirm updated
sqlite> select identifier, TSDUserDefinedShapeLibraryNameKey from TSDUserDefinedShapeLibraryShape;
9B7722F5-8029-4454-A8CA-AE6202BB5CA6|not a circle
5. Quit and Restart Pages - updated name not there.
However if I update the name _within_ pages, the new name shows up right away:
9B7722F5-8029-4454-A8CA-AE6202BB5CA6|treehouse
So it seems that Pages is writing to the db in realtime, but not reading from it. Perhaps it's the cloudkitMetadata that needs to change. Perhaps I just shouldn't be trying to use the application in this way.
### Safety
To backup db
before hacking at it:
.sqlite ~/"Library/Containers/com.apple.iWork.Pages/Data/Library/Application Support/com.apple.iWork.CloudKitStorage/com.apple.iWork.TSKCloudKitPrivateZone.db" \
".backup 'iword_cloudkit_backup_file.sq3'"
## Second Update
Possibly due to having disconnected from the internet, my database changes are now showing up after restarting the Pages application.
I can now successfully run CRUD
commands on the db and as they will work if certain specs are met:
1. location
needs to be a UUID of the correct format. Not sure what format that is. [This website](https://hashes.com/en/tools/hash_identifier) suggested the app is generating either version 1 or 4. I have tried generating my own and they don't seem to work. I can only INSERT
if I use a location
previously generated by the app.
2. Am still unsure if being connected to the internet makes any difference.
3. The TSDUserDefinedShapeLibraryBezierPathStringKey
needs to be a [Bezier curve](https://en.wikipedia.org/wiki/B%C3%A9zier_curve) . Not an svg path.
I have tried using a [tool to generate a Bezier curve from svg path](https://itchylabs.com/tools/path-to-bezier) , but so far not in a way that renders correctly. In testing I copy-pasted paths from the shapy_library.json
file referenced above.
Asked by MikeiLL
(537 rep)
Dec 16, 2022, 05:28 PM
Last activity: Dec 17, 2022, 02:56 AM
Last activity: Dec 17, 2022, 02:56 AM