C#/VB.NET: Converta várias imagens em um único PDF
Índice
Instalado via NuGet
PM> Install-Package Spire.PDF
Links Relacionados
Se você tiver várias imagens que deseja combinar em um arquivo para facilitar a distribuição ou armazenamento, convertê-las em um único documento PDF é uma ótima solução. Esse processo não apenas economiza espaço, mas também garante que todas as suas imagens sejam mantidas juntas em um arquivo, facilitando o compartilhamento ou a transferência. Neste artigo você aprenderá como combine várias imagens em um único documento PDF em C# e VB.NET usando Spire.PDF for .NET.
Instale 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
Combine várias imagens em um único PDF em C# e VB.NET
Para converter todas as imagens de uma pasta em PDF, iteramos cada imagem, adicionamos uma nova página ao PDF com o mesmo tamanho da imagem e, em seguida, desenhamos a imagem na nova página. A seguir estão as etapas detalhadas.
- Crie um objeto PdfDocument.
- Defina as margens da página como zero usando o método PdfDocument.PageSettings.SetMargins().
- Obtenha a pasta onde as imagens estão armazenadas.
- Itere cada arquivo de imagem na pasta e obtenha a largura e a altura de uma imagem específica.
- Adicione uma nova página que tenha a mesma largura e altura da imagem ao documento PDF usando o método PdfDocument.Pages.Add().
- Desenhe a imagem na página usando o método PdfPageBase.Canvas.DrawImage().
- Salve o documento usando o método PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
namespace ConvertMultipleImagesIntoPdf
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Set the page margins to 0
doc.PageSettings.SetMargins(0);
//Get the folder where the images are stored
DirectoryInfo folder = new DirectoryInfo(@"C:\Users\Administrator\Desktop\Images");
//Iterate through the files in the folder
foreach (FileInfo file in folder.GetFiles())
{
//Load a particular image
Image image = Image.FromFile(file.FullName);
//Get the image width and height
float width = image.PhysicalDimension.Width;
float height = image.PhysicalDimension.Height;
//Add a page that has the same size as the image
PdfPageBase page = doc.Pages.Add(new SizeF(width, height));
//Create a PdfImage object based on the image
PdfImage pdfImage = PdfImage.FromImage(image);
//Draw image at (0, 0) of the page
page.Canvas.DrawImage(pdfImage, 0, 0, pdfImage.Width, pdfImage.Height);
}
//Save to file
doc.SaveToFile("CombinaImagesToPdf.pdf");
doc.Dispose();
}
}
}

Solicite uma licença temporária
Se desejar 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ê mesmo.
C#/VB.NET: преобразование нескольких изображений в один PDF-файл
Оглавление
Установлено через NuGet
PM> Install-Package Spire.PDF
Ссылки по теме
Если у вас есть несколько изображений, которые вы хотите объединить в один файл для упрощения распространения или хранения, отличным решением будет их преобразование в один PDF-документ. Этот процесс не только экономит место, но и гарантирует, что все ваши изображения будут храниться в одном файле, что делает их удобными для совместного использования или передачи. В этой статье вы узнаете, как объединить несколько изображений в один PDF-документ на C# и VB.NET с помощью Spire.PDF for .NET.
Установите Spire.PDF for .NET
Для начала вам необходимо добавить файлы DLL, включенные в пакет Spire.PDF for.NET, в качестве ссылок в ваш проект .NET. Файлы DLL можно загрузить по этой ссылке или установить через NuGet.
PM> Install-Package Spire.PDF
Объединение нескольких изображений в один PDF-файл в C# и VB.NET
Чтобы преобразовать все изображения в папке в PDF-файл, мы перебираем каждое изображение, добавляем в PDF-файл новую страницу того же размера, что и изображение, а затем рисуем изображение на новой странице. Ниже приведены подробные шаги.
- Создайте объект PDFDocument.
- Установите поля страницы на ноль, используя метод PdfDocument.PageSettings.SetMargins().
- Получите папку, в которой хранятся изображения.
- Переберите каждый файл изображения в папке и получите ширину и высоту определенного изображения.
- Добавьте в PDF-документ новую страницу той же ширины и высоты, что и изображение, с помощью метода PdfDocument.Pages.Add().
- Нарисуйте изображение на странице, используя метод PdfPageBase.Canvas.DrawImage().
- Сохраните документ, используя метод PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
namespace ConvertMultipleImagesIntoPdf
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Set the page margins to 0
doc.PageSettings.SetMargins(0);
//Get the folder where the images are stored
DirectoryInfo folder = new DirectoryInfo(@"C:\Users\Administrator\Desktop\Images");
//Iterate through the files in the folder
foreach (FileInfo file in folder.GetFiles())
{
//Load a particular image
Image image = Image.FromFile(file.FullName);
//Get the image width and height
float width = image.PhysicalDimension.Width;
float height = image.PhysicalDimension.Height;
//Add a page that has the same size as the image
PdfPageBase page = doc.Pages.Add(new SizeF(width, height));
//Create a PdfImage object based on the image
PdfImage pdfImage = PdfImage.FromImage(image);
//Draw image at (0, 0) of the page
page.Canvas.DrawImage(pdfImage, 0, 0, pdfImage.Width, pdfImage.Height);
}
//Save to file
doc.SaveToFile("CombinaImagesToPdf.pdf");
doc.Dispose();
}
}
}

