Created
November 24, 2022 15:09
-
-
Save gbersac/4fa2734760a3c30a7b6013e4dc1e463f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function createOneDocument() { | |
const data = { | |
"url": "https://firebasestorage.googleapis.com/v0/b/louvcap-eea66.appspot.com/o/public%2FpdfTemplates%2FpdfBackoffice%2Fneo_bulletin-souscription.pdf?alt=media&token=9e026601-95cf-442c-9533-5e7a4eba8ff1", | |
"fields": [ | |
{ | |
"text": "true", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box27." | |
}, | |
{ | |
"text": "D743", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text28." | |
}, | |
{ | |
"text": "Louve Advisory", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text29." | |
}, | |
{ | |
"text": "LAMBERT Théophile", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text30." | |
}, | |
{ | |
"text": "false", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box31." | |
}, | |
{ | |
"text": "false", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box32." | |
}, | |
{ | |
"text": "BERSAC", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text34." | |
}, | |
{ | |
"text": "MAIDENNAME", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text35." | |
}, | |
{ | |
"text": "GUILLAUME", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text36." | |
}, | |
{ | |
"text": "12/01/1989", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text37." | |
}, | |
{ | |
"text": "LIBOURNE", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text38." | |
}, | |
{ | |
"text": "ZIPCODEOFBIRTH", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text39." | |
}, | |
{ | |
"text": "FR", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text40." | |
}, | |
{ | |
"text": "LFKDSQJLMFKLJMDSFKJLMSDQ", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text41." | |
}, | |
{ | |
"text": "false", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box54." | |
}, | |
{ | |
"text": "true", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box55." | |
}, | |
{ | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text56." | |
}, | |
{ | |
"text": "", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text57." | |
}, | |
{ | |
"text": "", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text58." | |
}, | |
{ | |
"text": "", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text59." | |
}, | |
{ | |
"text": "[email protected]", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text60." | |
}, | |
{ | |
"text": "+33665308943", | |
"type": "EditBox", | |
"pages": "1", | |
"fieldname": "Text62." | |
}, | |
{ | |
"text": "TRUE", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box63." | |
}, | |
{ | |
"text": "true", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box28." | |
}, | |
{ | |
"text": "false", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box29." | |
}, | |
{ | |
"text": "false", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box30." | |
}, | |
{ | |
"text": "false", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box34." | |
}, | |
{ | |
"text": "false", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box35." | |
}, | |
{ | |
"text": "false", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box36." | |
}, | |
{ | |
"text": "false", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box37." | |
}, | |
{ | |
"text": "false", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box38." | |
}, | |
{ | |
"text": "false", | |
"type": "CheckBox", | |
"pages": "1", | |
"fieldname": "Check Box39." | |
}, | |
{ | |
"text": "1", | |
"type": "EditBox", | |
"pages": "2", | |
"fieldname": "Text115." | |
}, | |
{ | |
"text": "187", | |
"type": "EditBox", | |
"pages": "2", | |
"fieldname": "Montant de souscription180 euros." | |
}, | |
{ | |
"text": "Un", | |
"type": "EditBox", | |
"pages": "2", | |
"fieldname": "Text148." | |
}, | |
{ | |
"text": "true", | |
"type": "CheckBox", | |
"pages": "2", | |
"fieldname": "Check Box85" | |
}, | |
{ | |
"text": "PARIS", | |
"type": "EditBox", | |
"pages": "2", | |
"fieldname": "Text93." | |
}, | |
{ | |
"text": "24/11/2022", | |
"type": "EditBox", | |
"pages": "2", | |
"fieldname": "Date94_af_date." | |
}, | |
{ | |
"text": "true", | |
"type": "CheckBox", | |
"pages": "9", | |
"fieldname": "Check Box49" | |
} | |
] | |
} | |
return axios | |
.post("https://api.pdf.co/v1/pdf/edit/add", data, { | |
headers: { | |
"x-api-key": conf.pdf_co_apiKey, | |
Accept: "application/json", | |
}, | |
}) | |
.then(res => { | |
const body = res.data as { url: string; status: number } | |
if (body?.status === 200) { | |
return { ...body, ...doc } | |
} else { | |
Logger.error("Received error form pdf.co", { extra: { error: res.data, response: res } }) | |
return Promise.reject(body) | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment