/** * Sets the barcode inside this cell. * * @param barCode the barcode. */ public void SetBarcode(BarCode barCode) { this.barCode = barCode; }
/// <summary> /// Populate a voter card with the information of a given voter. /// </summary> /// <param name="page">The page containing the card.</param> /// <param name="pdf">The pdf containing the page.</param> /// <param name="xO">The horizontal offset of the card in points.</param> /// <param name="yO">The vertical offset of the card in points.</param> /// <param name="voter">The voter whose information to be populated onto the card.</param> private static void PopulateCard(Page page, PDF pdf, double xO, double yO, VoterDO voter) { // ----- POPULATE: POLLING STATION ----- PollingStationDO ps = voter.PollingStation; var font = new Font(pdf, CoreFont.HELVETICA); font.SetSize(9); var t = new TextLine(font, ps.Name); t.SetPosition(xO + 9 * U, yO + 27.5 * U); t.DrawOn(page); t = new TextLine(font, ps.Address); t.SetPosition(xO + 9 * U, yO + 32 * U); t.DrawOn(page); t = new TextLine(font, "valgfrit"); t.SetPosition(xO + 29 * U, yO + 48.8 * U); t.DrawOn(page); t = new TextLine(font, "02-04861"); t.SetPosition(xO + 29 * U, yO + 58.7 * U); t.DrawOn(page); t = new TextLine(font, "09:00 - 20:00"); t.SetPosition(xO + 29 * U, yO + 68.2 * U); t.DrawOn(page); // ----- POPULATE: VOTER ----- MunicipalityDO mun = voter.PollingStation.Municipality; font = new Font(pdf, CoreFont.COURIER); font.SetSize(10); // Add top voter number 'Vælgernr.' t = new TextLine(font, "02-04861"); t.SetPosition(xO + 102 * U, yO + 12 * U); t.DrawOn(page); // Add sender 'Afsender' t = new TextLine(font, mun.Name); t.SetPosition(xO + 102 * U, yO + 32.5 * U); t.DrawOn(page); t = new TextLine(font, mun.Address); t.SetPosition(xO + 102 * U, yO + 36.5 * U); t.DrawOn(page); t = new TextLine(font, mun.City); t.SetPosition(xO + 102 * U, yO + 40.5 * U); t.DrawOn(page); // Add reciever 'Modtager' t = new TextLine(font, voter.Name); t.SetPosition(xO + 102 * U, yO + 62.5 * U); t.DrawOn(page); t = new TextLine(font, voter.Address); t.SetPosition(xO + 102 * U, yO + 66.5 * U); t.DrawOn(page); t = new TextLine(font, voter.City); t.SetPosition(xO + 102 * U, yO + 70.5 * U); t.DrawOn(page); // Add CPR barcode string barcode = BarCodeHashing.Hash(voter.PrimaryKey.Value).ToString(); var b = new BarCode(BarCode.CODE128, barcode); b.SetPosition(xO + 160 * U, yO + 60 * U); b.DrawOn(page); t = new TextLine(font, barcode); t.SetPosition(xO + 160 * U, yO + 72 * U); t.DrawOn(page); }