Подать заявку на временную лицензию
Если вы хотите удалить сообщение об оценке из сгенерированных документов или избавиться от ограничений функции, пожалуйста запросите 30-дневную пробную лицензию для себя.
C#/VB.NET: Konvertieren Sie mehrere Bilder in ein einziges PDF
Inhaltsverzeichnis
Über NuGet installiert
PM> Install-Package Spire.PDF
verwandte Links
Wenn Sie mehrere Bilder haben, die Sie zur einfacheren Verteilung oder Speicherung in einer Datei kombinieren möchten, ist die Konvertierung in ein einziges PDF-Dokument eine hervorragende Lösung. Dieser Vorgang spart nicht nur Platz, sondern sorgt auch dafür, dass alle Ihre Bilder in einer Datei zusammengehalten werden, sodass sie bequem geteilt oder übertragen werden können. In diesem Artikel erfahren Sie, wie das geht Kombinieren Sie mehrere Bilder in einem einzigen PDF-Dokument in C# und VB.NET mit Spire.PDF for .NET.
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 über diesen Link heruntergeladen oder über NuGet installiert werden.
PM> Install-Package Spire.PDF
Kombinieren Sie mehrere Bilder in einer einzigen PDF-Datei in C# und VB.NET
Um alle Bilder in einem Ordner in ein PDF zu konvertieren, durchlaufen wir jedes Bild, fügen dem PDF eine neue Seite mit der gleichen Größe wie das Bild hinzu und zeichnen das Bild dann auf die neue Seite. Im Folgenden finden Sie die detaillierten Schritte.
- Erstellen Sie ein PdfDocument-Objekt.
- Setzen Sie die Seitenränder mit der Methode PdfDocument.PageSettings.SetMargins() auf Null.
- Rufen Sie den Ordner ab, in dem die Bilder gespeichert sind.
- Durchlaufen Sie jede Bilddatei im Ordner und ermitteln Sie die Breite und Höhe eines bestimmten Bildes.
- Fügen Sie dem PDF-Dokument mit der Methode PdfDocument.Pages.Add() eine neue Seite hinzu, die dieselbe Breite und Höhe wie das Bild hat.
- Zeichnen Sie das Bild mit der Methode PdfPageBase.Canvas.DrawImage() auf die Seite.
- Speichern Sie das Dokument mit der Methode PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
namespace ConvertMultipleImagesIntoPdf
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Set the page margins to 0
doc.PageSettings.SetMargins(0);
//Get the folder where the images are stored
DirectoryInfo folder = new DirectoryInfo(@"C:\Users\Administrator\Desktop\Images");
//Iterate through the files in the folder
foreach (FileInfo file in folder.GetFiles())
{
//Load a particular image
Image image = Image.FromFile(file.FullName);
//Get the image width and height
float width = image.PhysicalDimension.Width;
float height = image.PhysicalDimension.Height;
//Add a page that has the same size as the image
PdfPageBase page = doc.Pages.Add(new SizeF(width, height));
//Create a PdfImage object based on the image
PdfImage pdfImage = PdfImage.FromImage(image);
//Draw image at (0, 0) of the page
page.Canvas.DrawImage(pdfImage, 0, 0, pdfImage.Width, pdfImage.Height);
}
//Save to file
doc.SaveToFile("CombinaImagesToPdf.pdf");
doc.Dispose();
}
}
}

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: convierta varias imágenes en un solo PDF
Tabla de contenido
Instalado a través de NuGet
PM> Install-Package Spire.PDF
enlaces relacionados
Si tiene varias imágenes que desea combinar en un archivo para facilitar su distribución o almacenamiento, convertirlas en un solo documento PDF es una excelente solución. Este proceso no sólo ahorra espacio sino que también garantiza que todas sus imágenes se mantengan juntas en un solo archivo, lo que hace que sea conveniente compartirlas o transferirlas. En este artículo, aprenderá cómo combine varias imágenes en un solo documento PDF en C# y VB.NET usando Spire.PDF for .NET.
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 instalar a través de NuGet.
PM> Install-Package Spire.PDF
Combine varias imágenes en un solo PDF en C# y VB.NET
Para convertir todas las imágenes de una carpeta a un PDF, recorremos cada imagen, agregamos una nueva página al PDF con el mismo tamaño que la imagen y luego dibujamos la imagen en la nueva página. Los siguientes son los pasos detallados.
- Cree un objeto PdfDocument.
- Establezca los márgenes de la página en cero utilizando el método PdfDocument.PageSettings.SetMargins().
- Obtenga la carpeta donde se almacenan las imágenes.
- Repita cada archivo de imagen en la carpeta y obtenga el ancho y alto de una imagen específica.
- Agregue una nueva página que tenga el mismo ancho y alto que la imagen al documento PDF utilizando el método PdfDocument.Pages.Add().
- Dibuja la imagen en la página usando el método PdfPageBase.Canvas.DrawImage().
- Guarde el documento utilizando el método PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
namespace ConvertMultipleImagesIntoPdf
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Set the page margins to 0
doc.PageSettings.SetMargins(0);
//Get the folder where the images are stored
DirectoryInfo folder = new DirectoryInfo(@"C:\Users\Administrator\Desktop\Images");
//Iterate through the files in the folder
foreach (FileInfo file in folder.GetFiles())
{
//Load a particular image
Image image = Image.FromFile(file.FullName);
//Get the image width and height
float width = image.PhysicalDimension.Width;
float height = image.PhysicalDimension.Height;
//Add a page that has the same size as the image
PdfPageBase page = doc.Pages.Add(new SizeF(width, height));
//Create a PdfImage object based on the image
PdfImage pdfImage = PdfImage.FromImage(image);
//Draw image at (0, 0) of the page
page.Canvas.DrawImage(pdfImage, 0, 0, pdfImage.Width, pdfImage.Height);
}
//Save to file
doc.SaveToFile("CombinaImagesToPdf.pdf");
doc.Dispose();
}
}
}

