C#/VB.NET: mesclar documentos PDF
Índice
Instalado via NuGet
PM> Install-Package Spire.PDF
Links Relacionados
Há muitos motivos pelos quais a mesclagem de PDFs pode ser necessária. Por exemplo, mesclar arquivos PDF permite imprimir um único arquivo em vez de enfileirar vários documentos para a impressora. A combinação de arquivos relacionados simplifica o processo de gerenciamento e armazenamento de muitos documentos, reduzindo o número de arquivos a serem pesquisados e organizados. Neste artigo, você aprenderá como mesclar vários documentos PDF em um documento PDF e como combinar as páginas selecionadas de diferentes documentos PDF em um PDF em C# e VB.NET usando Spire.PDF for .NET.
Instalar o Spire.PDF for .NET
Para começar, você precisa adicionar os arquivos DLL incluídos no pacote Spire.PDF for .NET como referências em seu projeto .NET. Os arquivos DLLs podem ser baixados deste link ou instalados via NuGet.
PM> Install-Package Spire.PDF
Mesclar vários PDFs em um único PDF
O Spire.PDF for .NET oferece o método PdfDocument.MergeFiles() para mesclar vários documentos PDF em um único documento. As etapas detalhadas são as seguintes.
- Obtenha os caminhos dos documentos a serem mesclados e armazene-os em uma matriz de strings.
- Chame o método PdfDocument.MergeFiles() para mesclar esses arquivos.
- Salve o resultado em um documento PDF usando o método PdfDocumentBase.Save().
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergePDFs
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Merge these documents and return an object of PdfDocumentBase
PdfDocumentBase doc = PdfDocument.MergeFiles(files);
//Save the result to a PDF file
doc.Save("output.pdf", FileFormat.PDF);
}
}
}

Mescle as páginas selecionadas de PDFs diferentes em um PDF
Spire.PDF for .NET oferece o método PdfDocument.InsertPage() e o método PdfDocument.InsertPageRange() para importar uma página ou um intervalo de páginas de um documento PDF para outro. A seguir estão as etapas para combinar as páginas selecionadas de diferentes documentos PDF em um novo documento PDF.
- Obtenha os caminhos dos documentos de origem e armazene-os em uma matriz de strings.
- Crie uma matriz de PdfDocument e carregue cada documento de origem em um objeto PdfDocument separado.
- Crie outro objeto PdfDocument para gerar um novo documento.
- Insira a página selecionada ou o intervalo de páginas dos documentos de origem no novo documento usando o método PdfDocument.InsertPage() e o método PdfDocument.InsertPageRange().
- Salve o novo documento em um arquivo PDF usando o método PdfDocument.SaveToFile().
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergeSelectedPages
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Create an array of PdfDocument
PdfDocument[] docs = new PdfDocument[files.Length];
//Loop through the documents
for (int i = 0; i < files.Length; i++)
{
//Load a specific document
docs[i] = new PdfDocument(files[i]);
}
//Create a PdfDocument object for generating a new PDF document
PdfDocument doc = new PdfDocument();
//Insert the selected pages from different documents to the new document
doc.InsertPage(docs[0], 0);
doc.InsertPageRange(docs[1], 1,3);
doc.InsertPage(docs[2], 0);
//Save the document to a PDF file
doc.SaveToFile("output.pdf");
}
}
}

Solicitar uma licença temporária
Se você deseja remover a mensagem de avaliação dos documentos gerados ou se livrar das limitações de função, por favor solicite uma licença de teste de 30 dias para você.
C#/VB.NET: слияние PDF-документов
Оглавление
Установлено через NuGet
PM>Установка-Пакет Spire.PDF
Ссылки по теме
Существует множество причин, по которым может потребоваться слияние PDF-файлов. Например, слияние PDF-файлов позволяет распечатать один файл, а не ставить в очередь несколько документов для печати, а объединение связанных файлов упрощает процесс управления и хранения многих документов за счет сокращения количества файлов, которые нужно искать и упорядочивать. В этой статье вы узнаете, как объединить несколько PDF-документов в один PDF-документ и как объединить выбранные страницы из разных PDF-документов в один PDF-файл в C# и VB.NET используяSpire.PDF for .NET.
- Объединение нескольких PDF-файлов в один PDF-файл
- Объединить выбранные страницы разных PDF-файлов в один PDF-файл
Установите Spire.PDF for .NET
Для начала вам нужно добавить файлы DLL, включенные в пакет Spire.PDF for .NET, в качестве ссылок в ваш проект .NET. Файлы DLL можно загрузить с эта ссылка или установлен через NuGet.
PM>Установка-Пакет Spire.PDF
Объединение нескольких PDF-файлов в один PDF-файл
Spire.PDF for .NET предлагает метод PdfDocument.MergeFiles() для объединения нескольких документов PDF в один документ. Подробные шаги следующие.
- Получите пути объединяемых документов и сохраните их в массиве строк.
- Вызовите метод PdfDocument.MergeFiles(), чтобы объединить эти файлы.
- Сохраните результат в PDF-документ с помощью метода PdfDocumentBase.Save().
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergePDFs
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Merge these documents and return an object of PdfDocumentBase
PdfDocumentBase doc = PdfDocument.MergeFiles(files);
//Save the result to a PDF file
doc.Save("output.pdf", FileFormat.PDF);
}
}
}

