Export Measurements to Excel

How can we allow our customers to export an Excel list of the Measurements taken within PDF.js Express?

Our customers are construction contractors and they use the Measurement tool to measure blueprints. They want to get the measurement numbers out of PDF.js and into Excel so that they can use them in other systems. Exporting the area and comment would be a great start. If the user was able to assign an area name (kitchen, master bath, etc) to the measured area, that would be VERY cool.

It was suggested that I post this on the forum but I do not know if it exist already (Technical Support) or not possible (Feature Request).

Thanks in advance.
Steve

Hello, Iā€™m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hey!

We do not have a native API to export annotations as XLSX, but it is easily doable with a tiny bit of work on your end.

You can use Express APIs to export all of the measurement annotations and their replies. Here is some sample code to get you started,

  const annots = await instance.Core.annotationManager.getAnnotationsList();

 // Filter out any annotations without a measurement dict
  const measurementAnnots = annots.filter((annot) => {
    return !!annot.Measure;
  })

  for(const measurement of measurementAnnots) {
    console.log(measurement.Measure)

    const replies = annots.filter(annot => annot.InReplyTo === measurement.Id)
    console.log(replies)
  }

You can take a look at what is logged and see what information is available to you.

With that data, you can use a library such as ExcelJS to generate the spreadsheet to your liking.

Let me know if you need any additional help.

Thanks,
Logan