Solicite 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 문서로 변환하는 것이 훌륭한 솔루션입니다. 이 프로세스는 공간을 절약할 뿐만 아니라 모든 이미지가 하나의 파일에 함께 보관되어 공유 또는 전송이 편리해집니다. 이 기사에서는 다음 방법을 배웁니다 Spire.PDF for .NET사용하여 C# 및 VB.NET에서 여러 이미지를 단일 PDF 문서로 결합합니다.
Spire.PDF for .NET 설치
먼저 Spire.PDF for.NET 패키지에 포함된 DLL 파일을 .NET 프로젝트의 참조로 추가해야 합니다. DLL 파일은 이 링크에서 다운로드하거나 NuGet을 통해 설치할 수 있습니다.
PM> Install-Package Spire.PDF
C# 및 VB.NET에서 여러 이미지를 단일 PDF로 결합
폴더의 모든 이미지를 PDF로 변환하기 위해 각 이미지를 반복하고 이미지와 동일한 크기로 PDF에 새 페이지를 추가한 다음 새 페이지에 이미지를 그립니다. 자세한 단계는 다음과 같습니다.
- PdfDocument 개체를 만듭니다.
- PdfDocument.PageSettings.SetMargins() 메서드를 사용하여 페이지 여백을 0으로 설정합니다.
- 이미지가 저장된 폴더를 가져옵니다.
- 폴더의 각 이미지 파일을 반복하여 특정 이미지의 너비와 높이를 가져옵니다.
- PdfDocument.Pages.Add() 메서드를 사용하여 이미지와 너비 및 높이가 동일한 새 페이지를 PDF 문서에 추가합니다.
- PdfPageBase.Canvas.DrawImage() 메서드를 사용하여 페이지에 이미지를 그립니다.
- PdfDocument.SaveToFile() 메서드를 사용하여 문서를 저장합니다.
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
namespace ConvertMultipleImagesIntoPdf
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Set the page margins to 0
doc.PageSettings.SetMargins(0);
//Get the folder where the images are stored
DirectoryInfo folder = new DirectoryInfo(@"C:\Users\Administrator\Desktop\Images");
//Iterate through the files in the folder
foreach (FileInfo file in folder.GetFiles())
{
//Load a particular image
Image image = Image.FromFile(file.FullName);
//Get the image width and height
float width = image.PhysicalDimension.Width;
float height = image.PhysicalDimension.Height;
//Add a page that has the same size as the image
PdfPageBase page = doc.Pages.Add(new SizeF(width, height));
//Create a PdfImage object based on the image
PdfImage pdfImage = PdfImage.FromImage(image);
//Draw image at (0, 0) of the page
page.Canvas.DrawImage(pdfImage, 0, 0, pdfImage.Width, pdfImage.Height);
}
//Save to file
doc.SaveToFile("CombinaImagesToPdf.pdf");
doc.Dispose();
}
}
}

