Example #1
0
        private void AddCompanyName(IPsDocument doc, bool isVertical)
        {
            // Select and delete existing company name/number layers.
            try
            {
                var layers = doc.ArtLayers.GetAllByName("Company Name/Number");
                foreach (IPsArtLayer layer in layers)
                {
                    layer.Delete();
                }
            }
            catch { }

            // Add the company name text.
            IPsArtLayer companyNameText = doc.ArtLayers.AddTextLayer("Company Name/Number");

            companyNameText.TextItem.Contents = "Nikeaa Design, LLC - 319-538-1167";
            companyNameText.TextItem.Size     = COMPANY_NAME_FONT_SIZE;
            if (isVertical)
            {
                companyNameText.Rotate(-90, EPsAnchorPosition.psMiddleCenter);
                companyNameText.TextItem.Position = new PointF(WIDTH - 20, (HEIGHT + 400) / 2);
            }
            else
            {
                companyNameText.TextItem.Position = new PointF((WIDTH - 400) / 2, HEIGHT - 20);
            }
        }
Example #2
0
        private void AddProductCode(IPsDocument doc, string productCode, bool isVertical)
        {
            // Select and delete existing product code layers.
            try
            {
                var layers = doc.ArtLayers.GetAllByName("Product Code");
                foreach (IPsArtLayer layer in layers)
                {
                    layer.Delete();
                }
            }
            catch { }

            // Add the product code text.
            IPsArtLayer productCodeText = doc.ArtLayers.AddTextLayer("Product Code");

            productCodeText.TextItem.Contents = productCode;
            productCodeText.TextItem.Size     = PRODUCT_CODE_FONT_SIZE;
            productCodeText.TextItem.FauxBold = true;

            // Move the company name and product code to the proper positions
            // depending on if the wrapper is a horizontal or vertical wrapper.
            if (isVertical)
            {
                productCodeText.Rotate(-90, EPsAnchorPosition.psMiddleCenter);
                productCodeText.TextItem.Position = new PointF(WIDTH - 20, 200);
            }
            else
            {
                productCodeText.TextItem.Position = new PointF(WIDTH - 200, HEIGHT - 20);
            }
        }
Example #3
0
        private IPsDocument addWrapperToVerticalTemplate(IPsDocument webTemplateDoc, IPsDocument jpegDoc, IPsDocument webDoc)
        {
            webTemplateDoc.RotateCanvas(90);

            app.ActiveDocument = webDoc;

            // Build the front of the wrapper, with ends.
            IPsArtLayer frontLayer = webDoc.ArtLayers.AddNormalLayer("Front");
            IPsArtLayer front      = AddJpegAreaToWebDoc(jpegDoc, webDoc, VERTICAL_FRONT_X, VERTICAL_FRONT_Y, VERTICAL_FRONT_WIDTH, VERTICAL_FRONT_HEIGHT, VERTICAL_TRANSLATE_X, VERTICAL_TRANSLATE_FRONT_Y, true);

            IPsArtLayer frontLeftEndLayer = webDoc.ArtLayers.AddNormalLayer("Front Left End");

            DrawFilledRectangle(webDoc, 471, 135, 1121, 185, "Front Left End");

            IPsArtLayer frontRightEndLayer = webDoc.ArtLayers.AddNormalLayer("Front Right End");

            DrawFilledRectangle(webDoc, 471, 1750, 1121, 1800, "Front Right End");

            List <IPsLayer> layersToMerge = new List <IPsLayer>();

            layersToMerge.Add(frontLeftEndLayer);
            layersToMerge.Add(front);
            IPsArtLayer frontMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);

            layersToMerge.Clear();
            layersToMerge.Add(frontRightEndLayer);
            layersToMerge.Add(frontMerged);
            frontMerged      = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            frontMerged.Name = "Front";

            IPsArtLayer back1 = AddJpegAreaToWebDoc(jpegDoc, webDoc, VERTICAL_BACK_BOTTOM_X, VERTICAL_BACK_BOTTOM_Y, VERTICAL_BACK_BOTTOM_WIDTH, VERTICAL_BACK_BOTTOM_HEIGHT, VERTICAL_TRANSLATE_BACK_BOTTOM_Y, VERTICAL_TRANSLATE_FRONT_Y, false);
            IPsArtLayer back2 = AddJpegAreaToWebDoc(jpegDoc, webDoc, VERTICAL_BACK_TOP_X, VERTICAL_BACK_TOP_Y, VERTICAL_BACK_TOP_WIDTH, VERTICAL_BACK_TOP_HEIGHT, VERTICAL_TRANSLATE_BACK_TOP_Y, VERTICAL_TRANSLATE_FRONT_Y, false);

            layersToMerge.Clear();
            layersToMerge.Add(back1);
            layersToMerge.Add(back2);
            IPsArtLayer backMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);

            backMerged.Name = "Back";

            IPsLayerStyle       layerStyle = app.CreateLayerStyle();
            IPsBevelEmbossStyle bevelStyle = layerStyle.AddBevelEmbossStyle();

            bevelStyle.Size = 20;
            backMerged.ApplyLayerStyle(layerStyle);

            IPsArtLayer backLeftEndLayer = webDoc.ArtLayers.AddNormalLayer("Back Left End");

            DrawFilledRectangle(webDoc, 1329, 135, 1962, 185, "Back Left End");

            IPsArtLayer backRightEndLayer = webDoc.ArtLayers.AddNormalLayer("Back Right End");

            DrawFilledRectangle(webDoc, 1329, 1750, 1962, 1800, "Back Right End");

            layersToMerge.Clear();
            layersToMerge.Add(backLeftEndLayer);
            layersToMerge.Add(backMerged);
            backMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            layersToMerge.Clear();
            layersToMerge.Add(backRightEndLayer);
            layersToMerge.Add(backMerged);
            backMerged      = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            backMerged.Name = "Back";

            backMerged.Rotate(15.0, EPsAnchorPosition.psBottomRight);

            backMerged.MoveAfter(frontMerged);
            backMerged.Translate(-440, 120);

            return(webDoc);
        }
