title: Extract Subpart of pdf text in r
body: <p>I have a list of .pdf files in a folder for which I want to first access the first two paragraphs of text then store them in .csv file, I'm able to convert the pdf text but not able to extract first two paragraphs.</p>
  <p>This is what I have tried</p>
  <pre><code>setwd(&quot;D/All_PDF_Files&quot;)
  install.packages(&quot;pdftools&quot;)
  install.packages(&quot;qdapRegex&quot;)
  library(pdftools)
  library(qdapRegex)
  All_files=Sys.glob(&quot;*.pdf&quot;)
  txt &lt;- pdf_text(&quot;first.pdf&quot;)
  cat(txt[1])
  rm_between(txt, 'This ', '1. ', extract=TRUE)[[1]]
  </code></pre>
  <p>But this gives me &quot;<strong>NA</strong>&quot;</p>
  <p>The output of <strong>cat(txt[1])</strong> is:</p>
  <pre><code>&quot;Maharashtra Real Estate Regulatory Authority
                                           REGISTRATION CERTIFICATE OF PROJECT
                                                               FORM 'C'
                                                             [See rule 6(a)]
  This registration is granted under section 5 of the Act to the following project under project registration number :
  P52100000255
  Project: Ganga Legend A3 And B3.., Plot Bearing / CTS / Survey / Final Plot No.: Sr No 305 P , 306 P and 339 P ,
  Village Bavdhan Budruk, Taluka Mulashi,District Pune at Pune (M Corp.), Pune City, Pune, 411001;
     1. Goel Ganga Developers (I) Pvt Ltd having its registered office / principal place of business at Tehsil: Pune City,
        District: Pune, Pin: 411001.
     2. This registration is granted subject to the following conditions, namely:­&quot;
  </code></pre>
  <p>What I want to extract is the text</p>
  <pre><code>This registration is granted under section 5 of the Act to the following project under project registration number :
  P52100000255
  Project: Ganga Legend A3 And B3.., Plot Bearing / CTS / Survey / Final Plot No.: Sr No 305 P , 306 P and 339 P ,
  Village Bavdhan Budruk, Taluka Mulashi,District Pune at Pune (M Corp.), Pune City, Pune, 411001;
  </code></pre>
  <p>Is there a better approach to go with?</p>