Объединить выбранные страницы разных PDF-файлов в один PDF-файл
Spire.PDF for .NET предлагает метод PdfDocument.InsertPage() и метод PdfDocument.InsertPageRange() для импорта страницы или диапазона страниц из одного документа PDF в другой. Ниже приведены шаги для объединения выбранных страниц из разных документов PDF в новый документ PDF.
- Получите пути к исходным документам и сохраните их в массиве строк.
- Создайте массив PdfDocument и загрузите каждый исходный документ в отдельный объект PdfDocument.
- Создайте еще один объект PdfDocument для создания нового документа.
- Вставьте выбранную страницу или диапазон страниц исходных документов в новый документ, используя метод PdfDocument.InsertPage() и метод PdfDocument.InsertPageRange().
- Сохраните новый документ в файл PDF с помощью метода PdfDocument.SaveToFile().
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergeSelectedPages
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Create an array of PdfDocument
PdfDocument[] docs = new PdfDocument[files.Length];
//Loop through the documents
for (int i = 0; i < files.Length; i++)
{
//Load a specific document
docs[i] = new PdfDocument(files[i]);
}
//Create a PdfDocument object for generating a new PDF document
PdfDocument doc = new PdfDocument();
//Insert the selected pages from different documents to the new document
doc.InsertPage(docs[0], 0);
doc.InsertPageRange(docs[1], 1,3);
doc.InsertPage(docs[2], 0);
//Save the document to a PDF file
doc.SaveToFile("output.pdf");
}
}
}

Подать заявку на временную лицензию
Если вы хотите удалить оценочное сообщение из сгенерированных документов или избавиться от функциональных ограничений, пожалуйста, запросить 30-дневную пробную лицензию для себя.
C#/VB.NET: PDF-Dokumente zusammenführen
Inhaltsverzeichnis
Über NuGet installiert
PM> Install-Package Spire.PDF
verwandte Links
Es gibt viele Gründe, warum das Zusammenführen von PDFs notwendig sein kann. Durch das Zusammenführen von PDF-Dateien können Sie beispielsweise eine einzelne Datei drucken, anstatt mehrere Dokumente für den Drucker in die Warteschlange stellen zu müssen. Durch das Zusammenführen zusammengehöriger Dateien wird die Verwaltung und Speicherung vieler Dokumente vereinfacht, da die Anzahl der zu durchsuchenden und zu organisierenden Dateien reduziert wird. In diesem Artikel erfahren Sie, wie das geht Mehrere PDF-Dokumente zu einem PDF-Dokument zusammenführen und wie Kombinieren Sie die ausgewählten Seiten aus verschiedenen PDF-Dokumenten zu einem PDF In C# und VB.NET durch Verwendung von Spire.PDF for .NET.
- Führen Sie mehrere PDFs zu einem einzigen PDF zusammen
- Führen Sie die ausgewählten Seiten verschiedener PDFs zu einem PDF zusammen
Installieren Sie Spire.PDF for .NET
Zunächst müssen Sie die im Spire.PDF for .NET-Paket enthaltenen DLL-Dateien als Referenzen in Ihrem .NET-Projekt hinzufügen. Die DLL-Dateien können entweder von heruntergeladen werden dieser Link oder installiert über NuGet.
PM> Install-Package Spire.PDF
Führen Sie mehrere PDFs zu einem einzigen PDF zusammen
Spire.PDF for .NET bietet die Methode PdfDocument.MergeFiles(), um mehrere PDF-Dokumente in einem einzigen Dokument zusammenzuführen. Die detaillierten Schritte sind wie folgt.
- Rufen Sie die Pfade der zusammenzuführenden Dokumente ab und speichern Sie sie in einem String-Array.
- Rufen Sie die Methode PdfDocument.MergeFiles() auf, um diese Dateien zusammenzuführen.
- Speichern Sie das Ergebnis mit der Methode PdfDocumentBase.Save() in einem PDF-Dokument.
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergePDFs
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Merge these documents and return an object of PdfDocumentBase
PdfDocumentBase doc = PdfDocument.MergeFiles(files);
//Save the result to a PDF file
doc.Save("output.pdf", FileFormat.PDF);
}
}
}