임시 라이센스 신청
생성된 문서에서 평가 메시지를 제거하고 싶거나, 기능 제한을 없애고 싶다면 30일 평가판 라이센스 요청 자신을 위해.
C#/VB.NET: converti più immagini in un unico PDF
Sommario
Installato tramite NuGet
PM> Install-Package Spire.PDF
Link correlati
Se disponi di più immagini che desideri combinare in un unico file per una distribuzione o un'archiviazione più semplice, convertirle in un unico documento PDF è un'ottima soluzione. Questo processo non solo consente di risparmiare spazio, ma garantisce anche che tutte le immagini siano conservate insieme in un unico file, rendendone conveniente la condivisione o il trasferimento. In questo articolo imparerai come farlo combinare diverse immagini in un unico documento PDF in C# e VB.NET utilizzando Spire.PDF for .NET.
Installa Spire.PDF for .NET
Per cominciare, devi aggiungere i file DLL inclusi nel pacchetto Spire.PDF for .NET come riferimenti nel tuo progetto .NET. I file DLL possono essere scaricati da questo link o installato tramite NuGet.
PM> Install-Package Spire.PDF
Combina più immagini in un unico PDF in C# e VB.NET
Per convertire tutte le immagini di una cartella in un PDF, iteriamo su ciascuna immagine, aggiungiamo una nuova pagina al PDF con le stesse dimensioni dell'immagine, quindi disegniamo l'immagine sulla nuova pagina. Di seguito sono riportati i passaggi dettagliati.
- Crea un oggetto PdfDocument.
- Imposta i margini della pagina su zero utilizzando il metodo PdfDocument.PageSettings.SetMargins().
- Ottieni la cartella in cui sono archiviate le immagini.
- Scorri ogni file immagine nella cartella e ottieni la larghezza e l'altezza di un'immagine specifica.
- Aggiungi una nuova pagina che abbia la stessa larghezza e altezza dell'immagine al documento PDF utilizzando il metodo PdfDocument.Pages.Add().
- Disegna l'immagine sulla pagina utilizzando il metodo PdfPageBase.Canvas.DrawImage().
- Salvare il documento utilizzando il metodo PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
namespace ConvertMultipleImagesIntoPdf
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Set the page margins to 0
doc.PageSettings.SetMargins(0);
//Get the folder where the images are stored
DirectoryInfo folder = new DirectoryInfo(@"C:\Users\Administrator\Desktop\Images");
//Iterate through the files in the folder
foreach (FileInfo file in folder.GetFiles())
{
//Load a particular image
Image image = Image.FromFile(file.FullName);
//Get the image width and height
float width = image.PhysicalDimension.Width;
float height = image.PhysicalDimension.Height;
//Add a page that has the same size as the image
PdfPageBase page = doc.Pages.Add(new SizeF(width, height));
//Create a PdfImage object based on the image
PdfImage pdfImage = PdfImage.FromImage(image);
//Draw image at (0, 0) of the page
page.Canvas.DrawImage(pdfImage, 0, 0, pdfImage.Width, pdfImage.Height);
}
//Save to file
doc.SaveToFile("CombinaImagesToPdf.pdf");
doc.Dispose();
}
}
}

