C#/VB.NET: convertir HTML a PDF
Tabla de contenido
Instalado a través de NuGet
PM> Install-Package Spire.PDF
enlaces relacionados
La conversión de contenido HTML a PDF ofrece muchas ventajas, incluida la capacidad de leerlo sin conexión, así como la conservación del contenido y el formato con alta fidelidad. Spire.PDF proporciona dos métodos para convertir HTML a PDF, uno es usar el complemento web QT, el otro es no usar el complemento. Le recomendamos que utilice el complemento QT para realizar la conversión.
Las siguientes secciones muestran cómo representar una página web HTML (URL) o una cadena HTML en un documento PDF usando Spire.PDF for .NET con o sin el complemento QT.
- Convierta una URL a PDF con el complemento QT
- Convierta una cadena HTML a PDF con el complemento QT
- Convertir una URL a PDF sin complemento
- Convierta una cadena HTML a PDF sin complemento
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
Descargar complemento
Si elige el método de complemento, descargue el complemento que se ajuste a su sistema operativo desde el siguiente enlace.
Descomprima el paquete en algún lugar de su disco para obtener la carpeta "complementos". En este ejemplo, guardamos el complemento en la ruta "F:\Libraries\Plugin\plugins-windows-x64\plugins".

Además, le recomendamos que establezca el "Objetivo de la plataforma" de su proyecto en x64 o x86 según corresponda.