Führen Sie die ausgewählten Seiten verschiedener PDFs zu einem PDF zusammen
Spire.PDF for .NET bietet die Methoden PdfDocument.InsertPage() und PdfDocument.InsertPageRange() zum Importieren einer Seite oder eines Seitenbereichs von einem PDF-Dokument in ein anderes. Im Folgenden finden Sie die Schritte zum Zusammenführen der ausgewählten Seiten aus verschiedenen PDF-Dokumenten zu einem neuen PDF-Dokument.
- Rufen Sie die Pfade der Quelldokumente ab und speichern Sie sie in einem String-Array.
- Erstellen Sie ein PdfDocument-Array und laden Sie jedes Quelldokument in ein separates PdfDocument-Objekt.
- Erstellen Sie ein weiteres PdfDocument-Objekt zum Generieren eines neuen Dokuments.
- Fügen Sie die ausgewählte Seite oder den ausgewählten Seitenbereich der Quelldokumente mithilfe der Methoden PdfDocument.InsertPage() und PdfDocument.InsertPageRange() in das neue Dokument ein.
- Speichern Sie das neue Dokument mit der Methode PdfDocument.SaveToFile() in einer PDF-Datei.
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergeSelectedPages
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Create an array of PdfDocument
PdfDocument[] docs = new PdfDocument[files.Length];
//Loop through the documents
for (int i = 0; i < files.Length; i++)
{
//Load a specific document
docs[i] = new PdfDocument(files[i]);
}
//Create a PdfDocument object for generating a new PDF document
PdfDocument doc = new PdfDocument();
//Insert the selected pages from different documents to the new document
doc.InsertPage(docs[0], 0);
doc.InsertPageRange(docs[1], 1,3);
doc.InsertPage(docs[2], 0);
//Save the document to a PDF file
doc.SaveToFile("output.pdf");
}
}
}

Beantragen Sie eine temporäre Lizenz
Wenn Sie die Bewertungsmeldung aus den generierten Dokumenten entfernen oder die Funktionseinschränkungen beseitigen möchten, wenden Sie sich bitte an uns Fordern Sie eine 30-Tage-Testlizenz an für sich selbst.
C#/VB.NET: combinar documentos PDF
Tabla de contenido
Instalado a través de NuGet
PM> Install-Package Spire.PDF
enlaces relacionados
Hay muchas razones por las que puede ser necesario fusionar archivos PDF. Por ejemplo, la combinación de archivos PDF le permite imprimir un solo archivo en lugar de poner en cola varios documentos para la impresora, la combinación de archivos relacionados simplifica el proceso de administración y almacenamiento de muchos documentos al reducir la cantidad de archivos para buscar y organizar. En este artículo, aprenderá cómo combinar varios documentos PDF en un solo documento PDF y como combine las páginas seleccionadas de diferentes documentos PDF en un solo PDF en C# y VB.NET mediante el uso Spire.PDF for .NET.
- Combinar varios archivos PDF en un solo PDF
- Combinar las páginas seleccionadas de diferentes archivos PDF en un solo PDF
Instalar Spire.PDF for .NET
Para empezar, debe agregar los archivos DLL incluidos en el paquete Spire.PDF for .NET como referencias en su proyecto .NET. Los archivos DLL se pueden descargar desde este enlace o instalado a través de NuGet.
PM> Install-Package Spire.PDF
Combinar varios archivos PDF en un solo PDF
Spire.PDF for .NET ofrece el método PdfDocument.MergeFiles() para combinar varios documentos PDF en un solo documento. Los pasos detallados son los siguientes.
- Obtenga las rutas de los documentos que se fusionarán y guárdelas en una matriz de cadenas.
- Llame al método PdfDocument.MergeFiles() para fusionar estos archivos.
- Guarde el resultado en un documento PDF utilizando el método PdfDocumentBase.Save().
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergePDFs
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Merge these documents and return an object of PdfDocumentBase
PdfDocumentBase doc = PdfDocument.MergeFiles(files);
//Save the result to a PDF file
doc.Save("output.pdf", FileFormat.PDF);
}
}
}

Combinar las páginas seleccionadas de diferentes archivos PDF en un solo PDF
Spire.PDF for .NET ofrece el método PdfDocument.InsertPage() y el método PdfDocument.InsertPageRange() para importar una página o un rango de páginas de un documento PDF a otro. Los siguientes son los pasos para combinar las páginas seleccionadas de diferentes documentos PDF en un nuevo documento PDF.
- Obtenga las rutas de los documentos de origen y guárdelas en una matriz de cadenas.
- Cree una matriz de PdfDocument y cargue cada documento de origen en un objeto PdfDocument independiente.
- Cree otro objeto PdfDocument para generar un nuevo documento.
- Inserte la página seleccionada o el rango de páginas de los documentos de origen en el nuevo documento utilizando el método PdfDocument.InsertPage() y el método PdfDocument.InsertPageRange().
- Guarde el nuevo documento en un archivo PDF utilizando el método PdfDocument.SaveToFile().
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergeSelectedPages
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Create an array of PdfDocument
PdfDocument[] docs = new PdfDocument[files.Length];
//Loop through the documents
for (int i = 0; i < files.Length; i++)
{
//Load a specific document
docs[i] = new PdfDocument(files[i]);
}
//Create a PdfDocument object for generating a new PDF document
PdfDocument doc = new PdfDocument();
//Insert the selected pages from different documents to the new document
doc.InsertPage(docs[0], 0);
doc.InsertPageRange(docs[1], 1,3);
doc.InsertPage(docs[2], 0);
//Save the document to a PDF file
doc.SaveToFile("output.pdf");
}
}
}

