title: how to remove href for "printing" html to PDF?
body: <p>I build HTML pages and I would like to let the user "print" the HTML to a PDF, without embedding the HREF links (because they link to an internal server, and I do not want the readers of the PDF to see these links).</p>
  
  <p>In Chromium, the resulting PDF file embeds the href links.</p>
  
  <p>Is is possible to remove the hrefs via CSS of Javascript?</p>
  
  <p>I tried this:</p>
  
  <pre><code>&lt;a class="no_print" href="javascript:printPreview()"&gt;Print Preview&lt;/a&gt;
  
  &lt;script&gt;
  function printPreview() {
      var aTags = document.getElementsByTagName('a');
      var atl = aTags.length;
      var i;
  
      for (i = 0; i &lt; atl; i++) {
          aTags[i].href = ''; 
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>but is does not work.</p>
  
  <p>-- edit: after the solution was found, here is a complete example --</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;&lt;header&gt;
      &lt;title&gt;x&lt;/title&gt;
      &lt;style&gt;
          @media print { .no_print { display: none; }
      &lt;/style&gt;
      &lt;script&gt;
  function printPreview()
  {
      var aTags = document.getElementsByTagName('a');
      var atl = aTags.length;
      var i;
  
      for (i = 0; i &lt; atl; i++) {
          aTags[i].removeAttribute("href");   
      }
  }
      &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;a class="no_print" href="javascript:printPreview()"&gt;Print Preview&lt;/a&gt;
      &lt;br&gt;
      &lt;a href="http://example.com"&gt;link to somewhere&lt;/a&gt;
      &lt;br&gt;
      &lt;a&gt;anchor but no link&lt;/a&gt;
      &lt;br&gt;
      other text...
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>