Setting PDF data with JXA does not work

Maybe the create web/PDF document commands would be a better option instead of opening & capturing a window?

1 Like

You’re right, of course

Sorry @cgrunenberg, that delay actually is in my script, but I stripped it accidentally - this should work. Thanks for taking the time to test this!

const app = Application("DEVONthink 3");
r = app.createRecordWith({name: "DEVONtechnologies", URL:"https://www.devontechnologies.com", type:"bookmark");
let rWindow = app.openWindowFor({record: r});
while (rWindow.loading()) { delay(0.3); }
rData = rWindow.pdf()
delay(5);
app.createRecordWith({name: r.name(), URL:r.url(), type:"PDF document", data: rData});

That would definitely be the best, but the reason for this is that this works with logged in sites (e.g. paywalled sites) instead of create web/PDF document which holds no cookies. I’ve summarized pros and cons of different methods I tried in researching these workflows here: Wrong text (layer) when capture PDF from viewer window - #15 by mdbraber

Works fine.

1 Like