Solicitar una Licencia Temporal
Si desea eliminar el mensaje de evaluación de los documentos generados o deshacerse de las limitaciones de la función, por favor solicitar una licencia de prueba de 30 días para ti.
C#/VB.NET: PDF 문서 병합
NuGet을 통해 설치됨
PM> Install-Package Spire.PDF
관련된 링크들
PDF 병합이 필요한 이유는 많습니다. 예를 들어, PDF 파일을 병합하면 프린터에 여러 문서를 대기시키는 대신 단일 파일을 인쇄할 수 있으며, 관련 파일을 결합하면 검색하고 구성할 파일 수를 줄여 많은 문서를 관리하고 저장하는 프로세스를 간소화할 수 있습니다. 이 기사에서는 다음을 수행하는 방법을 배웁니다 여러 PDF 문서를 하나의 PDF 문서로 병합 그리고 어떻게 다른 PDF 문서에서 선택한 페이지를 하나의 PDF로 결합 ~에 C# 및 VB.NET .NET용 Spire.PDF 사용.
.NET용 Spire.PDF 설치
To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLLs files can be either downloaded from 이 링크 또는 NuGet을 통해 설치됩니다.
PM> Install-Package Spire.PDF
여러 PDF를 단일 PDF로 병합
.NET용 Spire.PDF는 PdfDocument.MergeFiles() 메서드를 제공하여 여러 PDF 문서를 단일 문서로 병합합니다. 자세한 단계는 다음과 같습니다.
- 병합할 문서의 경로를 가져와 문자열 배열에 저장합니다.
- PdfDocument.MergeFiles() 메서드를 호출하여 이러한 파일을 병합합니다.
- PdfDocumentBase.Save() 메서드를 사용하여 결과를 PDF 문서에 저장합니다.
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergePDFs
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Merge these documents and return an object of PdfDocumentBase
PdfDocumentBase doc = PdfDocument.MergeFiles(files);
//Save the result to a PDF file
doc.Save("output.pdf", FileFormat.PDF);
}
}
}

다른 PDF에서 선택한 페이지를 하나의 PDF로 병합
Spire.PDF for .NET은 PdfDocument.InsertPage() 메서드와 PdfDocument.InsertPageRange() 메서드를 제공하여 한 PDF 문서에서 다른 PDF 문서로 페이지 또는 페이지 범위를 가져옵니다. 다음은 다른 PDF 문서에서 선택한 페이지를 새 PDF 문서로 결합하는 단계입니다.
- 소스 문서의 경로를 가져와 문자열 배열에 저장합니다.
- PdfDocument의 배열을 만들고 각 소스 문서를 별도의 PdfDocument 개체에 로드합니다.
- 새 문서를 생성하기 위해 다른 PdfDocument 개체를 만듭니다.
- PdfDocument.InsertPage() 메서드 및 PdfDocument.InsertPageRange() 메서드를 사용하여 원본 문서의 선택한 페이지 또는 페이지 범위를 새 문서에 삽입합니다.
- PdfDocument.SaveToFile() 메서드를 사용하여 새 문서를 PDF 파일로 저장합니다.
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergeSelectedPages
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Create an array of PdfDocument
PdfDocument[] docs = new PdfDocument[files.Length];
//Loop through the documents
for (int i = 0; i < files.Length; i++)
{
//Load a specific document
docs[i] = new PdfDocument(files[i]);
}
//Create a PdfDocument object for generating a new PDF document
PdfDocument doc = new PdfDocument();
//Insert the selected pages from different documents to the new document
doc.InsertPage(docs[0], 0);
doc.InsertPageRange(docs[1], 1,3);
doc.InsertPage(docs[2], 0);
//Save the document to a PDF file
doc.SaveToFile("output.pdf");
}
}
}

