Click or drag to resize

PDF Portfolios

A PDF portfolio is a PDF file that holds other files - PDF documents, images, office documents, anything - and that PDF viewers show as a list of files. Create and read portfolios with PdfPortfolioManager.

Creating a portfolio
using ExpertPdf.Anywhere.PDFPortfolio;

PdfPortfolioManager portfolio = new PdfPortfolioManager();

PortfolioFile contract = new PortfolioFile("contract.pdf");
contract.Description = "The signed contract";
portfolio.Files.Add(contract);
portfolio.Files.Add(new PortfolioFile("prices.xlsx"));

// how the viewer lists the files, and the file it opens first
portfolio.ViewMode = PortfolioViewMode.Details;
portfolio.StartupFileName = "contract.pdf";

portfolio.Save("package.pdf");
portfolio.Close();

A file can also come from bytes or a stream, with the name it has in the portfolio: new PortfolioFile("data.csv", bytes).

Reading a portfolio
PdfPortfolioManager portfolio = new PdfPortfolioManager();
portfolio.Load("package.pdf");
for (int i = 0; i < portfolio.Files.Count; i++)
{
    PortfolioFile file = portfolio.Files[i];
    File.WriteAllBytes(Path.Combine("extracted", file.Name), file.Content);
}
portfolio.Close();
See Also

Other Resources

Document Class