public void ParseSamplePasses() { var passes = System.IO.Directory.EnumerateFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SamplePasses"), "*.pkpass"); foreach (var file in passes) { PassKit.Parse(file); } }
public void ParseSamplePasses() { var passes = System.IO.Directory.EnumerateFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SamplePasses"), "*.pkpass"); foreach (var file in passes) { var pass = PassKit.Parse(file); var html = pass.ToHtml(); var fileName = Path.GetFileName(file); File.WriteAllText($"D:\\result.{fileName}.html", html); } }
static void Main(string[] args) { var pk = PassKit.Parse(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "costco.pkpass")); Console.WriteLine(pk.Barcode.Message); var cert = new System.Security.Cryptography.X509Certificates.X509Certificate2( Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testpass.p12"), "password"); var outFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testoutput.pkpass"); try { File.Delete(outFile); } catch { } pk.Write(outFile, cert); Console.WriteLine("OK"); }
//////////////////////////////////////////////////////////////////// // Create article's example test PDF document //////////////////////////////////////////////////////////////////// public TicketPdfMaker(string pkpassfile) { pk = PassKit.Parse(pkpassfile); Console.WriteLine(pk.Barcode.Message); }