임시 면허 신청
생성된 문서에서 평가 메시지를 제거하거나 기능 제한을 제거하려면 다음을 수행하십시오 30일 평가판 라이선스 요청 자신을 위해.
C#/VB.NET: unisci documenti PDF
Sommario
Installato tramite NuGet
PM> Install-Package Spire.PDF
Link correlati
Ci sono molte ragioni per cui potrebbe essere necessario unire i PDF. Ad esempio, l'unione di file PDF consente di stampare un singolo file anziché accodare più documenti per la stampante, l'unione di file correlati semplifica il processo di gestione e archiviazione di molti documenti riducendo il numero di file da ricercare e organizzare. In questo articolo imparerai come unire più documenti PDF in un unico documento PDF e come combinare le pagine selezionate da diversi documenti PDF in un unico PDF In C# e VB.NET usando Spire.PDF for .NET.
Installa Spire.PDF for .NET
Per cominciare, è necessario aggiungere i file DLL inclusi nel pacchetto Spire.PDF for .NET come riferimenti nel progetto .NET. I file DLL possono essere scaricati da questo link o installato tramite NuGet.
PM> Install-Package Spire.PDF
Unisci più PDF in un unico PDF
Spire.PDF for .NET offre il metodo PdfDocument.MergeFiles() per unire più documenti PDF in un unico documento. I passaggi dettagliati sono i seguenti.
- Ottieni i percorsi dei documenti da unire e memorizzali in un array di stringhe.
- Chiama il metodo PdfDocument.MergeFiles() per unire questi file.
- Salva il risultato in un documento PDF utilizzando il metodo PdfDocumentBase.Save().
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergePDFs
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Merge these documents and return an object of PdfDocumentBase
PdfDocumentBase doc = PdfDocument.MergeFiles(files);
//Save the result to a PDF file
doc.Save("output.pdf", FileFormat.PDF);
}
}
}

Unisci le pagine selezionate di diversi PDF in un unico PDF
Spire.PDF per .NET offre il metodo PdfDocument.InsertPage() e il metodo PdfDocument.InsertPageRange() per importare una pagina o un intervallo di pagine da un documento PDF a un altro. Di seguito sono riportati i passaggi per combinare le pagine selezionate da diversi documenti PDF in un nuovo documento PDF.
- Ottieni i percorsi dei documenti di origine e memorizzali in un array di stringhe.
- Creare un array di PdfDocument e caricare ciascun documento di origine in un oggetto PdfDocument separato.
- Crea un altro oggetto PdfDocument per generare un nuovo documento.
- Inserire la pagina selezionata o l'intervallo di pagine dei documenti di origine nel nuovo documento utilizzando il metodo PdfDocument.InsertPage() e il metodo PdfDocument.InsertPageRange().
- Salva il nuovo documento in un file PDF utilizzando il metodo PdfDocument.SaveToFile().
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergeSelectedPages
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Create an array of PdfDocument
PdfDocument[] docs = new PdfDocument[files.Length];
//Loop through the documents
for (int i = 0; i < files.Length; i++)
{
//Load a specific document
docs[i] = new PdfDocument(files[i]);
}
//Create a PdfDocument object for generating a new PDF document
PdfDocument doc = new PdfDocument();
//Insert the selected pages from different documents to the new document
doc.InsertPage(docs[0], 0);
doc.InsertPageRange(docs[1], 1,3);
doc.InsertPage(docs[2], 0);
//Save the document to a PDF file
doc.SaveToFile("output.pdf");
}
}
}

Richiedi una licenza temporanea
Se desideri rimuovere il messaggio di valutazione dai documenti generati o eliminare le limitazioni delle funzioni, per favore richiedere una licenza di prova di 30 giorni per te.
C#/VB.NET : fusionner des documents PDF
Table des matières
Installé via NuGet
PM> Install-Package Spire.PDF
Liens connexes
Il existe de nombreuses raisons pour lesquelles la fusion de PDF peut être nécessaire. Par exemple, la fusion de fichiers PDF vous permet d'imprimer un seul fichier plutôt que de mettre plusieurs documents en file d'attente pour l'imprimante, la combinaison de fichiers liés simplifie le processus de gestion et de stockage de nombreux documents en réduisant le nombre de fichiers à rechercher et à organiser. Dans cet article, vous apprendrez à fusionner plusieurs documents PDF en un seul document PDF et comment combiner les pages sélectionnées de différents documents PDF en un seul PDF dans C# et VB.NET en utilisant Spire.PDF for .NET.
- Fusionner plusieurs PDF en un seul PDF
- Fusionner les pages sélectionnées de différents PDF en un seul PDF
Installer Spire.PDF for .NET
Pour commencer, vous devez ajouter les fichiers DLL inclus dans le package Spire.PDF for .NET en tant que références dans votre projet .NET. Les fichiers DLL peuvent être téléchargés depuis ce lien ou installé via NuGet.
PM> Install-Package Spire.PDF
Fusionner plusieurs PDF en un seul PDF
Spire.PDF for .NET propose la méthode PdfDocument.MergeFiles() pour fusionner plusieurs documents PDF en un seul document. Les étapes détaillées sont les suivantes.
- Obtenez les chemins des documents à fusionner et stockez-les dans un tableau de chaînes.
- Appelez la méthode PdfDocument.MergeFiles() pour fusionner ces fichiers.
- Enregistrez le résultat dans un document PDF à l'aide de la méthode PdfDocumentBase.Save().
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergePDFs
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Merge these documents and return an object of PdfDocumentBase
PdfDocumentBase doc = PdfDocument.MergeFiles(files);
//Save the result to a PDF file
doc.Save("output.pdf", FileFormat.PDF);
}
}
}

