title: How can I get PDF dimensions in pixels in Node.js?
body: <p>I tried pdf2json:</p>
  <pre><code>const PDFParser = require(&quot;pdf2json&quot;);
  let pdfParser = new PDFParser();
  
  pdfParser.loadPDF(&quot;./30x40.pdf&quot;); // ex: ./abc.pdf
  
  pdfParser.on(&quot;pdfParser_dataReady&quot;, pdfData =&gt; {
    width = pdfData.formImage.Width; // pdf width
    height = pdfData.formImage.Pages[0].Height; // page height
  
    console.log(`Height : ${height}`) // logs 70.866
    console.log(`Width : ${width}`) // logs 53.15
  });
  </code></pre>
  <p>But it gave the dimensions in a unknown units!</p>
  <p>The dimensions in pixels will help me include them in the pdf-poppler module that converts a pdf file to an image and it needs the pdf file height in pixels.</p>