public static bool PrintSingleAssetCodeSheet(
            string assetId, string description, string title = "Single asset code sheet")
        {
            List <CodeSheetItem> codeSheetItems = new List <CodeSheetItem>();

            try
            {
                // all assets
                for (int i = 0; i < 8; i++)
                {
                    var csi = new CodeSheetItem();
                    csi.id          = assetId;
                    csi.code        = (i % 2) == 0 ? "qr" : "dmc";
                    csi.description = description;
                    csi.normSize    = 0.25 * (1 + (i / 2)); // 2 * .25, 2 * .5, ..
                    codeSheetItems.Add(csi);
                }

                // print
                PrintCodeSheet(codeSheetItems.ToArray(), title);
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex.Message, "Disappointment");
                return(false);
            }
            return(true);
        }
        public static bool PrintRepositoryCodeSheet(string repofn, string title = "Asset repository")
        {
            List <CodeSheetItem> codeSheetItems = new List <CodeSheetItem>();

            try
            {
                // load the data
                if (!File.Exists(repofn))
                {
                    return(false);
                }
                var init        = File.ReadAllText(repofn);
                var TheAasxRepo = JsonConvert.DeserializeObject <AasxFileRepository>(init);

                // all assets
                foreach (var fmi in TheAasxRepo.filemaps)
                {
                    var csi = new CodeSheetItem();
                    csi.id          = fmi.assetId;
                    csi.code        = fmi.code;
                    csi.description = fmi.description;
                    csi.normSize    = 1.0; // do not vary
                    codeSheetItems.Add(csi);
                }

                // print
                PrintCodeSheet(codeSheetItems.ToArray(), title);
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex.Message, "Disappointment");
                return(false);
            }
            return(true);
        }
        public static bool PrintRepositoryCodeSheet(
            string repoFn = null, PackageContainerListBase repoDirect = null, string title = "Asset repository")
        {
            List <CodeSheetItem> codeSheetItems = new List <CodeSheetItem>();

            try
            {
                PackageContainerListBase repo = null;

                // load the data
                if (repoFn != null)
                {
                    // from file
                    repo = PackageContainerListLocal.Load <PackageContainerListLocal>(repoFn);
                }

                if (repoDirect != null)
                {
                    // from RAM
                    repo = repoDirect;
                }

                // got something
                if (repo == null)
                {
                    return(false);
                }

                // all assets
                foreach (var fmi in repo.FileMap)
                {
                    if (fmi.AssetIds != null)
                    {
                        foreach (var id in fmi.AssetIds)
                        {
                            var csi = new CodeSheetItem();
                            csi.id          = id;
                            csi.code        = fmi.CodeType2D;
                            csi.description = fmi.Description;
                            csi.normSize    = 1.0; // do not vary
                            codeSheetItems.Add(csi);
                        }
                    }
                }

                // print
                PrintCodeSheet(codeSheetItems.ToArray(), title);
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex.Message, "Print AASX file repository");
                return(false);
            }
            return(true);
        }