Merge the Selected Pages of Different PDFs into One PDF
Spire.PDF for .NET offers the PdfDocument.InsertPage() method and the PdfDocument.InsertPageRange() method to import a page or a page range from one PDF document to another. The following are the steps to combine the selected pages from different PDF documents into a new PDF document.
- Obtenez les chemins des documents source et stockez-les dans un tableau de chaînes.
- Créez un tableau de PdfDocument et chargez chaque document source dans un objet PdfDocument distinct.
- Créez un autre objet PdfDocument pour générer un nouveau document.
- Insérez la page ou la plage de pages sélectionnée des documents source dans le nouveau document à l'aide des méthodes PdfDocument.InsertPage() et PdfDocument.InsertPageRange().
- Enregistrez le nouveau document dans un fichier PDF à l'aide de la méthode PdfDocument.SaveToFile().
- C#
- VB.NET
using System;
using Spire.Pdf;
namespace MergeSelectedPages
{
class Program
{
static void Main(string[] args)
{
//Get the paths of the documents to be merged
String[] files = new String[] {
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-1.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-2.pdf",
"C:\\Users\\Administrator\\Desktop\\PDFs\\sample-3.pdf"};
//Create an array of PdfDocument
PdfDocument[] docs = new PdfDocument[files.Length];
//Loop through the documents
for (int i = 0; i < files.Length; i++)
{
//Load a specific document
docs[i] = new PdfDocument(files[i]);
}
//Create a PdfDocument object for generating a new PDF document
PdfDocument doc = new PdfDocument();
//Insert the selected pages from different documents to the new document
doc.InsertPage(docs[0], 0);
doc.InsertPageRange(docs[1], 1,3);
doc.InsertPage(docs[2], 0);
//Save the document to a PDF file
doc.SaveToFile("output.pdf");
}
}
}

Demander une licence temporaire
Si vous souhaitez supprimer le message d'évaluation des documents générés ou vous débarrasser des limitations de la fonction, veuillez demander une licence d'essai de 30 jours pour toi.
C#/VB.NET: Converter PDF para Word
Índice
Instalado via NuGet
PM> Install-Package Spire.PDF
Links Relacionados
O formato PDF é a melhor escolha em muitos casos, mas o Word é mais flexível quando a edição ou modificação é necessária. Arquivos PDF são normalmente usados para compartilhamento online, impressão e arquivamento, enquanto documentos do Word são usados para criar, editar e formatar documentos. Converter um PDF para Word é uma boa opção se você quiser reeditar o documento PDF. Neste artigo, você aprenderá como programar converter PDF para Word em C# e VB.NET usando Spire.PDF for .NET.
Instalar o Spire.PDF for .NET
Para começar, você precisa adicionar os arquivos DLL incluídos no pacote Spire.PDF for .NET como referências em seu projeto .NET. Os arquivos DLL podem ser baixados deste link ou instalados via NuGet.
PM> Install-Package Spire.PDF
Conhecimento prévio
O Spire.PDF for .NET oferece dois modos de conversão. As vantagens e desvantagens desses dois modos são as seguintes:
- Modo de layout fixo: O modo de layout fixo tem velocidade de conversão rápida e é propício para manter a aparência original dos arquivos PDF ao máximo. No entanto, a capacidade de edição do documento resultante será limitada, pois cada linha de texto em PDF será apresentada em um quadro separado no documento do Word gerado.
- Modo de reconhecimento de fluxo: O modo de reconhecimento de fluxo é um modo de reconhecimento completo. O conteúdo convertido não será apresentado em quadros e a estrutura do documento resultante é fluida. O documento do Word gerado é fácil de reeditar, mas pode parecer diferente do arquivo PDF original.
Converter PDF para Doc/Docx de Layout Fixo em C#, VB.NET
Por padrão, o método PdfDcoument.SaveToFile() converterá PDF em Word com layout fixo. A seguir estão as etapas detalhadas.
- Crie um objeto PdfDocument.
- Carregue um arquivo PDF usando o método PdfDocument.LoadFromFile().
- Converta o documento PDF em um arquivo de formato Doc ou Docx usando o método PdfDocument.SaveToFile(String fileName, FileFormat fileFormat).
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToFixedLayoutWord
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a PDF document
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pdf");
//Convert PDF to Doc and save it to a specified path
doc.SaveToFile("output/ToDoc.doc", FileFormat.DOC);
//Convert PDF to Docx and save it to a specified path
doc.SaveToFile("output/ToDocx.docx", FileFormat.DOCX);
doc.Close();
}
}
}

