using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SelectPdf;

namespace SelectPdf.Samples
{
    public partial class pdf_portfolio : System.Web.UI.Page
    {
        protected void BtnCreatePdf_Click(object sender, EventArgs e)
        {
            // the test files
            string filePdf = Server.MapPath("~/files/doc.pdf");
            string fileHtml = Server.MapPath("~/files/document.html");
            string fileImage = Server.MapPath("~/files/logo.png");

            // instantiate the pdf portfolio manager
            PdfPortfolioManager portfolio = new PdfPortfolioManager();

            // add files to the portfolio
            PdfPortfolioFile pdfFilePdf = new PdfPortfolioFile(filePdf);
            pdfFilePdf.Description = "PDF document";
            portfolio.Files.Add(pdfFilePdf);

            PdfPortfolioFile pdfFileHtml = new PdfPortfolioFile(fileHtml);
            pdfFileHtml.Description = "HTML document";
            portfolio.Files.Add(pdfFileHtml);

            PdfPortfolioFile pdfFileImage = new PdfPortfolioFile(fileImage);
            pdfFileImage.Description = "Image file";
            portfolio.Files.Add(pdfFileImage);

            // set view mode
            portfolio.ViewMode = PdfPortfolioViewMode.Details;

            // set startup file
            portfolio.StartupFileName = "logo.png";

            // save pdf document
            portfolio.Save(Response, false, "Sample.pdf");

            // close pdf document
            portfolio.Close();

        }
    }
}