コード例 #1
0
ファイル: Form1.cs プロジェクト: nikeaa/ScriptWrappers
        private void CreateWebVersion(string path, string productCode, bool isVertical, IPsJPEGSaveOptions jpegOptions, IPsDocument jpegDoc, string emblem, out IPsDocument webDoc, out IPsDocument webTemplateDoc)
        {
            // Create the web document.
            webDoc = app.Documents.Add(WEB_DOC_WIDTH, WEB_DOC_HEIGHT, WEB_DOC_RESOLUTION, "Web Doc", EPsDocumentMode.psRGB);
            //app.ActiveDocument = webDoc;

            // Get the web template background.
            string webTemplateFileName = getWebTemplateFileName(TemplatePathTextBox.Text, productCode);

            webTemplateDoc     = app.Open(TemplatePathTextBox.Text + "\\" + webTemplateFileName);
            app.ActiveDocument = webTemplateDoc;

            IPsDocument logoBadgeDoc = app.Open(TemplatePathTextBox.Text + "\\Logo Badge.psd");

            logoBadgeDoc.Selection.SelectAll();
            logoBadgeDoc.Selection.Copy(true);
            app.ActiveDocument = webTemplateDoc;
            webTemplateDoc.Paste(false);
            webTemplateDoc.ActiveLayer.Translate(-940, -690);
            logoBadgeDoc.Close(EPsSaveOptions.psDoNotSaveChanges);

            if (emblem == "No Editable")
            {
                IPsDocument optionsBadgeDoc = app.Open(TemplatePathTextBox.Text + "\\Options Badge.psd");
                optionsBadgeDoc.Selection.SelectAll();
                optionsBadgeDoc.Selection.Copy(true);
                app.ActiveDocument = webTemplateDoc;
                webTemplateDoc.Paste(false);
                webTemplateDoc.ActiveLayer.Translate(-940, 670);
                optionsBadgeDoc.Close(EPsSaveOptions.psDoNotSaveChanges);
            }

            //IPsArtLayer editableLayer = webTemplateDoc.ArtLayers.GetAllByName("editable").FirstOrDefault();
            //IPsArtLayer noEditableLayer = webTemplateDoc.ArtLayers.GetAllByName("No editable").FirstOrDefault();
            //switch (emblem)
            //{
            //	case "None":
            //		if (editableLayer != null) editableLayer.Visible = false;
            //		if (noEditableLayer != null) noEditableLayer.Visible = false;
            //		break;
            //	case "No Editable":
            //		if (editableLayer != null) editableLayer.Visible = false;
            //		break;
            //	case "With Editable":
            //		if (noEditableLayer != null) noEditableLayer.Visible = false;
            //		break;
            //}

            //webTemplateDoc.MergeVisibleLayers();
            app.ActiveDocument = webTemplateDoc;
            webTemplateDoc.ResizeImage(WEB_DOC_WIDTH, WEB_DOC_HEIGHT, EPsResampleMethod.psAutomatic);
            webTemplateDoc.Selection.SelectAll();
            webTemplateDoc.Selection.Copy(true);
            app.ActiveDocument = webDoc;
            webDoc.Paste(false);

            if (isVertical)
            {
                webDoc = addWrapperToVerticalTemplate(webTemplateDoc, jpegDoc, webDoc);
            }
            else
            {
                webDoc = addWrapperToHorizontalTemplate(webTemplateDoc, jpegDoc, webDoc);
            }

            // Save the web JPEG.
            string webFileName = path + "\\" + productCode + "_web.jpg";

            webDoc.SaveAs(webFileName, jpegOptions, false);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: nikeaa/ScriptWrappers
        private void CreateTwoUpVersion(IPsDocument doc, string path, string productCode, IPsJPEGSaveOptions jpegOptions, string jpegFileName, out IPsDocument twoUpDoc, out IPsDocument jpegDoc)
        {
            // Create a document for the two up version.
            twoUpDoc = app.Documents.Add(TWO_UP_DOC_WIDTH, TWO_UP_DOC_HEIGHT, TWO_UP_DOC_RESOLUTION, "Two Up", EPsDocumentMode.psRGB);

            app.ActiveDocument = twoUpDoc;

            // Open up the jpg wrapper file.
            jpegDoc            = app.Open(jpegFileName);
            app.ActiveDocument = jpegDoc;
            jpegDoc.Selection.SelectAll();
            jpegDoc.Selection.Copy(false);
            app.ActiveDocument = twoUpDoc;
            IPsArtLayer left = twoUpDoc.ArtLayers.AddNormalLayer("Left");

            twoUpDoc.Paste(false);
            IPsArtLayer right = twoUpDoc.ArtLayers.AddNormalLayer("Right");

            twoUpDoc.Paste(false);

            // Move them to the correct positions.
            left.Translate(-(WIDTH / 2), 0);
            right.Translate(+(WIDTH / 2), 0);

            // Draw vertical cut lines.
            DrawCutLines(twoUpDoc, jpegDoc);

            // Save the two up jpeg.
            string twoUpFileName = path + "\\" + productCode + "_2Up.jpg";

            doc.SaveAs(twoUpFileName, jpegOptions, false);
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: nikeaa/ScriptWrappers
        private void UpdateOriginalDocument(IPsDocument doc, string path, string productCode, bool isVertical, out IPsJPEGSaveOptions jpegOptions, out string jpegFileName)
        {
            AddCompanyName(doc, isVertical);
            AddProductCode(doc, productCode, isVertical);

            // Save the PSD document.
            doc.Save();

            // Save as a JPEG.
            jpegOptions                   = app.CreateJPEGSaveOptions();
            jpegOptions.Quality           = JPEG_QUALITY;
            jpegOptions.EmbedColorProfile = true;
            jpegOptions.FormatOptions     = EPsFormatOptionsType.psStandardBaseline;
            jpegOptions.Matte             = EPsMatteType.psNoMatte;

            jpegFileName = path + "\\" + productCode + ".jpg";
            doc.SaveAs(jpegFileName, jpegOptions, false);
        }