Converta PDF em Doc/Docx com Estrutura Flexível em C#, VB.NET
Além do mecanismo de conversão padrão, o Spire.PDF para .NET fornece outro mecanismo chamado modo Ps, que funciona melhor com o modo de reconhecimento de fluxo. Para ativar o mecanismo de conversão Ps e o modo de reconhecimento de fluxo, passe (true, true) como parâmetros do método PdfDocument.ConvertOptions.SetPdfToDocOptions(bool usePsMode, bool useFlowRecognitionMode). As etapas inteiras são as seguintes.
- Crie um objeto PdfDocument.
- Carregue um arquivo PDF usando o método PdfDocument.loadFromFile().
- Habilite o mecanismo de conversão Ps e o modo de reconhecimento de fluxo usando o método PdfDocument.ConvertOptions.SetPdfToDocOptions(true, true).
- Converta o documento PDF em um arquivo de formato Doc ou Docx usando o método PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToFlexibleLayoutWord
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a PDF document
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pdf");
//Specify the PDF to Word conversion options
doc.ConvertOptions.SetPdfToDocOptions(true, true);
//Convert PDF to Doc
doc.SaveToFile("output/ToDoc.doc", FileFormat.DOC);
//Convert PDF to Docx
doc.SaveToFile("output/ToDocx.docx", FileFormat.DOCX);
doc.Close();
}
}
}

Solicitar uma licença temporária
Se você deseja remover a mensagem de avaliação dos documentos gerados ou se livrar das limitações de função, por favor solicite uma licença de teste de 30 dias para você.
C#/VB.NET: Converti PDF in Word
Sommario
Installato tramite NuGet
PM> Install-Package Spire.PDF
Link correlati
Il formato PDF è la scelta migliore in molti casi, ma Word è più flessibile quando è necessario modificare o modificare. I file PDF vengono generalmente utilizzati per la condivisione, la stampa e l'archiviazione online, mentre i documenti Word vengono utilizzati per la creazione, la modifica e la formattazione dei documenti. La conversione di un PDF in Word è una buona opzione se desideri modificare nuovamente il documento PDF. In questo articolo imparerai a programmaticamente convertire PDF in Word in C# e VB.NET utilizzando Spire.PDF for .NET.
Installa Spire.PDF for .NET
Per cominciare, è necessario aggiungere i file DLL inclusi nel pacchetto Spire.PDF for .NET come riferimenti nel progetto .NET. I file DLL possono essere scaricati da questo link o installato tramite NuGet.
PM> Install-Package Spire.PDF
Conoscenze di base
Spire.PDF for .NET offre due modalità di conversione. I vantaggi e gli svantaggi di queste due modalità sono i seguenti:
- Modalità layout fisso: la modalità layout fisso ha una velocità di conversione elevata ed è favorevole al mantenimento dell'aspetto originale dei file PDF nella massima misura. Tuttavia, la modificabilità del documento risultante sarà limitata poiché ogni riga di testo in PDF verrà presentata in una cornice separata nel documento Word generato.
- Modalità di riconoscimento del flusso: la modalità di riconoscimento del flusso è una modalità di riconoscimento completo. Il contenuto convertito non verrà presentato in frame e la struttura del documento risultante è fluida. Il documento Word generato è facile da modificare nuovamente ma potrebbe avere un aspetto diverso dal file PDF originale.
Converti PDF in Doc/Docx a layout fisso in C#, VB.NET
Per impostazione predefinita, il metodo PdfDcoument.SaveToFile() convertirà PDF in Word con layout fisso. Di seguito sono riportati i passaggi dettagliati.
- Creare un oggetto PdfDocument.
- Carica un file PDF utilizzando il metodo PdfDocument.LoadFromFile().
- Convertire il documento PDF in un file in formato Doc o Docx utilizzando il metodo PdfDocument.SaveToFile(String fileName, FileFormat fileFormat).
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToFixedLayoutWord
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a PDF document
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pdf");
//Convert PDF to Doc and save it to a specified path
doc.SaveToFile("output/ToDoc.doc", FileFormat.DOC);
//Convert PDF to Docx and save it to a specified path
doc.SaveToFile("output/ToDocx.docx", FileFormat.DOCX);
doc.Close();
}
}
}

Converti PDF in Doc/Docx con struttura flessibile in C#, VB.NET
Oltre al motore di conversione predefinito, Spire.PDF per .NET fornisce un altro motore chiamato modalità Ps, che funziona meglio con la modalità di riconoscimento del flusso. Per abilitare il motore di conversione Ps e la modalità di riconoscimento del flusso, passare (true, true) come parametri del metodo PdfDocument.ConvertOptions.SetPdfToDocOptions(bool usePsMode, bool useFlowRecognitionMode). Gli interi passaggi sono i seguenti.
- Creare un oggetto PdfDocument.
- Carica un file PDF utilizzando il metodo PdfDocument.loadFromFile().
- Abilita il motore di conversione Ps e la modalità di riconoscimento del flusso utilizzando il metodo PdfDocument.ConvertOptions.SetPdfToDocOptions(true, true).
- Converti il documento PDF in un file in formato Doc o Docx utilizzando il metodo PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToFlexibleLayoutWord
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a PDF document
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pdf");
//Specify the PDF to Word conversion options
doc.ConvertOptions.SetPdfToDocOptions(true, true);
//Convert PDF to Doc
doc.SaveToFile("output/ToDoc.doc", FileFormat.DOC);
//Convert PDF to Docx
doc.SaveToFile("output/ToDocx.docx", FileFormat.DOCX);
doc.Close();
}
}
}

