hi, anyone used gpt4 to help write plugin for pdfxce?

This forum is for plugins used in the PDF-XChange Editor only.

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

krstoevan
User
Posts: 61
Joined: Thu Jan 12, 2023 3:00 pm

hi, anyone used gpt4 to help write plugin for pdfxce?

Post by krstoevan »

hi,
gpt4 worked quite well when i wanna write macro for mindmanager, using winwrap (a VBA clone).

the code mostly didn't work on it's own (probably because winwrap =/= VBA, and mindmanager is so rarely used).

but the BACKBONE did work well, and only need minor human troubleshooting.

below is what i asked about plugin in pdfxce,
it say it's an JS API., is it true?
krstoevan
User
Posts: 61
Joined: Thu Jan 12, 2023 3:00 pm

Re: hi, anyone used gpt4 to help write plugin for pdfxce?

Post by krstoevan »

me to gpt4:
do you know how to write a plugin for pdf xchange editor?

gpt4:
PDF-XChange Editor does not have a native plugin system like Obsidian. However, it does provide a JavaScript API that allows you to create and run custom scripts within the application. These scripts can be used to automate tasks, manipulate PDF content, and interact with PDF form fields.

Here's a brief guide on how to create and run a custom script in PDF-XChange Editor:

1. **Open PDF-XChange Editor**: Launch the application and open the PDF file you want to work with.

2. **Open the JavaScript Console**: Navigate to `Document > JavaScript > JavaScript Console` or press `Ctrl + J` to open the JavaScript Console.

3. **Write your script**: In the JavaScript Console, you can write and execute JavaScript code that interacts with the PDF document. The JavaScript code should use the PDF-XChange Editor API, which is based on the Adobe JavaScript API for Acrobat.

For example, here's a simple script that adds a text annotation to the first page of the PDF document:

```javascript
var annot = this.addAnnot({
page: 0,
type: "Text",
point: [100, 700],
contents: "Hello, this is a custom annotation.",
});
```

4. **Execute the script**: Press the `Execute JavaScript` button or press `Ctrl + Enter` to run the script. The specified action(s) will be performed on the PDF document, and you can see the results immediately.

Please note that the PDF-XChange Editor JavaScript API is quite extensive, and you can perform a wide range of tasks with it. To learn more about the available API functions, consult the [PDF-XChange Editor JavaScript API documentation](https://help.pdf-xchange.com/pdfxe ... anual.html).

While PDF-XChange Editor doesn't have a built-in system for creating and distributing plugins like Obsidian, you can create reusable scripts and share them with others who can import and run them within their own PDF-XChange Editor installations. You can also create menu items, toolbar buttons, and keyboard shortcuts to trigger custom scripts, making them more accessible to users. To learn more about these features, refer to the [PDF-XChange Editor Customizing documentation](https://help.pdf-xchange.com/pdfxe ... ation.html).
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: hi, anyone used gpt4 to help write plugin for pdfxce?

Post by Tracker Supp-Stefan »

Hello krstoevan,

gtp4 is mostly correct in it's reply - there is no exposed interface in the end user Editor that would allow you to create your own plug-in. In the past it was possible to develop plug-ins using the Editor SDK, but that is no longer for sale.

that gtp4 suggested is the correct way to move forward - you can create custom JS that you can then e.g. include in a button (there are other topics here in the forums illustrating how you can add a UI button that when clicked triggers JS code) and have that button run your desired JS code.

The JS we support is based on this document:
JavaScript for Acrobat API Reference

There are some limitations of what this can do - mostly due to security restrictions.
E.g. you can not manipulate third party files in the file system (you can save a copy of the current file your JS is working on, but can't delete an arbitrary file on the file system from the JS Console).

Kind regards,
Stefan