Richiedi una licenza temporanea
Se desideri rimuovere il messaggio di valutazione dai documenti generati o eliminare le limitazioni della funzione, per favore richiedere una licenza di prova di 30 giorni per te.
C#/VB.NET : convertir plusieurs images en un seul PDF
Table des matières
Installé via NuGet
PM> Install-Package Spire.PDF
Liens connexes
Si vous souhaitez combiner plusieurs images en un seul fichier pour une distribution ou un stockage plus facile, les convertir en un seul document PDF est une excellente solution. Ce processus permet non seulement d'économiser de l'espace, mais garantit également que toutes vos images sont conservées ensemble dans un seul fichier, ce qui facilite le partage ou le transfert. Dans cet article, vous apprendrez comment combinez plusieurs images en un seul document PDF en C# et VB.NET à l'aide de Spire.PDF for .NET.
Installer Spire.PDF for .NET
Pour commencer, vous devez ajouter les fichiers DLL inclus dans le package Spire.PDF for.NET comme références dans votre projet .NET. Les fichiers DLL peuvent être téléchargés à partir de ce lien ou installés via NuGet.
PM> Install-Package Spire.PDF
Combinez plusieurs images en un seul PDF en C# et VB.NET
Afin de convertir toutes les images d'un dossier en PDF, nous parcourons chaque image, ajoutons une nouvelle page au PDF avec la même taille que l'image, puis dessinons l'image sur la nouvelle page. Voici les étapes détaillées.
- Créez un objet PdfDocument.
- Définissez les marges de la page sur zéro à l’aide de la méthode PdfDocument.PageSettings.SetMargins().
- Obtenez le dossier dans lequel les images sont stockées.
- Parcourez chaque fichier image du dossier et obtenez la largeur et la hauteur d’une image spécifique.
- Ajoutez une nouvelle page ayant la même largeur et hauteur que l'image au document PDF à l'aide de la méthode PdfDocument.Pages.Add().
- Dessinez l'image sur la page à l'aide de la méthode PdfPageBase.Canvas.DrawImage().
- Enregistrez le document à l'aide de la méthode PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
namespace ConvertMultipleImagesIntoPdf
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Set the page margins to 0
doc.PageSettings.SetMargins(0);
//Get the folder where the images are stored
DirectoryInfo folder = new DirectoryInfo(@"C:\Users\Administrator\Desktop\Images");
//Iterate through the files in the folder
foreach (FileInfo file in folder.GetFiles())
{
//Load a particular image
Image image = Image.FromFile(file.FullName);
//Get the image width and height
float width = image.PhysicalDimension.Width;
float height = image.PhysicalDimension.Height;
//Add a page that has the same size as the image
PdfPageBase page = doc.Pages.Add(new SizeF(width, height));
//Create a PdfImage object based on the image
PdfImage pdfImage = PdfImage.FromImage(image);
//Draw image at (0, 0) of the page
page.Canvas.DrawImage(pdfImage, 0, 0, pdfImage.Width, pdfImage.Height);
}
//Save to file
doc.SaveToFile("CombinaImagesToPdf.pdf");
doc.Dispose();
}
}
}

