@digipair/skill-pdf 0.85.1 → 0.85.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -27725,9 +27725,17 @@ let PDFService = class PDFService {
27725
27725
  }, {});
27726
27726
  return fields;
27727
27727
  }
27728
+ async getSize(params, _pinsSettingsList, _context) {
27729
+ const { file } = params;
27730
+ const buffer = this.base64ToPdf(file);
27731
+ const document = await PDFDocument.load(buffer);
27732
+ return document.getPages().length;
27733
+ }
27728
27734
  };
27729
27735
  const fillForm = (params, pinsSettingsList, context)=>new PDFService().fillForm(params, pinsSettingsList, context);
27730
27736
  const getFields = (params, pinsSettingsList, context)=>new PDFService().getFields(params, pinsSettingsList, context);
27737
+ const getSize = (params, pinsSettingsList, context)=>new PDFService().getSize(params, pinsSettingsList, context);
27731
27738
 
27732
27739
  exports.fillForm = fillForm;
27733
27740
  exports.getFields = getFields;
27741
+ exports.getSize = getSize;
package/index.esm.js CHANGED
@@ -27720,8 +27720,15 @@ let PDFService = class PDFService {
27720
27720
  }, {});
27721
27721
  return fields;
27722
27722
  }
27723
+ async getSize(params, _pinsSettingsList, _context) {
27724
+ const { file } = params;
27725
+ const buffer = this.base64ToPdf(file);
27726
+ const document = await PDFDocument.load(buffer);
27727
+ return document.getPages().length;
27728
+ }
27723
27729
  };
27724
27730
  const fillForm = (params, pinsSettingsList, context)=>new PDFService().fillForm(params, pinsSettingsList, context);
27725
27731
  const getFields = (params, pinsSettingsList, context)=>new PDFService().getFields(params, pinsSettingsList, context);
27732
+ const getSize = (params, pinsSettingsList, context)=>new PDFService().getSize(params, pinsSettingsList, context);
27726
27733
 
27727
- export { fillForm, getFields };
27734
+ export { fillForm, getFields, getSize };
@@ -1,3 +1,4 @@
1
1
  import { PinsSettings } from '@digipair/engine';
2
2
  export declare const fillForm: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
3
3
  export declare const getFields: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
4
+ export declare const getSize: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-pdf",
3
- "version": "0.85.1",
3
+ "version": "0.85.2",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "service",
package/schema.fr.json CHANGED
@@ -63,6 +63,25 @@
63
63
  ],
64
64
  "x-events": []
65
65
  }
66
+ },
67
+ "/getSize": {
68
+ "post": {
69
+ "tags": ["service", "web", "spatial"],
70
+ "summary": "Nombre de page d'un PDF",
71
+ "description": "Retourne le nombre de page PDF.",
72
+ "parameters": [
73
+ {
74
+ "name": "file",
75
+ "summary": "Fichier",
76
+ "required": true,
77
+ "description": "Fichier PDF à analyser",
78
+ "schema": {
79
+ "type": "string"
80
+ }
81
+ }
82
+ ],
83
+ "x-events": []
84
+ }
66
85
  }
67
86
  },
68
87
  "components": {
package/schema.json CHANGED
@@ -63,6 +63,25 @@
63
63
  ],
64
64
  "x-events": []
65
65
  }
66
+ },
67
+ "/getSize": {
68
+ "post": {
69
+ "tags": ["service", "web", "spatial"],
70
+ "summary": "Number of pages in a PDF",
71
+ "description": "Returns the number of pages in a PDF.",
72
+ "parameters": [
73
+ {
74
+ "name": "file",
75
+ "summary": "File",
76
+ "required": true,
77
+ "description": "PDF file to analyze",
78
+ "schema": {
79
+ "type": "string"
80
+ }
81
+ }
82
+ ],
83
+ "x-events": []
84
+ }
66
85
  }
67
86
  },
68
87
  "components": {