Convierta una URL a PDF con el complemento QT
Los siguientes son los pasos para convertir una URL a PDF usando Spire.PDF con el complemento QT.
- Especifique la ruta URL para convertir.
- Especifique la ruta del archivo PDF generado.
- Especifique la ruta del complemento y asígnela como el valor de la propiedad HtmlConverter.PluginPath.
- Llame al método HtmlConverter.Convert(string url, string fileName, bool enableJavaScript, int timeout, SizeF pageSize, PdfMargins margins) para convertir una URL en un documento PDF.
- C#
- VB.NET
using Spire.Pdf.Graphics;
using Spire.Pdf.HtmlConverter.Qt;
using System.Drawing;
namespace ConvertUrlToPdf
{
class Program
{
static void Main(string[] args)
{
//Specify the URL path
string url = "https://www.wikipedia.org/";
//Specify the output file path
string fileName = "UrlToPdf.pdf";
//Specify the plugin path
string pluginPath = "F:\\Libraries\\Plugin\\plugins-windows-x64\\plugins";
//Set the plugin path
HtmlConverter.PluginPath = pluginPath;
//Convert URL to PDF
HtmlConverter.Convert(url, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0));
}
}
}
Convierta una cadena HTML a PDF con el complemento QT
Los siguientes son los pasos para convertir una cadena HTML a PDF usando Spire.PDF con el complemento QT.
- Obtenga la cadena HTML de un archivo .html.
- Especifique la ruta del archivo PDF generado.
- Especifique la ruta del complemento y asígnela como el valor de la propiedad HtmlConverter.PluginPath.
- Llame al método HtmlConverter.Convert(string htmlString, string fileName, bool enableJavaScript, int timeout, SizeF pageSize, PdfMargins margins, Spire.Pdf.HtmlConverter.LoadHtmlType htmlType) para convertir una cadena HTML en un documento PDF.
Nota: Solo el estilo CSS en línea y el estilo CSS interno se pueden representar correctamente en PDF. Si tiene una hoja de estilo CSS externa, conviértala a un estilo CSS en línea o interno.
- C#
- VB.NET
using System.IO;
using Spire.Pdf.HtmlConverter.Qt;
using System.Drawing;
using Spire.Pdf.Graphics;
namespace ConvertHtmlStringToPdfWithPlugin
{
class Program
{
static void Main(string[] args)
{
//Get the HTML string from a .html file
string htmlString = File.ReadAllText(@"C:\Users\Administrator\Desktop\Document\Html\Sample.html");
//Specify the output file path
string fileName = "HtmlStringToPdf.pdf";
//Specify the plugin path
string pluginPath = "F:\\Libraries\\Plugin\\plugins-windows-x64\\plugins";
//Set plugin path
HtmlConverter.PluginPath = pluginPath;
//Convert HTML string to PDF
HtmlConverter.Convert(htmlString, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0), Spire.Pdf.HtmlConverter.LoadHtmlType.SourceCode);
}
}
}
Convertir una URL a PDF sin complemento
Los siguientes son los pasos para convertir una URL a PDF usando Spire.PDF sin complemento.
- Cree un objeto PdfDocument.
- Cree un objeto PdfPageSettings y establezca el tamaño de página y los márgenes a través de él.
- Cree un objeto PdfHtmlLayoutFormat y establezca su propiedad IsWaiting en true.
- Especifique la ruta URL para convertir.
- Cargue HTML desde la ruta URL usando el método PdfDocument.LoadFromHTML().
- Guarde el documento en un archivo PDF utilizando el método PdfDocument.SaveToFile().
- C#
- VB.NET
using System;
using Spire.Pdf;
using System.Threading;
using Spire.Pdf.HtmlConverter;
using System.Drawing;
namespace ConverUrlToPdfWithoutPlugin
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Create a PdfPageSettings object
PdfPageSettings setting = new PdfPageSettings();
//Save page size and margins through the object
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
//Create a PdfHtmlLayoutFormat object
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
//Set IsWaiting property to true
htmlLayoutFormat.IsWaiting = true;
//Specific the URL path to convert
String url = "https://www.wikipedia.org/";
//Load HTML from a URL path using LoadFromHTML method
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(url, true, true, false, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Save the document to a PDF file
doc.SaveToFile("UrlToPdf.pdf");
doc.Close();
}
}
}
Convierta una cadena HTML a PDF sin complemento
Los siguientes son los pasos para convertir una cadena HTML a PDF usando Spire.PDF sin complemento.
- Cree un objeto PdfDocument.
- Cree un objeto PdfPageSettings y establezca el tamaño de página y los márgenes a través de él.
- Cree un objeto PdfHtmlLayoutFormat y establezca su propiedad IsWaiting en true.
- Lea la cadena HTML de un archivo .html.
- Cargue HTML desde la cadena HTML utilizando el método PdfDocument.LoadFromHTML().
- Guarde el documento en un archivo PDF utilizando el método PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.HtmlConverter;
using System.IO;
using System.Threading;
using System.Drawing;
namespace ConvertHtmlStringToPdfWithoutPlugin
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Create a PdfPageSettings object
PdfPageSettings setting = new PdfPageSettings();
//Save page size and margins through the object
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
//Create a PdfHtmlLayoutFormat object
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
//Set IsWaiting property to true
htmlLayoutFormat.IsWaiting = true;
//Read html string from a .html file
string htmlString = File.ReadAllText(@"C:\Users\Administrator\Desktop\Document\Html\Sample.html");
//Load HTML from html string using LoadFromHTML method
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(htmlString, true, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Save to a PDF file
doc.SaveToFile("HtmlStringToPdf.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: HTML을 PDF로 변환
목차
NuGet을 통해 설치됨
PM> Install-Package Spire.PDF
관련된 링크들
HTML 콘텐츠를 PDF로 변환하면 오프라인에서 읽을 수 있을 뿐만 아니라 콘텐츠와 서식을 높은 충실도로 보존하는 등 많은 이점이 있습니다. Spire.PDF는 두 가지 방법을 제공합니다 HTML을 PDF로 변환, 하나는 QT 웹 플러그인을 사용하는 것이고, 다른 하나는 플러그인을 사용하지 않는 것입니다. QT 플러그인을 사용하여 변환을 수행하는 것이 좋습니다.
다음 섹션에서는 QT 플러그인이 있거나 없는 Spire.PDF for .NET 사용하여 HTML 웹 페이지(URL) 또는 HTML 문자열을 PDF 문서로 렌더링하는 방법을 보여줍니다.
- QT 플러그인을 사용하여 URL을 PDF로 변환
- QT 플러그인을 사용하여 HTML 문자열을 PDF로 변환
- 플러그인 없이 URL을 PDF로 변환
- 플러그인 없이 HTML 문자열을 PDF로 변환
Spire.PDF for .NET 설치
먼저 Spire.PDF for .NET 패키지에 포함된 DLL 파일을 .NET 프로젝트의 참조로 추가해야 합니다. DLL 파일은 다음에서 다운로드할 수 있습니다 이 링크 또는 NuGet을 통해 설치됩니다.
PM> Install-Package Spire.PDF
플러그인 다운로드
플러그인 방식을 선택하셨다면 아래 링크에서 자신의 운영체제에 맞는 플러그인을 다운로드 받으시기 바랍니다.
"플러그인" 폴더를 가져오려면 디스크 어딘가에 패키지의 압축을 풉니다. 이 예에서는 플러그인을 "F:\Libraries\Plugin\plugins-windows-x64\plugins"." 경로에 저장했습니다.

또한 그에 따라 프로젝트의 "플랫폼 대상"을 x64 또는 x86으로 설정하는 것이 좋습니다.

QT 플러그인을 사용하여 URL을 PDF로 변환
다음은 QT 플러그인과 함께 Spire.PDF를 사용하여 URL을 PDF로 변환하는 단계입니다.
- 변환할 URL 경로를 지정합니다.
- 생성된 PDF 파일의 경로를 지정합니다.
- 플러그인 경로를 지정하고 HtmlConverter.PluginPath 속성 값으로 할당합니다.
- HtmlConverter.Convert(string url, string fileName, bool enableJavaScript, int timeout, SizeF pageSize, PdfMargins margins) 메서드를 호출하여 URL을 PDF 문서로 변환합니다.
- C#
- VB.NET
using Spire.Pdf.Graphics;
using Spire.Pdf.HtmlConverter.Qt;
using System.Drawing;
namespace ConvertUrlToPdf
{
class Program
{
static void Main(string[] args)
{
//Specify the URL path
string url = "https://www.wikipedia.org/";
//Specify the output file path
string fileName = "UrlToPdf.pdf";
//Specify the plugin path
string pluginPath = "F:\\Libraries\\Plugin\\plugins-windows-x64\\plugins";
//Set the plugin path
HtmlConverter.PluginPath = pluginPath;
//Convert URL to PDF
HtmlConverter.Convert(url, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0));
}
}
}
QT 플러그인을 사용하여 HTML 문자열을 PDF로 변환
다음은 QT 플러그인과 함께 Spire.PDF를 사용하여 HTML 문자열을 PDF로 변환하는 단계입니다.
- .html 파일에서 HTML 문자열을 가져옵니다.
- 생성된 PDF 파일의 경로를 지정합니다.
- 플러그인 경로를 지정하고 HtmlConverter.PluginPath 속성 값으로 할당합니다.
- HtmlConverter.Convert(string htmlString, string fileName, bool enableJavaScript, int timeout, SizeF pageSize, PdfMargins margins, Spire.Pdf.HtmlConverter.LoadHtmlType htmlType) 메서드를 호출하여 HTML 문자열을 PDF 문서로 변환합니다.
참고: 인라인 CSS 스타일과 내부 CSS 스타일만 PDF에서 올바르게 렌더링할 수 있습니다. 외부 CSS 스타일 시트가 있는 경우 인라인 또는 내부 CSS 스타일로 변환하십시오.
- C#
- VB.NET
using System.IO;
using Spire.Pdf.HtmlConverter.Qt;
using System.Drawing;
using Spire.Pdf.Graphics;
namespace ConvertHtmlStringToPdfWithPlugin
{
class Program
{
static void Main(string[] args)
{
//Get the HTML string from a .html file
string htmlString = File.ReadAllText(@"C:\Users\Administrator\Desktop\Document\Html\Sample.html");
//Specify the output file path
string fileName = "HtmlStringToPdf.pdf";
//Specify the plugin path
string pluginPath = "F:\\Libraries\\Plugin\\plugins-windows-x64\\plugins";
//Set plugin path
HtmlConverter.PluginPath = pluginPath;
//Convert HTML string to PDF
HtmlConverter.Convert(htmlString, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0), Spire.Pdf.HtmlConverter.LoadHtmlType.SourceCode);
}
}
}
플러그인 없이 URL을 PDF로 변환
다음은 플러그인 없이 Spire.PDF를 사용하여 URL을 PDF로 변환하는 단계입니다.
- PdfDocument 개체를 만듭니다.
- PdfPageSettings 개체를 만들고 이를 통해 페이지 크기와 여백을 설정합니다.
- PdfHtmlLayoutFormat 개체를 만들고 해당 개체의 IsWaiting 속성을 true로 설정합니다.
- 변환할 URL 경로를 지정합니다.
- PdfDocument.LoadFromHTML() 메서드를 사용하여 URL 경로에서 HTML을 로드합니다.
- PdfDocument.SaveToFile() 메서드를 사용하여 문서를 PDF 파일로 저장합니다.
- C#
- VB.NET
using System;
using Spire.Pdf;
using System.Threading;
using Spire.Pdf.HtmlConverter;
using System.Drawing;
namespace ConverUrlToPdfWithoutPlugin
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Create a PdfPageSettings object
PdfPageSettings setting = new PdfPageSettings();
//Save page size and margins through the object
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
//Create a PdfHtmlLayoutFormat object
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
//Set IsWaiting property to true
htmlLayoutFormat.IsWaiting = true;
//Specific the URL path to convert
String url = "https://www.wikipedia.org/";
//Load HTML from a URL path using LoadFromHTML method
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(url, true, true, false, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Save the document to a PDF file
doc.SaveToFile("UrlToPdf.pdf");
doc.Close();
}
}
}
플러그인 없이 HTML 문자열을 PDF로 변환
다음은 플러그인 없이 Spire.PDF를 사용하여 HTML 문자열을 PDF로 변환하는 단계입니다.
- PdfDocument 개체를 만듭니다.
- PdfPageSettings 개체를 만들고 이를 통해 페이지 크기와 여백을 설정합니다.
- PdfHtmlLayoutFormat 개체를 만들고 해당 개체의 IsWaiting 속성을 true로 설정합니다.
- .html 파일에서 HTML 문자열을 읽습니다.
- PdfDocument.LoadFromHTML() 메서드를 사용하여 HTML 문자열에서 HTML을 로드합니다.
- PdfDocument.SaveToFile() 메서드를 사용하여 문서를 PDF 파일로 저장합니다.
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.HtmlConverter;
using System.IO;
using System.Threading;
using System.Drawing;
namespace ConvertHtmlStringToPdfWithoutPlugin
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Create a PdfPageSettings object
PdfPageSettings setting = new PdfPageSettings();
//Save page size and margins through the object
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
//Create a PdfHtmlLayoutFormat object
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
//Set IsWaiting property to true
htmlLayoutFormat.IsWaiting = true;
//Read html string from a .html file
string htmlString = File.ReadAllText(@"C:\Users\Administrator\Desktop\Document\Html\Sample.html");
//Load HTML from html string using LoadFromHTML method
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(htmlString, true, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Save to a PDF file
doc.SaveToFile("HtmlStringToPdf.pdf");
}
}
}
임시 면허 신청
생성된 문서에서 평가 메시지를 제거하거나 기능 제한을 제거하려면 다음을 수행하십시오 30일 평가판 라이선스 요청 자신을 위해.
C#/VB.NET: Converti HTML in PDF
Sommario
Installato tramite NuGet
PM> Install-Package Spire.PDF
Link correlati
La conversione di contenuto HTML in PDF offre molti vantaggi, tra cui la possibilità di leggerlo offline, oltre a preservare il contenuto e la formattazione con alta fedeltà. Spire.PDF fornisce due metodi per convertire HTML in PDF, uno è usare il plugin QT Web, l'altro è non usare il plugin. Ti consigliamo di utilizzare il plug-in QT per eseguire la conversione.
Le sezioni seguenti mostrano come eseguire il rendering di una pagina Web HTML (URL) o di una stringa HTML in un documento PDF utilizzando Spire.PDF for .NET con o senza plug-in QT.
- Converti un URL in PDF con QT Plugin
- Converti una stringa HTML in PDF con QT Plugin
- Converti un URL in PDF senza plug-in
- Converti una stringa HTML in PDF senza plug-in
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
Scarica il plug-in
Se scegli il metodo plugin, scarica il plugin che si adatta al tuo sistema operativo dal seguente link.
Decomprimi il pacchetto da qualche parte sul tuo disco per ottenere la cartella "plugins". In questo esempio, abbiamo salvato il plugin nel percorso "F:\Libraries\Plugin\plugins-windows-x64\plugins".

