public void CheckAddressLabel() { QslEngine.PdfEngine pdfe = new PdfEngine (new LayoutAvery7160(), "M0VFC", 0); for (int i = 0; i < 23; i++) pdfe.AddAddressLabel(new Address { Callsign = "M0VFC", Name = "Robert Chipperfield", AddressLines = new[] { "12", "Some street", "Some village", "Some town", "County", "Country"}}); pdfe.PrintDocument(@"C:\temp\addresslabel.pdf"); }
private void ImportClubLog(object sender, EventArgs e) { PdfEngine addressLabelEngine = new PdfEngine (new LayoutAvery7160(), m_OurCallsign.Text, (int)m_LabelOffset.Value); ClubLogCSVHandler csvHandler = new ClubLogCSVHandler (m_ContactStore, addressLabelEngine); ClubLogQslAdifHandler adifHandler = new ClubLogQslAdifHandler(m_ContactStore, addressLabelEngine); string importPath; using (OpenFileDialog ofd = new OpenFileDialog ()) { ofd.Filter = "Club Log OQRS Files (*.csv, *.adi)|*.csv;*.adi"; DialogResult dr = ofd.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK) return; importPath = ofd.FileName; } int labelsToPrint; if (importPath.EndsWith(".csv", StringComparison.InvariantCultureIgnoreCase)) labelsToPrint = csvHandler.ProcessFile(importPath); else labelsToPrint = adifHandler.ProcessFile(importPath); if (labelsToPrint > 0) addressLabelEngine.PrintDocument(Path.Combine(m_OutputPath.Text, string.Format("Address-{0}-{1}.pdf", m_OurCallsign.Text.Replace('/', '_'), DateTime.UtcNow.ToString("yyyy-MM-dd-HHmm")))); else MessageBox.Show("No address labels to print"); UpdateLabelsUsed(); }
private void m_PrintQueuedCards_Click(object sender, EventArgs e) { string myCall = m_SelectedSource.Callsign; PdfEngine engine = new PdfEngine(m_PageLayout, myCall, (int)m_LabelOffset.Value); var contactsToPrint = m_ContactStore.GetContactsToQsl(m_SelectedSource.SourceID, m_QslMethod.Text); if (contactsToPrint.Count == 0) { MessageBox.Show("No QSOs to print"); } else { var contactsByCallsign = contactsToPrint.GroupBy(c => c.Callsign).Select(g => g.ToList()).ToList(); // Sort according to the QSL method we're using switch (m_QslMethod.Text) { case "Bureau": contactsByCallsign.Sort(new BureauSorter(contactsToPrint.Select(c => c.Callsign).Distinct()).Sort); break; case "Direct": contactsByCallsign.Sort(DirectSorter); break; default: throw new ArgumentOutOfRangeException("Unknown QSL method: " + m_QslMethod.Text); } foreach (List<Contact> contacts in contactsByCallsign) { var contactsByLocation = contacts.GroupBy(c => c.LocationID); foreach (var oneLocation in contactsByLocation) { Location l = m_ContactStore.LoadLocation(oneLocation.Key); LabelEntry labelEntry = new LabelEntry { Callsign = contacts[0].Callsign, MyCall = myCall }; if (l != null) { labelEntry.Location = l; engine.PrintFooter = true; } else { engine.PrintFooter = false; } engine.AddQSOs(labelEntry, oneLocation.ToList()); } } engine.PrintDocument(Path.Combine(m_OutputPath.Text, string.Format("QSL-{0}-{1}.pdf", myCall.Replace('/', '_'), DateTime.UtcNow.ToString("yyyy-MM-dd-HHmm")))); m_ContactStore.MarkQslsSent(contactsToPrint); m_LabelsUsed = 0; } m_TxtCallsign.Focus(); }