Demander une licence temporaire
Si vous souhaitez supprimer le message d'évaluation des documents générés ou vous débarrasser des limitations fonctionnelles, veuillez demander une licence d'essai de 30 jours pour toi.
C#/VB.NET: Convert PDF to SVG
Table of Contents
Installed via NuGet
PM> Install-Package Spire.PDF
Related Links
SVG (Scalable Vector Graphics) is an image file format used for rendering two-dimensional images on the web. Comparing with other image file formats, SVG has many advantages such as supporting interactivity and animation, allowing users to search, index, script, and compress/enlarge images without losing quality. Occasionally, you may need to convert PDF files to SVG file format, and this article will demonstrate how to accomplish this task using Spire.PDF for .NET.
- Convert a PDF File to SVG in C#/VB.NET
- Convert Selected PDF Pages to SVG in C#/VB.NET
- Convert a PDF File to SVG with Custom Width and Height in C#/VB.NET
Install Spire.PDF for .NET
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 this link or installed via NuGet.
PM> Install-Package Spire.PDF
Convert a PDF File to SVG in C#/VB.NET
Spire.PDF for .NET offers the PdfDocument.SaveToFile(String, FileFormat) method to convert each page in a PDF file to a single SVG file. The detailed steps are as follows.
- Create a PdfDocument object.
- Load a sample PDF file using PdfDocument.LoadFromFile() method.
- Convert the PDF file to SVG using PdfDocument.SaveToFile(String, FileFormat) method.
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPDFtoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument document = new PdfDocument();
//Load a sample PDF file
document.LoadFromFile("input.pdf");
//Convert PDF to SVG
document.SaveToFile("PDFtoSVG.svg", FileFormat.SVG);
}
}
}

Convert Selected PDF Pages to SVG in C#/VB.NET
The PdfDocument.SaveToFile(String, Int32, Int32, FileFormat) method allows you to convert the specified pages in a PDF file to SVG files. The detailed steps are as follows.
- Create a PdfDocument object.
- Load a sample PDF file using PdfDocument.LoadFromFile() method.
- Convert selected PDF pages to SVG using PdfDocument.SaveToFile(String, Int32, Int32, FileFormat) method.
- C#
- VB.NET
using Spire.Pdf;
namespace PDFPagetoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a sample PDF file
doc.LoadFromFile("input.pdf");
//Convert selected PDF pages to SVG
doc.SaveToFile("PDFPagetoSVG.svg", 1, 2, FileFormat.SVG);
}
}
}