Inoltre, ti consigliamo di impostare di conseguenza il "Target della piattaforma" del tuo progetto su x64 o x86.

Converti un URL in PDF con QT Plugin
Di seguito sono riportati i passaggi per convertire un URL in PDF utilizzando Spire.PDF con il plug-in QT.
- Specifica il percorso dell'URL da convertire.
- Specificare il percorso del file PDF generato.
- Specificare il percorso del plug-in e assegnarlo come valore della proprietà HtmlConverter.PluginPath.
- Chiamare il metodo HtmlConverter.Convert(string url, string fileName, bool enableJavaScript, int timeout, SizeF pageSize, PdfMargins margins) per convertire un URL in un documento PDF.
- C#
- VB.NET
using Spire.Pdf.Graphics;
using Spire.Pdf.HtmlConverter.Qt;
using System.Drawing;
namespace ConvertUrlToPdf
{
class Program
{
static void Main(string[] args)
{
//Specify the URL path
string url = "https://www.wikipedia.org/";
//Specify the output file path
string fileName = "UrlToPdf.pdf";
//Specify the plugin path
string pluginPath = "F:\\Libraries\\Plugin\\plugins-windows-x64\\plugins";
//Set the plugin path
HtmlConverter.PluginPath = pluginPath;
//Convert URL to PDF
HtmlConverter.Convert(url, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0));
}
}
}
Converti una stringa HTML in PDF con QT Plugin
Di seguito sono riportati i passaggi per convertire una stringa HTML in PDF utilizzando Spire.PDF con il plug-in QT.
- Ottieni la stringa HTML da un file .html.
- Specificare il percorso del file PDF generato.
- Specificare il percorso del plug-in e assegnarlo come valore della proprietà HtmlConverter.PluginPath.
- Chiama il metodo HtmlConverter.Convert(string htmlString, string fileName, bool enableJavaScript, int timeout, SizeF pageSize, PdfMargins margins, Spire.Pdf.HtmlConverter.LoadHtmlType htmlType) per convertire la stringa HTML in un documento PDF.
Nota: solo lo stile CSS in linea e lo stile CSS interno possono essere visualizzati correttamente su PDF. Se disponi di un foglio di stile CSS esterno, convertilo in uno stile CSS in linea o interno.
- C#
- VB.NET
using System.IO;
using Spire.Pdf.HtmlConverter.Qt;
using System.Drawing;
using Spire.Pdf.Graphics;
namespace ConvertHtmlStringToPdfWithPlugin
{
class Program
{
static void Main(string[] args)
{
//Get the HTML string from a .html file
string htmlString = File.ReadAllText(@"C:\Users\Administrator\Desktop\Document\Html\Sample.html");
//Specify the output file path
string fileName = "HtmlStringToPdf.pdf";
//Specify the plugin path
string pluginPath = "F:\\Libraries\\Plugin\\plugins-windows-x64\\plugins";
//Set plugin path
HtmlConverter.PluginPath = pluginPath;
//Convert HTML string to PDF
HtmlConverter.Convert(htmlString, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0), Spire.Pdf.HtmlConverter.LoadHtmlType.SourceCode);
}
}
}
Converti un URL in PDF senza plug-in
Di seguito sono riportati i passaggi per convertire un URL in PDF utilizzando Spire.PDF senza plug-in.
- Creare un oggetto PdfDocument.
- Crea un oggetto PdfPageSettings e imposta le dimensioni e i margini della pagina attraverso di esso.
- Creare un oggetto PdfHtmlLayoutFormat e impostarne la proprietà IsWaiting su true.
- Specifica il percorso dell'URL da convertire.
- Carica HTML dal percorso dell'URL utilizzando il metodo PdfDocument.LoadFromHTML().
- Salvare il documento in un file PDF utilizzando il metodo PdfDocument.SaveToFile().
- C#
- VB.NET
using System;
using Spire.Pdf;
using System.Threading;
using Spire.Pdf.HtmlConverter;
using System.Drawing;
namespace ConverUrlToPdfWithoutPlugin
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Create a PdfPageSettings object
PdfPageSettings setting = new PdfPageSettings();
//Save page size and margins through the object
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
//Create a PdfHtmlLayoutFormat object
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
//Set IsWaiting property to true
htmlLayoutFormat.IsWaiting = true;
//Specific the URL path to convert
String url = "https://www.wikipedia.org/";
//Load HTML from a URL path using LoadFromHTML method
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(url, true, true, false, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Save the document to a PDF file
doc.SaveToFile("UrlToPdf.pdf");
doc.Close();
}
}
}
Converti una stringa HTML in PDF senza plug-in
Di seguito sono riportati i passaggi per convertire una stringa HTML in PDF utilizzando Spire.PDF senza plug-in.
- Creare un oggetto PdfDocument.
- Crea un oggetto PdfPageSettings e imposta le dimensioni e i margini della pagina attraverso di esso.
- Creare un oggetto PdfHtmlLayoutFormat e impostarne la proprietà IsWaiting su true.
- Leggere la stringa HTML da un file .html.
- Carica HTML dalla stringa HTML utilizzando il metodo PdfDocument.LoadFromHTML().
- Salvare il documento in un file PDF utilizzando il metodo PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.HtmlConverter;
using System.IO;
using System.Threading;
using System.Drawing;
namespace ConvertHtmlStringToPdfWithoutPlugin
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Create a PdfPageSettings object
PdfPageSettings setting = new PdfPageSettings();
//Save page size and margins through the object
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
//Create a PdfHtmlLayoutFormat object
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
//Set IsWaiting property to true
htmlLayoutFormat.IsWaiting = true;
//Read html string from a .html file
string htmlString = File.ReadAllText(@"C:\Users\Administrator\Desktop\Document\Html\Sample.html");
//Load HTML from html string using LoadFromHTML method
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(htmlString, true, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Save to a PDF file
doc.SaveToFile("HtmlStringToPdf.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 : convertir HTML en PDF
Table des matières
Installé via NuGet
PM> Install-Package Spire.PDF
Liens connexes
La conversion de contenu HTML en PDF offre de nombreux avantages, notamment la possibilité de le lire hors ligne, ainsi que la préservation du contenu et de la mise en forme avec une haute fidélité. Spire.PDF fournit deux méthodes pour convertir HTML en PDF, l'une consiste à utiliser le plugin QT Web, l'autre à ne pas utiliser le plugin. Nous vous recommandons d'utiliser le plugin QT pour effectuer la conversion.
Les sections suivantes montrent comment rendre une page Web HTML (URL) ou une chaîne HTML dans un document PDF à l'aide de Spire.PDF for .NET avec ou sans le plug-in QT.
- Convertir une URL en PDF avec QT Plugin
- Convertir une chaîne HTML en PDF avec le plugin QT
- Convertir une URL en PDF sans plugin
- Convertir une chaîne HTML en PDF sans plugin
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 à partir de ce lien ou installés via NuGet.
PM> Install-Package Spire.PDF
Télécharger le plugin
Si vous choisissez la méthode du plugin, veuillez télécharger le plugin qui correspond à votre système d'exploitation à partir du lien suivant.
Décompressez le package quelque part sur votre disque pour obtenir le dossier "plugins". Dans cet exemple, nous avons enregistré le plugin sous le chemin "F:\Libraries\Plugin\plugins-windows-x64\plugins".

De plus, nous vous recommandons de définir la "plate-forme cible" de votre projet sur x64 ou x86 en conséquence.

Convertir une URL en PDF avec QT Plugin
Voici les étapes pour convertir une URL en PDF en utilisant Spire.PDF avec le plugin QT.
- Spécifiez le chemin de l'URL à convertir.
- Spécifiez le chemin du fichier PDF généré.
- Spécifiez le chemin du plug-in et affectez-le comme valeur de la propriété HtmlConverter.PluginPath.
- Appelez la méthode HtmlConverter.Convert(string url, string fileName, bool enableJavaScript, int timeout, SizeF pageSize, PdfMargins margins) pour convertir une URL en un document PDF.
- C#
- VB.NET
using Spire.Pdf.Graphics;
using Spire.Pdf.HtmlConverter.Qt;
using System.Drawing;
namespace ConvertUrlToPdf
{
class Program
{
static void Main(string[] args)
{
//Specify the URL path
string url = "https://www.wikipedia.org/";
//Specify the output file path
string fileName = "UrlToPdf.pdf";
//Specify the plugin path
string pluginPath = "F:\\Libraries\\Plugin\\plugins-windows-x64\\plugins";
//Set the plugin path
HtmlConverter.PluginPath = pluginPath;
//Convert URL to PDF
HtmlConverter.Convert(url, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0));
}
}
}
Convertir une chaîne HTML en PDF avec le plugin QT
Voici les étapes pour convertir une chaîne HTML en PDF à l'aide de Spire.PDF avec le plug-in QT.
- Obtenez la chaîne HTML à partir d'un fichier .html.
- Spécifiez le chemin du fichier PDF généré.
- Spécifiez le chemin du plug-in et affectez-le comme valeur de la propriété HtmlConverter.PluginPath.
- Appelez la méthode HtmlConverter.Convert(string htmlString, string fileName, bool enableJavaScript, int timeout, SizeF pageSize, PdfMargins margins, Spire.Pdf.HtmlConverter.LoadHtmlType htmlType) pour convertir la chaîne HTML en un document PDF.
Remarque: seuls le style CSS intégré et le style CSS interne peuvent être rendus correctement sur PDF. Si vous avez une feuille de style CSS externe, veuillez la convertir en style CSS intégré ou interne.
- C#
- VB.NET
using System.IO;
using Spire.Pdf.HtmlConverter.Qt;
using System.Drawing;
using Spire.Pdf.Graphics;
namespace ConvertHtmlStringToPdfWithPlugin
{
class Program
{
static void Main(string[] args)
{
//Get the HTML string from a .html file
string htmlString = File.ReadAllText(@"C:\Users\Administrator\Desktop\Document\Html\Sample.html");
//Specify the output file path
string fileName = "HtmlStringToPdf.pdf";
//Specify the plugin path
string pluginPath = "F:\\Libraries\\Plugin\\plugins-windows-x64\\plugins";
//Set plugin path
HtmlConverter.PluginPath = pluginPath;
//Convert HTML string to PDF
HtmlConverter.Convert(htmlString, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0), Spire.Pdf.HtmlConverter.LoadHtmlType.SourceCode);
}
}
}
Convertir une URL en PDF sans plugin
Voici les étapes pour convertir une URL en PDF en utilisant Spire.PDF sans plugin.
- Créez un objet PdfDocument.
- Créez un objet PdfPageSettings et définissez la taille de la page et les marges à travers celui-ci.
- Créez un objet PdfHtmlLayoutFormat et définissez sa propriété IsWaiting sur true.
- Spécifiez le chemin de l'URL à convertir.
- Chargez le code HTML à partir du chemin de l'URL à l'aide de la méthode PdfDocument.LoadFromHTML().
- Enregistrez le document dans un fichier PDF à l'aide de la méthode PdfDocument.SaveToFile().
- C#
- VB.NET
using System;
using Spire.Pdf;
using System.Threading;
using Spire.Pdf.HtmlConverter;
using System.Drawing;
namespace ConverUrlToPdfWithoutPlugin
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Create a PdfPageSettings object
PdfPageSettings setting = new PdfPageSettings();
//Save page size and margins through the object
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
//Create a PdfHtmlLayoutFormat object
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
//Set IsWaiting property to true
htmlLayoutFormat.IsWaiting = true;
//Specific the URL path to convert
String url = "https://www.wikipedia.org/";
//Load HTML from a URL path using LoadFromHTML method
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(url, true, true, false, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Save the document to a PDF file
doc.SaveToFile("UrlToPdf.pdf");
doc.Close();
}
}
}
Convertir une chaîne HTML en PDF sans plugin
Voici les étapes pour convertir une chaîne HTML en PDF en utilisant Spire.PDF sans plugin.
- Créez un objet PdfDocument.
- Créez un objet PdfPageSettings et définissez la taille de la page et les marges à travers celui-ci.
- Créez un objet PdfHtmlLayoutFormat et définissez sa propriété IsWaiting sur true.
- Lire la chaîne HTML à partir d'un fichier .html.
- Chargez le code HTML à partir de la chaîne HTML à l'aide de la méthode PdfDocument.LoadFromHTML().
- Enregistrez le document dans un fichier PDF à l'aide de la méthode PdfDocument.SaveToFile().
- C#
- VB.NET
using Spire.Pdf;
using Spire.Pdf.HtmlConverter;
using System.IO;
using System.Threading;
using System.Drawing;
namespace ConvertHtmlStringToPdfWithoutPlugin
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Create a PdfPageSettings object
PdfPageSettings setting = new PdfPageSettings();
//Save page size and margins through the object
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
//Create a PdfHtmlLayoutFormat object
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
//Set IsWaiting property to true
htmlLayoutFormat.IsWaiting = true;
//Read html string from a .html file
string htmlString = File.ReadAllText(@"C:\Users\Administrator\Desktop\Document\Html\Sample.html");
//Load HTML from html string using LoadFromHTML method
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(htmlString, true, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Save to a PDF file
doc.SaveToFile("HtmlStringToPdf.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 PowerPoint
Índice
Instalado via NuGet
PM> Install-Package Spire.PDF
Links Relacionados
Arquivos PDF são ótimos para apresentação em diferentes tipos de dispositivos e compartilhamento entre plataformas, mas é preciso admitir que editar PDF é um pouco desafiador. Quando você recebe um arquivo PDF e precisa preparar uma apresentação com base no conteúdo, é recomendável converter o arquivo PDF em um documento do PowerPoint para obter um melhor efeito de apresentação e também para garantir que o conteúdo possa ser editado posteriormente. Este artigo demonstrará como programaticamente converter PDF para apresentação do PowerPoint 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
Converter PDF para apresentação do PowerPoint em C# e VB.NET
A partir da versão 8.11.10, o Spire.PDF for .NET oferece suporte à conversão de PDF para PPTX usando o método PdfDocument.SaveToFile(). Com este método, cada página do seu arquivo PDF será convertida em um único slide no PowerPoint. Abaixo estão as etapas para converter um arquivo PDF em um documento editável do PowerPoint.
- Crie uma instância PdfDocument.
- Carregue um documento PDF de amostra usando o método PdfDocument.LoadFromFile().
- Salve o documento como um documento do PowerPoint usando o método PdfDocument.SaveToFile(string filename, FileFormat.PPTX).
- C#
- VB.NET
using Spire.Pdf;
namespace PDFtoPowerPoint
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
//Load a sample PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf");
//Convert the PDF to PPTX document
pdf.SaveToFile("ConvertPDFtoPowerPoint.pptx", FileFormat.PPTX);
}
}
}

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ê mesmo.
C#/VB.NET: преобразование PDF в PowerPoint
Оглавление
Установлено через NuGet
PM> Install-Package Spire.PDF
Ссылки по теме
Файлы PDF отлично подходят для представления на различных типах устройств и совместного использования на разных платформах, но следует признать, что редактирование PDF немного сложно. Когда вы получаете файл PDF и вам нужно подготовить презентацию на основе содержимого внутри, рекомендуется преобразовать файл PDF в документ PowerPoint, чтобы получить лучший эффект презентации, а также обеспечить возможность дальнейшего редактирования содержимого. В этой статье будет показано, как программно конвертировать PDF в презентацию PowerPoint с использованием Spire.PDF for .NET.
Установите Spire.PDF for .NET
Для начала вам нужно добавить файлы DLL, включенные в пакет Spire.PDF for .NET, в качестве ссылок в ваш проект .NET. Файлы DLL можно загрузить по этой ссылке или установить через NuGet.
PM> Install-Package Spire.PDF
Преобразование PDF в презентацию PowerPoint на C# и VB.NET
Начиная с версии 8.11.10, Spire.PDF for .NET поддерживает преобразование PDF в PPTX с помощью метода PdfDocument.SaveToFile(). С помощью этого метода каждая страница вашего файла PDF будет преобразована в один слайд в PowerPoint. Ниже приведены шаги для преобразования файла PDF в редактируемый документ PowerPoint.
- Создайте экземпляр PdfDocument.
- Загрузите образец PDF-документа с помощью метода PdfDocument.LoadFromFile().
- Сохраните документ как документ PowerPoint, используя метод PdfDocument.SaveToFile(string filename, FileFormat.PPTX).
- C#
- VB.NET
using Spire.Pdf;
namespace PDFtoPowerPoint
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
//Load a sample PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf");
//Convert the PDF to PPTX document
pdf.SaveToFile("ConvertPDFtoPowerPoint.pptx", FileFormat.PPTX);
}
}
}