Richiedi una licenza temporanea
Se desideri rimuovere il messaggio di valutazione dai documenti generati o eliminare le limitazioni delle funzioni, per favore richiedere una licenza di prova di 30 giorni per te.
C#/VB.NET: преобразование PDF в Word
Оглавление
Установлено через NuGet
PM>Установка-Пакет Spire.PDF
Ссылки по теме
Формат PDF — лучший выбор во многих случаях, но Word более гибок, когда требуется редактирование или модификация. Файлы PDF обычно используются для обмена в Интернете, печати и архивирования, а документы Word используются для создания, редактирования и форматирования документов. Преобразование PDF в Word — хороший вариант, если вы хотите повторно отредактировать PDF-документ. В этой статье вы узнаете, как программно конвертировать PDF в Word на C# и VB.NET с использованием Spire.PDF for .NET.
- Преобразование PDF в документ с фиксированным макетом / Docx
- Преобразование PDF в Doc/Docx с гибкой структурой
Установите Spire.PDF for .NET
Для начала вам нужно добавить файлы DLL, включенные в пакет Spire.PDF for .NET, в качестве ссылок в ваш проект .NET. Файлы DLL можно загрузить с эта ссылка или установить через NuGet..
PM>Установка-Пакет Spire.PDF
Жизненный опыт
Spire.PDF for .NET предоставляет два режима преобразования. Преимущества и недостатки этих двух режимов заключаются в следующем:
- Режим фиксированного макета: Режим фиксированной компоновки имеет высокую скорость преобразования и в наибольшей степени способствует сохранению исходного вида PDF-файлов. Однако возможность редактирования полученного документа будет ограничена, поскольку каждая строка текста в формате PDF будет представлена в отдельном фрейме в сгенерированном документе Word.
- Режим распознавания потока: Режим распознавания потока — это режим полного распознавания. Преобразованный контент не будет представлен во фреймах, а структура результирующего документа будет плавной. Сгенерированный документ Word легко редактируется, но он может отличаться от исходного PDF-файла.
Преобразование PDF в Doc/Docx с фиксированным макетом в C#, VB.NET
По умолчаниюPdfDcoument.SaveToFile() method will convert PDF to Word with fixed layout. The following are the detailed steps.
- Создайте объект PdfDocument.
- Загрузите файл PDF с помощью метода PdfDocument.LoadFromFile().
- Преобразуйте документ PDF в файл формата Doc или Docx, используя метод PdfDocument.SaveToFile(String fileName, FileFormat fileFormat).
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToFixedLayoutWord
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a PDF document
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pdf");
//Convert PDF to Doc and save it to a specified path
doc.SaveToFile("output/ToDoc.doc", FileFormat.DOC);
//Convert PDF to Docx and save it to a specified path
doc.SaveToFile("output/ToDocx.docx", FileFormat.DOCX);
doc.Close();
}
}
}

Преобразование PDF в Doc/Docx с гибкой структурой на C#, VB.NET
В дополнение к механизму преобразования по умолчанию Spire.PDF для .NET предоставляет другой механизм, называемый режимом Ps, который лучше работает с режимом распознавания потока. Чтобы включить механизм преобразования Ps и режим потокового распознавания, передайте (true, true) в качестве параметров метода PdfDocument.ConvertOptions.SetPdfToDocOptions(bool usePsMode, bool useFlowRecognitionMode). Все шаги следующие.
- Создайте объект PdfDocument.
- Загрузите файл PDF с помощью метода PdfDocument.loadFromFile().
- Включите механизм преобразования Ps и режим распознавания потока с помощью метода PdfDocument.ConvertOptions.SetPdfToDocOptions(true, true).
- Преобразуйте документ PDF в файл формата Doc или Docx, используя метод PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToFlexibleLayoutWord
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a PDF document
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pdf");
//Specify the PDF to Word conversion options
doc.ConvertOptions.SetPdfToDocOptions(true, true);
//Convert PDF to Doc
doc.SaveToFile("output/ToDoc.doc", FileFormat.DOC);
//Convert PDF to Docx
doc.SaveToFile("output/ToDocx.docx", FileFormat.DOCX);
doc.Close();
}
}
}

Подать заявку на временную лицензию
Если вы хотите удалить оценочное сообщение из сгенерированных документов или избавиться от функциональных ограничений, запросите для себя 30-дневную пробную лицензию.