Convert a PDF File to SVG with Custom Width and Height in C#/VB.NET
The PdfConvertOptions.SetPdfToSvgOptions() method offered by Spire.PDF for .NET allows you to specify the width and height of output SVG file. The detailed steps are as follows.
- Create a PdfDocument object.
- Load a sample PDF file using PdfDocument.LoadFromFile() method.
- Set PDF convert options using PdfDocument.ConvertOptions property.
- Specify the width and height of output SVG file using PdfConvertOptions.SetPdfToSvgOptions() method.
- Convert the PDF file to SVG using PdfDocument.SaveToFile() method.
- C#
- VB.NET
using Spire.Pdf;
namespace PDFtoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument document = new PdfDocument();
//Load a sample PDF file
document.LoadFromFile("input.pdf");
//Specify the width and height of output SVG file
document.ConvertOptions.SetPdfToSvgOptions(800f, 1200f);
//Convert PDF to SVG
document.SaveToFile("result.svg", FileFormat.SVG);
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
C#/VB.NET: Converter PDF em SVG
Índice
Instalado via NuGet
PM> Install-Package Spire.PDF
Links Relacionados
SVG (Scalable Vector Graphics) é um formato de arquivo de imagem usado para renderizar imagens bidimensionais na web. Comparado com outros formatos de arquivo de imagem, o SVG tem muitas vantagens, como suporte à interatividade e animação, permitindo aos usuários pesquisar, indexar, criar scripts e compactar/ampliar imagens sem perder qualidade. Ocasionalmente, você pode precisar converta arquivos PDF para o formato de arquivo SVG e este artigo demonstrará como realizar essa tarefa usando o Spire.PDF for .NET.
- Converter um arquivo PDF em SVG em C#/VB.NET
- Converter páginas PDF selecionadas em SVG em C#/VB.NET
- Converta um arquivo PDF em SVG com largura e altura personalizadas em C#/VB.NET
Instale 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
Converter um arquivo PDF em SVG em C#/VB.NET
Spire.PDF for .NET oferece o método PdfDocument.SaveToFile(String, FileFormat) para converter cada página de um arquivo PDF em um único arquivo SVG. As etapas detalhadas são as seguintes.
- Crie um objeto PdfDocument.
- Carregue um arquivo PDF de amostra usando o método PdfDocument.LoadFromFile().
- Converta o arquivo PDF para SVG usando o método PdfDocument.SaveToFile(String, FileFormat).
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPDFtoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument document = new PdfDocument();
//Load a sample PDF file
document.LoadFromFile("input.pdf");
//Convert PDF to SVG
document.SaveToFile("PDFtoSVG.svg", FileFormat.SVG);
}
}
}

Converter páginas PDF selecionadas em SVG em C#/VB.NET
O método PdfDocument.SaveToFile(String, Int32, Int32, FileFormat) permite converter as páginas especificadas em um arquivo PDF em arquivos SVG. As etapas detalhadas são as seguintes.
- Crie um objeto PdfDocument.
- Carregue um arquivo PDF de amostra usando o método PdfDocument.LoadFromFile().
- Converta páginas PDF selecionadas em SVG usando o método PdfDocument.SaveToFile(String, Int32, Int32, FileFormat).
- C#
- VB.NET
using Spire.Pdf;
namespace PDFPagetoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a sample PDF file
doc.LoadFromFile("input.pdf");
//Convert selected PDF pages to SVG
doc.SaveToFile("PDFPagetoSVG.svg", 1, 2, FileFormat.SVG);
}
}
}

Converta um arquivo PDF em SVG com largura e altura personalizadas em C#/VB.NET
O método PdfConvertOptions.SetPdfToSvgOptions() oferecido pelo Spire.PDF for .NET permite especificar a largura e a altura do arquivo SVG de saída. As etapas detalhadas são as seguintes.
- Crie um objeto PdfDocument.
- Carregue um arquivo PDF de amostra usando o método PdfDocument.LoadFromFile().
- Defina as opções de conversão de PDF usando a propriedade PdfDocument.ConvertOptions.
- Especifique a largura e a altura do arquivo SVG de saída usando o método PdfConvertOptions.SetPdfToSvgOptions().
- Converta o arquivo PDF para SVG usando o método PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
namespace PDFtoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument document = new PdfDocument();
//Load a sample PDF file
document.LoadFromFile("input.pdf");
//Specify the width and height of output SVG file
document.ConvertOptions.SetPdfToSvgOptions(800f, 1200f);
//Convert PDF to SVG
document.SaveToFile("result.svg", FileFormat.SVG);
}
}
}

