桌面产品:

加工自动化:

软件开发:

 
PDF to Word 转换器 客户
 

Solid Framework Code Sample

This is a concise sample to help get started with Solid Framework SDK

Combine Multiple PDF Files to a Single PDF File

In this tutorial we show you how to combine multiple PDF pages to a single PDF file.

Combine Multiple PDF Files to a Single PDF File

点击播放“密码演示视频”

Steps for Combining Multiple PDF Files

  1. Import the trial Developer License:


    License.Import(new StreamReader(@"C:\Users\Joe\license.xml"));

  2. Allow multi selection of only PDF files using OpenFileDialog:


    // Create a Open File Dialog that allows you to select multiple files
    OpenFileDialog OpFile = new OpenFileDialog();
    OpFile.Multiselect = true;

    //show only PDF Files
    OpFile.Filter = "PDF Files (*.pdf)|*.pdf";

    //Do nothing if someone clicks on cancel
    if (OpFile.ShowDialog() != System.Windows.Forms.DialogResult.OK)
    {
    ...

  3. Create a new Solid Framework PagesModel Object:


    //create a new pages model object
    using (PagesModel model = new PagesModel())
    {

  4. Open the selected files with the new model:


    //create a IPageSource for the selected files then add each of the files to one source
    foreach (string filename in OpFile.FileNames)
    {
      // For each file add it to a source and collate them
      SolidFramework.Model.Pdf.Pages.IPageSource source = model.CreateSource(filename);
      model.Insert(model.PageCount, source);
    }

  5. For Each file selected add it to a new source and insert them into a single file:


      // save the new combined file
      model.Save(@"C:\Users\nelson\Documents\combined_pdf.pdf");
    }
    ...

 


网站导航
©2000-2017 Solid Documents Limited - 版权所有