Exemple #1
0
        doIt(recordEntry entry)
        {
            toolStripStatusLabel1.Text = done + " done of " + count + " - current entry: " + entry.Name;
            //foreach (ps.Document item in app.Documents)
            //item.Close();
            //app.Open(@"C:\Users\Kesava for VS\Documents\Untitled-1.psd");
            //app.ActiveDocument.ArtLayers.Add();
            closeAll();
            switch (entry.Desg)
            {
            case "coordinator":
                app.Open(TemplatePath + "\\coordinator.psd");
                break;

            case "volunteer":
                app.Open(TemplatePath + "\\volunteer.psd");
                break;

            default:
                MessageBox.Show("Undefined Designation. Please check csv. Errors are emminent.", "Error", MessageBoxButtons.OK);
                break;
            }
            foreach (ps.ArtLayer item in app.ActiveDocument.Layers)
            {
                if (item.Kind == ps.PsLayerKind.psTextLayer)
                {
                    item.TextItem.Contents = entry.Name;
                }
            }
            app.Open(imagePath + "\\" + entry.Id);
            var y = app.Documents;

            app.ActiveDocument = app.Documents[2];
            var test = app.ActiveDocument.Name;

            app.ActiveDocument.ArtLayers[1].Copy();
            app.ActiveDocument             = app.Documents[1];
            app.ActiveDocument.ActiveLayer = app.ActiveDocument.ArtLayers[app.ActiveDocument.ArtLayers.Count];
            app.ActiveDocument.Paste();
            //Add JPG in future
            //var saveOptions = new ps.JPEGSaveOptions();
            //saveOptions.EmbedColorProfile = true;
            //saveOptions.FormatOptions = ps.PsFormatOptionsType.psStandardBaseline;
            //saveOptions.Matte = ps.PsMatteType.psNoMatte;
            //saveOptions.Quality = 10;
            app.ActiveDocument.SaveAs(outputPath + "\\" + entry.Id + ".psd", new ps.PhotoshopSaveOptions(), true);
            toolStripProgressBar1.Value++;
            done++;
        }
        private Document OpenDocument(string sFile) // Page 29
        {
            Document docRef = appRef.Open(sFile);

            return(docRef);
        }