Подать заявку на временную лицензию
Если вы хотите удалить оценочное сообщение из сгенерированных документов или избавиться от функциональных ограничений, пожалуйста запросить 30-дневную пробную лицензию для себя.
C#/VB.NET: PDF in PowerPoint konvertieren
Inhaltsverzeichnis
Über NuGet installiert
PM> Install-Package Spire.PDF
verwandte Links
PDF-Dateien eignen sich hervorragend zum Präsentieren auf verschiedenen Gerätetypen und zum Teilen auf verschiedenen Plattformen. Man muss jedoch zugeben, dass die Bearbeitung von PDF-Dateien eine gewisse Herausforderung darstellt. Wenn Sie eine PDF-Datei erhalten und eine Präsentation basierend auf dem Inhalt vorbereiten müssen, wird empfohlen, die PDF-Datei in ein PowerPoint-Dokument zu konvertieren, um einen besseren Präsentationseffekt zu erzielen und sicherzustellen, dass der Inhalt weiter bearbeitet werden kann. In diesem Artikel wird die programmgesteuerte Vorgehensweise demonstriert Konvertieren Sie PDF in eine PowerPoint-Präsentation verwenden 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 DLLs-Dateien können entweder über diesen Link heruntergeladen oder über NuGet installiert werden.
PM> Install-Package Spire.PDF
Konvertieren Sie PDF in eine PowerPoint-Präsentation in C# und VB.NET
Ab Version 8.11.10 unterstützt Spire.PDF for .NET die Konvertierung von PDF in PPTX mithilfe der Methode PdfDocument.SaveToFile(). Mit dieser Methode wird jede Seite Ihrer PDF-Datei in PowerPoint in eine einzelne Folie umgewandelt. Nachfolgend finden Sie die Schritte zum Konvertieren einer PDF-Datei in ein bearbeitbares PowerPoint-Dokument.
- Создайте экземпляр PdfDocument.
- Laden Sie ein Beispiel-PDF-Dokument mit der Methode PdfDocument.LoadFromFile().
- Speichern Sie das Dokument als PowerPoint-Dokument mit der Methode PdfDocument.SaveToFile(string filename, FileFormat.PPTX).
- C#
- VB.NET
using Spire.Pdf;
namespace PDFtoPowerPoint
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
//Load a sample PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf");
//Convert the PDF to PPTX document
pdf.SaveToFile("ConvertPDFtoPowerPoint.pptx", FileFormat.PPTX);
}
}
}

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: Convertir PDF a PowerPoint
Tabla de contenido
Instalado a través de NuGet
PM> Install-Package Spire.PDF
enlaces relacionados
Los archivos PDF son excelentes para presentar en diferentes tipos de dispositivos y compartir entre plataformas, pero hay que admitir que editar PDF es un poco desafiante. Cuando recibe un archivo PDF y necesita preparar una presentación basada en el contenido que contiene, se recomienda convertir el archivo PDF en un documento de PowerPoint para tener un mejor efecto de presentación y también para garantizar que el contenido se pueda editar más. Este artículo demostrará cómo programáticamente convertir PDF a presentación de PowerPoint 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
Convierta PDF a presentación de PowerPoint en C# y VB.NET
A partir de la versión 8.11.10, Spire.PDF for .NET admite la conversión de PDF a PPTX mediante el método PdfDocument.SaveToFile(). Con este método, cada página de su archivo PDF se convertirá en una sola diapositiva en PowerPoint. A continuación se muestran los pasos para convertir un archivo PDF en un documento de PowerPoint editable.
- Cree una instancia de PdfDocument.
- Cargue un documento PDF de muestra utilizando el método PdfDocument.LoadFromFile().
- Guarde el documento como un documento de PowerPoint utilizando el método PdfDocument.SaveToFile(string filename, FileFormat.PPTX).
- C#
- VB.NET
using Spire.Pdf;
namespace PDFtoPowerPoint
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
//Load a sample PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf");
//Convert the PDF to PPTX document
pdf.SaveToFile("ConvertPDFtoPowerPoint.pptx", FileFormat.PPTX);
}
}
}

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를 PowerPoint로 변환
NuGet을 통해 설치됨
PM> Install-Package Spire.PDF
관련된 링크들
PDF 파일은 다양한 유형의 장치에서 프레젠테이션하고 플랫폼 간에 공유하는 데 적합하지만 PDF 편집이 약간 어렵다는 점을 인정해야 합니다. PDF 파일을 받아 내용을 기반으로 프레젠테이션을 준비해야 하는 경우 PDF 파일을 PowerPoint 문서로 변환하여 프레젠테이션 효과를 높이고 내용을 추가로 편집할 수 있도록 하는 것이 좋습니다. 이 문서에서는 프로그래밍 방식으로 PDF를 PowerPoint 프레젠테이션으로 변환Spire.PDF for .NET사용.
Spire.PDF for .NET 설치
먼저 Spire.PDF for .NET 패키지에 포함된 DLL 파일을 .NET 프로젝트의 참조로 추가해야 합니다. DLL 파일은 다음에서 다운로드할 수 있습니다 이 링크 또는 NuGet을 통해 설치됩니다.
PM> Install-Package Spire.PDF
C# 및 VB.NET에서 PDF를 PowerPoint 프레젠테이션으로 변환
버전 8.11.10부터 Spire.PDF for .NET는 PdfDocument.SaveToFile() 메서드를 사용하여 PDF를 PPTX로 변환하는 것을 지원합니다. 이 방법을 사용하면 PDF 파일의 각 페이지가 PowerPoint의 단일 슬라이드로 변환됩니다. 다음은 PDF 파일을 편집 가능한 PowerPoint 문서로 변환하는 단계입니다.
- PdfDocument 인스턴스를 만듭니다.
- PdfDocument.LoadFromFile() 메서드를 사용하여 샘플 PDF 문서를 로드합니다.
- PdfDocument.SaveToFile(string filename, FileFormat.PPTX) 메서드를 사용하여 문서를 PowerPoint 문서로 저장합니다.
- C#
- VB.NET
using Spire.Pdf;
namespace PDFtoPowerPoint
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
//Load a sample PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf");
//Convert the PDF to PPTX document
pdf.SaveToFile("ConvertPDFtoPowerPoint.pptx", FileFormat.PPTX);
}
}
}