Example #4
0
        private IPsDocument addWrapperToHorizontalTemplate(IPsDocument webTemplateDoc, IPsDocument jpegDoc, IPsDocument webDoc)
        {
            webTemplateDoc.RotateCanvas(90);

            app.ActiveDocument = webDoc;

            // Build the front of the wrapper, with ends.
            IPsArtLayer frontLeftEndLayer = webDoc.ArtLayers.AddNormalLayer("Front Left End");

            DrawFilledRectangle(webDoc, 360, 363, 410, 1007, "Front Left End");

            IPsArtLayer frontRightEndLayer = webDoc.ArtLayers.AddNormalLayer("Front Right End");

            DrawFilledRectangle(webDoc, 1985, 363, 2035, 1007, "Front Right End");

            IPsArtLayer frontLayer = webDoc.ArtLayers.AddNormalLayer("Front");
            IPsArtLayer front      = AddJpegAreaToWebDoc(jpegDoc, webDoc, HORIZONTAL_FRONT_X, HORIZONTAL_FRONT_Y, HORIZONTAL_FRONT_WIDTH, HORIZONTAL_FRONT_HEIGHT, HORIZONTAL_TRANSLATE_X, HORIZONTAL_TRANSLATE_FRONT_Y, true);

            List <IPsLayer> layersToMerge = new List <IPsLayer>();

            layersToMerge.Add(frontLeftEndLayer);
            layersToMerge.Add(front);
            IPsArtLayer frontMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);

            layersToMerge.Clear();
            layersToMerge.Add(frontRightEndLayer);
            layersToMerge.Add(frontMerged);
            frontMerged      = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            frontMerged.Name = "Front";

            // Build the back of the wrapper, with ends.
            IPsArtLayer back1 = AddJpegAreaToWebDoc(jpegDoc, webDoc, HORIZONTAL_BACK_BOTTOM_X, HORIZONTAL_BACK_BOTTOM_Y, HORIZONTAL_BACK_BOTTOM_WIDTH, HORIZONTAL_BACK_BOTTOM_HEIGHT, HORIZONTAL_TRANSLATE_X, HORIZONTAL_TRANSLATE_BACK_BOTTOM_Y, false);
            IPsArtLayer back2 = AddJpegAreaToWebDoc(jpegDoc, webDoc, HORIZONTAL_BACK_TOP_X, HORIZONTAL_BACK_TOP_Y, HORIZONTAL_BACK_TOP_WIDTH, HORIZONTAL_BACK_TOP_HEIGHT, HORIZONTAL_TRANSLATE_X, HORIZONTAL_TRANSLATE_BACK_TOP_Y, false);

            // Merge the two back pieces.
            layersToMerge.Clear();
            layersToMerge.Add(back1);
            layersToMerge.Add(back2);
            IPsArtLayer backMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);

            backMerged.Name = "Back";

            IPsLayerStyle       layerStyle = app.CreateLayerStyle();
            IPsBevelEmbossStyle bevelStyle = layerStyle.AddBevelEmbossStyle();

            bevelStyle.Size = 20;
            backMerged.ApplyLayerStyle(layerStyle);

            IPsArtLayer backLeftEndLayer = webDoc.ArtLayers.AddNormalLayer("Back Left End");

            DrawFilledRectangle(webDoc, 360, 1094, 410, 1738, "Back Left End");

            IPsArtLayer backRightEndLayer = webDoc.ArtLayers.AddNormalLayer("Back Right End");

            DrawFilledRectangle(webDoc, 1985, 1094, 2035, 1738, "Back Right End");

            layersToMerge.Clear();
            layersToMerge.Add(backLeftEndLayer);
            layersToMerge.Add(backMerged);
            backMerged = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            layersToMerge.Clear();
            layersToMerge.Add(backRightEndLayer);
            layersToMerge.Add(backMerged);
            backMerged      = (IPsArtLayer)webDoc.MergeLayers(layersToMerge);
            backMerged.Name = "Back";

            backMerged.Rotate(15.0, EPsAnchorPosition.psBottomRight);

            backMerged.MoveAfter(frontMerged);
            backMerged.Translate(-140, 0);

            return(webDoc);
        }