Solicite uma licença temporária
Se desejar 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ê mesmo.
C#/VB.NET: конвертирование PDF в SVG
Оглавление
Установлено через NuGet
PM> Install-Package Spire.PDF
Ссылки по теме
SVG (масштабируемая векторная графика) — это формат файлов изображений, используемый для рендеринга двумерных изображений в Интернете. По сравнению с другими форматами файлов изображений, SVG имеет множество преимуществ, таких как поддержка интерактивности и анимации, позволяющая пользователям искать, индексировать, создавать сценарии и сжимать/увеличивать изображения без потери качества. Иногда вам может понадобиться конвертируйте PDF-файлы в формат SVG, и в этой статье будет показано, как выполнить эту задачу с помощью Spire.PDF for .NET.
- Преобразование PDF-файла в SVG в C#/VB.NET
- Преобразование выбранных страниц PDF в SVG в C#/VB.NET
- Преобразование PDF-файла в SVG с произвольной шириной и высотой в C#/VB.NET
Установите Spire.PDF for .NET
Для начала вам необходимо добавить файлы DLL, включенные в пакет Spire.PDF for.NET, в качестве ссылок в ваш проект .NET. Файлы DLL можно загрузить по этой ссылке или установить через NuGet.
PM> Install-Package Spire.PDF
Преобразование PDF-файла в SVG в C#/VB.NET
Spire.PDF for .NET предлагает метод PdfDocument.SaveToFile(String, FileFormat) для преобразования каждой страницы файла PDF в один файл SVG. Подробные шаги заключаются в следующем.
- Создайте объект PDFDocument.
- Загрузите образец PDF-файла с помощью метода PdfDocument.LoadFromFile().
- Преобразуйте PDF-файл в SVG с помощью метода PdfDocument.SaveToFile(String, FileFormat).
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPDFtoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument document = new PdfDocument();
//Load a sample PDF file
document.LoadFromFile("input.pdf");
//Convert PDF to SVG
document.SaveToFile("PDFtoSVG.svg", FileFormat.SVG);
}
}
}

Преобразование выбранных страниц PDF в SVG в C#/VB.NET
Метод PdfDocument.SaveToFile(String, Int32, Int32, FileFormat) позволяет конвертировать указанные страницы в файле PDF в файлы SVG. Подробные шаги заключаются в следующем.
- Создайте объект PDFDocument.
- Загрузите образец PDF-файла с помощью метода PdfDocument.LoadFromFile().
- Преобразуйте выбранные страницы PDF в SVG с помощью метода PdfDocument.SaveToFile(String, Int32, Int32, FileFormat).
- C#
- VB.NET
using Spire.Pdf;
namespace PDFPagetoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a sample PDF file
doc.LoadFromFile("input.pdf");
//Convert selected PDF pages to SVG
doc.SaveToFile("PDFPagetoSVG.svg", 1, 2, FileFormat.SVG);
}
}
}

Преобразование PDF-файла в SVG с произвольной шириной и высотой в C#/VB.NET
Метод PdfConvertOptions.SetPdfToSvgOptions(), предлагаемый Spire.PDF for .NET, позволяет указать ширину и высоту выходного файла SVG. Подробные шаги заключаются в следующем.
- Создайте объект PDFDocument.
- Загрузите образец PDF-файла с помощью метода PdfDocument.LoadFromFile().
- Установите параметры преобразования PDF с помощью свойства PdfDocument.ConvertOptions.
- Укажите ширину и высоту выходного SVG-файла с помощью метода PdfConvertOptions.SetPdfToSvgOptions().
- Преобразуйте PDF-файл в SVG с помощью метода PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
namespace PDFtoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument document = new PdfDocument();
//Load a sample PDF file
document.LoadFromFile("input.pdf");
//Specify the width and height of output SVG file
document.ConvertOptions.SetPdfToSvgOptions(800f, 1200f);
//Convert PDF to SVG
document.SaveToFile("result.svg", FileFormat.SVG);
}
}
}

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