임시 면허 신청
생성된 문서에서 평가 메시지를 제거하거나 기능 제한을 제거하려면 다음을 수행하십시오 30일 평가판 라이선스 요청 자신을 위해.
C#/VB.NET: Converti PDF in PowerPoint
Sommario
Installato tramite NuGet
PM> Install-Package Spire.PDF
Link correlati
I file PDF sono ottimi per la presentazione su diversi tipi di dispositivi e la condivisione tra piattaforme, ma bisogna ammettere che la modifica del PDF è un po' impegnativa. Quando ricevi un file PDF e devi preparare una presentazione basata sul contenuto all'interno, si consiglia di convertire il file PDF in un documento PowerPoint per avere un migliore effetto di presentazione e anche per garantire che il contenuto possa essere ulteriormente modificato. Questo articolo dimostrerà come eseguire a livello di codice converti PDF in presentazioni PowerPoint 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
Converti PDF in presentazioni PowerPoint in C# e VB.NET
Dalla versione 8.11.10, Spire.PDF for .NET supporta la conversione da PDF a PPTX utilizzando il metodo PdfDocument.SaveToFile(). Con questo metodo, ogni pagina del tuo file PDF verrà convertita in una singola diapositiva in PowerPoint. Di seguito sono riportati i passaggi per convertire un file PDF in un documento PowerPoint modificabile.
- Creare un'istanza PdfDocument.
- Carica un documento PDF di esempio utilizzando il metodo PdfDocument.LoadFromFile().
- Salvare il documento come documento PowerPoint utilizzando il metodo PdfDocument.SaveToFile(string filename, FileFormat.PPTX).
- C#
- VB.NET
using Spire.Pdf;
namespace PDFtoPowerPoint
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
//Load a sample PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf");
//Convert the PDF to PPTX document
pdf.SaveToFile("ConvertPDFtoPowerPoint.pptx", FileFormat.PPTX);
}
}
}

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.