Photoshop API: How to replace a missing font?
Hello. I'm editing a PSD file's text layers with the Photoshop JavaScript API. The original file features the Adobe Clean Medium font, so I want to keep it. Since by default the API replaces it with Arial, I'm explicitly setting the desired font in the call's options object. For the href property, I uploaded the font file (an OTF) to an AEM instance and successfully created an Adobe I/O signed URL out of it. This is the relevant section of my code:
const axios = require('axios');
//...
let requestBody = {
"inputs": [
{
"href": inputUrl,
"storage": "external"
}
],
"options": {
"manageMissingFonts": "useDefault",
"globalFont": "Adobe Clean Medium",
"fonts": [
{
"storage": "external",
"href": fontUrl //"<SIGNED_GET_URL_TO_AdobeClean-Medium.otf>"
}
],
"layers": [
{
"name": "layer2",
"text": {
"contents": "content 1",
}
},
{
"name": "layer3",
"text": {
"contents": "content 2",
}
}
]
},
"outputs": [
{
"href": outputUrl,
"storage": "external",
"type": "vnd.adobe.photoshop"
}
]
};
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://image.adobe.io/pie/psdService/text',
headers: {
'Authorization': 'Bearer ' + aioToken,
'x-api-key': aioApiKey,
...data.getHeaders()
},
data: JSON.stringify(requestBody)
};
try {
let resp = await axios.request(config);
//...
} catch(e){
console.error(e)
}My code looks almost the same as in the docs However, although the text is modified, I'm not getting the font replaced. What am I doing wrong?
