Exemple #1
0
        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);
        }
Exemple #2
0
        private IPsArtLayer AddJpegAreaToWebDoc(IPsDocument jpegDoc, IPsDocument webDoc, int x, int y, int width, int height, int translateX, int translateY, bool applyBevel)
        {
            app.ActiveDocument = jpegDoc;
            jpegDoc.Selection.Select(new Rectangle(new Point(x, y), new Size(new Point(width, height))));
            jpegDoc.Selection.Copy(false);

            // Add to the template, resize, and place.
            app.ActiveDocument = webDoc;
            webDoc.Paste(false);

            if (applyBevel)
            {
                IPsLayerStyle       layerStyle = app.CreateLayerStyle();
                IPsBevelEmbossStyle bevelStyle = layerStyle.AddBevelEmbossStyle();
                bevelStyle.Size = 20;
                webDoc.ActiveLayer.ArtLayer.ApplyLayerStyle(layerStyle);
            }

            //webDoc.ActiveLayer.Resize(634 / 800 * 100, 1520 / 1600 * 100, EPsAnchorPosition.psTopLeft);
            webDoc.ActiveLayer.Translate(translateX, translateY);

            return((IPsArtLayer)webDoc.ActiveLayer);
        }
Exemple #3
0
        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);
        }