title: Printing a "tag" with a barcode using reporting services and DB values in asp.net
body: <p>Edit 7 : I finally made it! Posted the answer.</p>
  
  <p>Edit 6 : I scrapped the CSS and div and used a reporting services. Look at edits down the post to see where I am at right now.</p>
  
  <p>I'm at a complete lost right now.<br />
  Sorry if I am not clear enough with my question, I can edit it to add information if needed. I'll try giving as much info as possible.<br/>
  I've searched on google for hours now and havn't find anything to help me.<br />
  <br />
  I am trying to create multiple "tag" using information on a user I have in my database and putting them on a page to print them. Plus, I need only 1 tag per page.<br />
  I got a stored proc that returns to me the username, name and family name as well as an ID I use to generate a barcode for every users in a certain event.<br/></p>
  
  <pre><code>CREATE PROCEDURE Schema.GetAllTags
  @IdEvent int
  AS
  BEGIN
      SELECT  Mem.Nom, Mem.Prenom, Mem.Pseudo, Use.IdUser
  FROM    Schema.User Use
  JOIN    Schema.Member Mem ON Use.IdMember = Mem.IdMember
  WHERE   Use.IdEvent = @IdEvent
  END
  </code></pre>
  
  <p><br/>
  The barcode is generated by calling an asp page and giving it the ID I received from my stored proc in the page parameter. The asp page is an image that I use to show my barcode in other pages.</p>
  
  <p>I tried making the tags using divs, CSS, asp content and all that stuff and it worked... except for the printing part. The tag being resized all the time, the margin not being an inch even tho I tried everything to make it 25.4mm (1 inch) and on top of it, the url of the page always showing in the preview print. All thoses problem could be solved by the client simply from unchecking the show url and setting the margin yourself in the options. But I don't want to force the client to do theses in order to fix the problem. I want it to be 3 by 2 in, with 1 in margin and no url without having to change printing options.</p>
  
  <p>I was told using reporting services would solve my printing problems. But I have no clues how to make what I need out of reporting services (I know what reporting services are mind you)... even less on how to get my barcode in there.</p>
  
  <p>Here what the tag should look like in the end on a print page. 3in x 2in with 1in margin on top and left when printing.</p>
  
  <p><img src="https://i.stack.imgur.com/dvMVC.png" alt="What the tag should look like"></p>
  
  <p>Here the CSS I used to try and print my tag :</p>
  
  <pre><code>&lt;style type="text/css"&gt;
      @page
      {
          margin: 25.4mm 25.4mm 25.4mm 25.4mm;  
      }
  
      @media print 
      {
          body *  
          {
              visibility:hidden;
          }
          #tagPrint, #tagPrint * 
          {
              visibility:visible;
          }
          #tagPrint
          {
              position:fixed;
              top: 0px;
              left: 0px;
          }
          #NOPRINT
          {
              display:none;
          }
      }
  </code></pre>
  
  <p>And here the asp (That is for my page with only 1 tag showing) :</p>
  
  <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" &gt;
      &lt;ContentTemplate&gt;
          &lt;div id="tag" class="formRow"&gt;
              &lt;div id="tagPrint" style="border:1px solid;width:76.2mm;height:50.8mm"&gt;
                  &lt;p style="text-align:center" /&gt;
                  &lt;br /&gt;
                  &lt;asp:Label ID="lblUserTag" runat="server" style="font-weight:bold;font-size:18px" /&gt;
                  &lt;br /&gt;
                  &lt;asp:Label ID="lblFullNameTag" runat="server" style="font-weight:bold;font-size:16px" /&gt;
                  &lt;br /&gt;
                  &lt;br /&gt;
                  &lt;asp:Image ID="imgBarcodeTag" runat="server" /&gt;
                  &lt;br /&gt;
                  &lt;asp:Label ID="lblIdTag" runat="server" style="font-weight:bold;font-size:16px" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;/ContentTemplate&gt;
      &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>Currently generating my tags using a repeater on my page to generate multiple tags and binding the dataset.tables[0].Rows to the repeater. Allowing me to create thoses tags.</p>
  
  <p>Is there any ways to do it without reporting services using only javascript and CSS?
  Is it doable with reporting services (Using an asp page in a reporting service to make a barcode)? Since my barcode come from a font, is there any other way then adding the font on the compiter in order to use it in reporting services? (I don't want the client to have to install the font) Would making a pdf of the tag easier/better?</p>
  
  <p>Edit : Started working around with a report service.
  Right now I got the report made with 4 parameter. (Username, full name, barcode url and the ID)
  I'll give update on what happens next.</p>
  
  <p>Edit 2 : So... after managing to make a report service and showing it in the page. I can't seem to get my image to show on the report. And even if I did. I don't know how to make multiple page on the report or how to print it.
  I decided to try making my Div Tag in PDF instead and try to print it that way. I'll update tomorrow when I get the chance to try it.</p>
  
  <p>Edit 3 : Aside from wanting to smash my head on a wall several times, I tried doing it in PDF and it's not working. Found out it can probably be done in flash, but I do not want to do it in flash. So I'm back to the report service.
  I made a report service with a grid where I send my dataset to the grid and put the datas in each fields. I installed the font to be able to use it in the report. Now I can't seem to bind my dataset to the report. I tried an SqlDataSource and ObjectDataSource and nothing seems to work. I started another report in a new project to try from scrap. Maybe something from my current project is playing against me.
  I'm about to give up. -_-</p>
  
  <p>Edit 4 : I finally made it to get something working. Got my report on my page working just fine.</p>
  
  <p><img src="https://i.stack.imgur.com/c0oNM.png" alt="Report service"></p>
  
  <p><img src="https://i.stack.imgur.com/qgzAU.png" alt="Result"></p>
  
  <p>Now only thing I have left to do... is manage to get the report to have multiple page.</p>
  
  <p>Edit 5 : Rereading my edits and I realized I forgot to say that slightly after edit 2, I scrapped the parameters stuff and used a dataset instead. Also, I scrapped everything about CSS and the div to use a reporting service to save a PDF file of the tags.</p>