0.1.3 • Published 1 year ago

directus-extension-pdf-filled-viewer-endpoint v0.1.3

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

PDF Filled Viewer

This endpoint allows you to view a filled PDF file in Directus.

Usage

  1. Install the extension using a package manager or from the Marketplace:
npm install directus-extension-pdf-filled-viewer-endpoint
  1. Import this collection.

  2. Update the settings by adding your form filling logic:

return async function (props) {
  const { settings, query, form, fields, createItemsService, logFields, updateFilename, sendResponse } = props;
  const { collection, id } = query;

  if (!collection || !id) {
    sendResponse(404, 'Missing query params: collection or id');
    return;
  }

  try {
    const itemsService = await createItemsService(collection);
    const item = await itemsService.readOne(id);

    form.getCheckBox('<field>').check();
    form.getTextField('<field>').setText('...');
  } catch (e) {
    console.error(e);
  }
}
  1. Add this as the Preview URL:

Format:

<PUBLIC_URL>/pdf-filled-viewer/<filename_disk>

Example:

http://localhost:8055/pdf-filled-viewer/33461458-ed8b-4917-9f74-318ef4731ddf.pdf?collection=items&id=1
0.1.2

1 year ago

0.1.3

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago