title: Dynamically add Keywords to PDF creating via Crystal Reports template before it became PDF using C#
body: <p>I'm going for advice.
  We use Crystal Reports templates to generate PDF files - to view in browser, also to save them physically to disc. Project is created in C#, MVC. <strong>I have an issue with adding <em>Keywords</em> meta into PDF file</strong>.</p>
  <p>There is method that returns Stream data, in this method I create <code>var report = new ReportDocument()</code>, then load .rpt template and fill it with data like <code>report.SetDataSource(mydata)</code>. After filling data I want to set <code>SummaryInfo</code>. I found it has <code>KeywordsInReport</code> prop, so I set it to some string and I can see in debug it is filled. Method returns Stream and on Controller just &quot;create&quot; PDF to view as <code>File(stream, type)</code>,this file is only in browser.</p>
  <p>PDF is created correctly, but when I download it from browser, Keywords are missing. Found I have to use <code>report.Refresh()</code> and <code>report.SaveAs()</code> after <code>report.SummaryInfo.KeywordsInReport</code> is set. In my case this is useless, becuase this &quot;saveAs&quot; make changes in .rpt file, but I need keywords in pdf file which is final.
  Try get data on Controller from pdf and change them that is too late in code. I need add them much earlier.</p>
  <p>Also is not possible create PDF, save it to disc, load it, change meta and save again. Through this method can be generated many files at the same time and it is not appropriate to save every pdf file twice on disc.</p>
  <p>Is there some solution how to add Keywords meta into PDF file dynamically before PDF is created? When it is just only &quot;report class&quot; but move somehow Keywords data into PDF...</p>
  <p>Code looks something like this - Creating report, fill with data, make as Stream:</p>
  <pre><code>public Stream Blabla(someparams)
  {
      var report = new ReportDocument();
      report.Load(&quot;pathToCrystalReportTemplate.rpt&quot;); //&lt;-- Load my rpt template created in Crystal Reports
      
      var myData = somethingWhatTakeDataForReport;
      report.SetDataSource(myData); //&lt;-- set data into report
      
      report.SummaryInfo.KeywordsInReport = &quot;asdf;asdf;asdf;&quot;; //&lt;--Here I want set my Keywords, these will be dynamical based on myData or what I want.. Not static.
      report.Refresh(); //&lt;-- not sure if this is necessary 
      report.SaveAs(report.FileName); //&lt;-- this save loaded rpt, but I don't want to make changes in .rpt! and this make changes in .rpt :(
      //...
      
      return report.ExportToStream(ExportFormatType.PortableDocFormat); //&lt;-- this must stay like it is.
  
      //.....
  }
  </code></pre>
  <p>Many thanks everyone who help :)</p>