コード例 #1
0
ファイル: Form1.cs プロジェクト: AdrianH20/glowing-invention
        private void SavePDF_Click(object sender, EventArgs e)
        {
            string   pdfName;
            PageSize pageSize = new PageSize(567f, 567f);

            pdfName = textBoxPDFName.Text;
            if (!(textBoxPDFName.Text.EndsWith(".pdf")))
            {
                pdfName += ".pdf";
            }



            AppearanceType appearanceType = AppearanceType.Portrait;


            string exportFile = Path.Combine(textBoxOutputPath.Text, pdfName);



            switch (comboBoxPages.Text)
            {
            case "3": imgNumber = 3;  break;

            case "4": imgNumber = 4;  break;

            case "6": imgNumber = 6;  break;
            }

            switch (comboBoxAppearance.Text)
            {
            case "Portrait": appearanceType = AppearanceType.Portrait;      break;

            case "Landscape": appearanceType = AppearanceType.Landscape;    break;

            case "Magic Appearance": appearanceType = AppearanceType.Magic; break;
            }

            switch (comboBoxFormat.Text)
            {
            case "20x20 (cm)":
                pageSize   = new PageSize(583.666f, 583.666f);
                appearance = new Appearance(appearanceType, formats.ElementAt(0), imgNumber); break;

            case "21x30 (cm)":
                pageSize   = new PageSize(594.999f, 849.999f);
                appearance = new Appearance(appearanceType, formats.ElementAt(1), imgNumber); break;

            case "21x15 (cm)":
                pageSize   = new PageSize(594.999f, 425.000f);
                appearance = new Appearance(appearanceType, formats.ElementAt(2), imgNumber); break;
            }


            PDFMaker.createDocument(listImages, appearance, pageSize, exportFile);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: AdrianH20/PDF-Expert-Photo
        private void SavePDF_Click(object sender, EventArgs e)
        {
            string   pdfName;
            PageSize pageSize = new PageSize(567f, 567f);

            pdfName = textBoxPDFName.Text;
            if (!(textBoxPDFName.Text.EndsWith(".pdf")))
            {
                pdfName += ".pdf";
            }

            AppearanceType appearanceType = AppearanceType.Portrait;


            string exportFile = Path.Combine(textBoxOutputPath.Text, pdfName);

            Format format = formats.ElementAt(0);


            switch (comboBoxPages.Text)
            {
            case "3": imgNumber = 3;  break;

            case "4": imgNumber = 4;  break;

            case "6": imgNumber = 6;  break;
            }

            switch (comboBoxAppearance.Text)
            {
            case "Portrait": appearanceType = AppearanceType.Portrait;      break;

            case "Landscape": appearanceType = AppearanceType.Landscape;    break;

            case "Magic Appearance": appearanceType = AppearanceType.Magic; break;
            }

            switch (comboBoxFormat.Text)
            {
            case "20x20 (cm)":
                pageSize   = new PageSize(583.999f, 583.999f);
                format     = formats.ElementAt(0);
                appearance = new Appearance(appearanceType, formats.ElementAt(0), imgNumber); break;

            case "21x30 (cm)":
                pageSize   = new PageSize(611.999f, 867.666f);
                format     = formats.ElementAt(1);
                appearance = new Appearance(appearanceType, formats.ElementAt(1), imgNumber); break;

            case "21x15 (cm)":
                pageSize   = new PageSize(611.999f, 441.999f);
                format     = formats.ElementAt(2);
                appearance = new Appearance(appearanceType, formats.ElementAt(2), imgNumber); break;
            }

            if (checkBoxAppearance.Checked)
            {
                PDFMaker.createDocument(listImages, appearance, pageSize, exportFile, format);
            }
            else
            {
                PDFMaker.createDocument(listImages, appearance, pageSize, exportFile, format, true);
            }


            List <ImageSelection> imagesToDelete = new List <ImageSelection>();

            foreach (ImageSelection garbage in listBoxImageFile.Items)
            {
                imagesToDelete.Add(garbage);
            }

            foreach (ImageSelection imageToDelete in imagesToDelete)
            {
                listBoxImageFile.Items.Remove(imageToDelete);

                foreach (ImageSelection image in listImages)
                {
                    if (image.ToString() == imageToDelete.ToString())
                    {
                        listImages.Remove(image);
                        break;
                    }
                }
            }
            labelNrImages.Text      = "Images :      " + listImages.Count;
            labelFullPages.Text     = "Full Pages : " + (listImages.Count / imgNumber).ToString();
            PDFMaker.setOrientation = false;
        }