tengo el siguiente json que contiene un historial laboral, cada seccion inicia con el nombre de la empresa y finaliza con el ultimo movimiento de cambio de salario,
{
"meta": {
"info": {
"PDFFormatVersion": "1.4",
"Language": null,
"EncryptFilterName": null,
"IsLinearized": false,
"IsAcroFormPresent": false,
"IsXFAPresent": false,
"IsCollectionPresent": false,
"IsSignaturesPresent": false,
"Creator": "JasperReports (reporteSemanasCotizadas)",
"Producer": "iText 2.1.7 by 1T3XT",
"ModDate": "D:20220713094658-05'00'",
"CreationDate": "D:20220713094658-05'00'"
},
"metadata": null
},
"pages": [
{
"pageInfo": {
"num": 1,
"scale": 1,
"rotation": 0,
"offsetX": 0,
"offsetY": 0,
"width": 612,
"height": 792
},
"links": [],
"content": [
{
"x": 225.13,
"y": 108.78999999999996,
"str": "Instituto Mexicano del Seguro Social",
"dir": "ltr",
"width": 161.7399999999999,
"height": 10,
"fontName": "Helvetica"
},
{},
{
"x": 438.82,
"y": 210.27999999999997,
"str": "DD",
"dir": "ltr",
"width": 8.664,
"height": 6,
"fontName": "Helvetica"
},
{},
{
"x": 460.82800000000003,
"y": 210.27999999999997,
"str": "MM",
"dir": "ltr",
"width": 9.996,
"height": 6,
"fontName": "Helvetica"
},
{},
{
"x": 484.16800000000006,
"y": 210.27999999999997,
"str": "YYYY",
"dir": "ltr",
"width": 16.008,
"height": 6,
"fontName": "Helvetica"
},
{},
{
"x": 247.53,
"y": 282.04,
"str": "Tu detalle de semanas cotizadas",
"dir": "ltr",
"width": 116.94399999999999,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 201.57,
"y": 141.78999999999996,
"str": "Constancia de Semanas Cotizadas en el IMSS",
"dir": "ltr",
"width": 207.8699999999999,
"height": 10,
"fontName": "Helvetica"
},
{},
{
"x": 462.83,
"y": 245.03999999999996,
"str": "363",
"dir": "ltr",
"width": 13.344000000000001,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 47,
"y": 226.03999999999996,
"str": "NSS:",
"dir": "ltr",
"width": 18.672,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 47,
"y": 205.03999999999996,
"str": "HERNANDEZ HIGUERA CARLOS ABDIEL",
"dir": "ltr",
"width": 154.24800000000002,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 70,
"y": 226.03999999999996,
"str": "21139682674",
"dir": "ltr",
"width": 48.928000000000004,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 75,
"y": 246.03999999999996,
"str": "HEHC960204HSLRGR09",
"dir": "ltr",
"width": 91.584,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 47,
"y": 246.03999999999996,
"str": "CURP:",
"dir": "ltr",
"width": 24.888,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 431.87,
"y": 302.04,
"str": "Semanas Reintegradas",
"dir": "ltr",
"width": 83.59200000000001,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 522.1339999999999,
"y": 302.04,
"str": "(+)",
"dir": "ltr",
"width": 10,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 264.65,
"y": 297.44,
"str": "Semanas Descontadas",
"dir": "ltr",
"width": 82.70400000000001,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 247.32,
"y": 306.63,
"str": "(por disposición de recursos)",
"dir": "ltr",
"width": 102.69599999999998,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 356.6879999999997,
"y": 306.63,
"str": "(-)",
"dir": "ltr",
"width": 7.992000000000001,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 123.33,
"y": 322.04,
"str": "363",
"dir": "ltr",
"width": 13.344000000000001,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 303.78,
"y": 322.04,
"str": "0",
"dir": "ltr",
"width": 4.448,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 479.78,
"y": 322.04,
"str": "0",
"dir": "ltr",
"width": 4.448,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 84.2,
"y": 302.04,
"str": "Semanas cotizadas IMSS",
"dir": "ltr",
"width": 91.592,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 47,
"y": 186.03999999999996,
"str": "Estimado(a),",
"dir": "ltr",
"width": 45.34400000000001,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 419.7,
"y": 225.03999999999996,
"str": "Total de semanas cotizadas",
"dir": "ltr",
"width": 99.6,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 417.7,
"y": 186.03999999999996,
"str": "Fecha de emisión del reporte",
"dir": "ltr",
"width": 103.60000000000002,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 436.14,
"y": 200.60000000000002,
"str": "13",
"dir": "ltr",
"width": 8.896,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 451.7079999999999,
"y": 200.60000000000002,
"str": "/",
"dir": "ltr",
"width": 2.224,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 460.60399999999987,
"y": 200.60000000000002,
"str": "07",
"dir": "ltr",
"width": 8.896,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 476.1719999999998,
"y": 200.60000000000002,
"str": "/",
"dir": "ltr",
"width": 2.224,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 485.06799999999976,
"y": 200.60000000000002,
"str": "2022",
"dir": "ltr",
"width": 17.792,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 274.21,
"y": 360.04,
"str": "Tu historia laboral",
"dir": "ltr",
"width": 63.57599999999999,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 312,
"y": 453.95,
"str": "Vigente",
"dir": "ltr",
"width": 27.128000000000004,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 147,
"y": 433.95,
"str": "BAJA CALIFORNIA",
"dir": "ltr",
"width": 70.23999999999998,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 388,
"y": 453.95,
"str": "Salario Base de Cotización */",
"dir": "ltr",
"width": 103.59999999999998,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 44,
"y": 453.95,
"str": "Fecha de alta",
"dir": "ltr",
"width": 48.472000000000016,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 232,
"y": 453.95,
"str": "Fecha de baja",
"dir": "ltr",
"width": 50.695999999999984,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 147,
"y": 453.95,
"str": "27/09/2021",
"dir": "ltr",
"width": 40.032000000000004,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 44,
"y": 433.95,
"str": "Entidad federativa",
"dir": "ltr",
"width": 64.48,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 518.86,
"y": 453.95,
"str": "$ 940.68",
"dir": "ltr",
"width": 31.13600000000005,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 44,
"y": 393.95,
"str": "Nombre del patrón",
"dir": "ltr",
"width": 66.24800000000002,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 147,
"y": 393.95,
"str": "BAJA TRIMS",
"dir": "ltr",
"width": 47.11999999999999,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 44,
"y": 413.95,
"str": "Registro Patronal",
"dir": "ltr",
"width": 61.80000000000001,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 147,
"y": 413.95,
"str": "A086589310",
"dir": "ltr",
"width": 45.368,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 322.26,
"y": 489.04,
"str": "Fecha de movimiento",
"dir": "ltr",
"width": 76.47199999999998,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 129.6,
"y": 489.04,
"str": "Tipo de movimiento",
"dir": "ltr",
"width": 69.79999999999998,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 479.32,
"y": 489.04,
"str": "Salario Base",
"dir": "ltr",
"width": 45.352,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 340.48,
"y": 509.04,
"str": "01/07/2022",
"dir": "ltr",
"width": 40.032000000000004,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 109.82,
"y": 509.04,
"str": "MODIFICACION DE SALARIO",
"dir": "ltr",
"width": 109.35199999999998,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 486.43,
"y": 509.04,
"str": "$ 940.68",
"dir": "ltr",
"width": 31.135999999999992,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 340.48,
"y": 529.04,
"str": "01/05/2022",
"dir": "ltr",
"width": 40.032000000000004,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 109.82,
"y": 529.04,
"str": "MODIFICACION DE SALARIO",
"dir": "ltr",
"width": 109.35199999999998,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 484.21,
"y": 529.04,
"str": "$ 1004.97",
"dir": "ltr",
"width": 35.58399999999999,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 340.48,
"y": 549.04,
"str": "01/03/2022",
"dir": "ltr",
"width": 40.032000000000004,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 109.82,
"y": 549.04,
"str": "MODIFICACION DE SALARIO",
"dir": "ltr",
"width": 109.35199999999998,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 486.43,
"y": 549.04,
"str": "$ 940.68",
"dir": "ltr",
"width": 31.135999999999992,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 340.48,
"y": 569.04,
"str": "01/01/2022",
"dir": "ltr",
"width": 40.032000000000004,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 109.82,
"y": 569.04,
"str": "MODIFICACION DE SALARIO",
"dir": "ltr",
"width": 109.35199999999998,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 484.21,
"y": 569.04,
"str": "$ 1085.32",
"dir": "ltr",
"width": 35.58399999999999,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 340.48,
"y": 589.04,
"str": "01/11/2021",
"dir": "ltr",
"width": 40.032000000000004,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 109.82,
"y": 589.04,
"str": "MODIFICACION DE SALARIO",
"dir": "ltr",
"width": 109.35199999999998,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 484.21,
"y": 589.04,
"str": "$ 1074.61",
"dir": "ltr",
"width": 35.58399999999999,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 340.48,
"y": 609.04,
"str": "27/09/2021",
"dir": "ltr",
"width": 40.032000000000004,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 140.5,
"y": 609.04,
"str": "REINGRESO",
"dir": "ltr",
"width": 48.007999999999996,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 486.43,
"y": 609.04,
"str": "$ 940.68",
"dir": "ltr",
"width": 31.135999999999992,
"height": 8,
"fontName": "Helvetica"
},
{
"x": 42,
"y": 629.04,
"str": "/* Valor del último salario base de cotización diario en pesos.",
"dir": "ltr",
"width": 215.64800000000008,
"height": 8,
"fontName": "Helvetica"
},
{},
{
"x": 458,
"y": 702.73,
"str": "Paseo de la Reforma 476, P.B.",
"dir": "ltr",
"width": 82.71000000000002,
"height": 6,
"fontName": "Helvetica"
},
{
"x": 458,
"y": 709.63,
"str": "Col. Juárez, Cuauhtémoc",
"dir": "ltr",
"width": 67.69200000000001,
"height": 6,
"fontName": "Helvetica"
},
{
"x": 458,
"y": 716.52,
"str": "C.P. 06600, Ciudad de México",
"dir": "ltr",
"width": 81.37199999999994,
"height": 6,
"fontName": "Helvetica"
},
{
"x": 458,
"y": 723.42,
"str": "Tel. 01 800 623 23 23",
"dir": "ltr",
"width": 58.37400000000002,
"height": 6,
"fontName": "Helvetica"
},
{
"x": 458,
"y": 730.32,
"str": "http://atencion.contactoimss.com.mx",
"dir": "ltr",
"width": 97.03800000000001,
"height": 6,
"fontName": "Helvetica"
},
{},
{
"x": 458,
"y": 693.6800000000001,
"str": "Contacto:",
"dir": "ltr",
"width": 29.96,
"height": 7,
"fontName": "Helvetica"
},
{},
{
"x": 547.668,
"y": 743.28,
"str": "12",
"dir": "ltr",
"width": 6.672,
"height": 6,
"fontName": "Helvetica"
},
{
"x": 513.98,
"y": 743.28,
"str": "Página 1 de",
"dir": "ltr",
"width": 32.02200000000001,
"height": 6,
"fontName": "Helvetica"
}
]
}
],
"filename": "./Employees/123.pdf"
}
las secciones se repiten por cada empleo que tuvo el usuario del reporte, extraje la informacion del pdf en un JSON con cordenadas x,y, lo cual me permitio obtener la informacion fija, el problema radica en las tablas de cambios de salario, ya que varian para cada usuario y las coordenadas cambian, por lo que no es posible localizarlas por medio de x,y, como puedo obtener esta informacion dinamica.
existe manera de hacer un loop con la informacion para que de manera dinamica extraiga la informacion sin necesidad de usar las coordenadas?
encontre este codigo navegando en internet pero no puedo hacerlo funcionar en el json
var str="This is the number I want +2143334 !, again this is the next number I want +234343443 !, last number I want +76645 !, fininshed";
var m,results = [];
var rx = /want\s*(\+\d+)/g;
while(m=rx.exec(str)) {
results.push(m[1]);
}
console.log(results);