VB.NET PDF: How to HTML5 PDF Viewer & Editor PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF PDF Viewer & Editor Work with Other SDKs Barcode Read Barcode Create OCR Twain
Create PDF from PowerPoint
  |  
Home ›› XDoc.PDF ›› VB.NET PDF: Create PDF from PowerPoint

VB.NET PDF - Create PDF from Microsoft Office PowerPoint in VB.NET


VB.NET Tutorial for Export PDF file from Microsoft Office PowerPoint Using VB Programming Language




Best Microsoft Office PowerPoint to adobe PDF file converter SDK for Visual Studio .NET


Support Create PDF from ppt and pptx formats in VB.NET WinForms program and ASP.NET project


Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint


Turn all PowerPoint presentation into high quality PDF without losing formatting in VB.NET


Convert to PDF with embedded fonts or without original fonts fast in VB.NET


Convert multiple pages PowerPoint to fillable and editable PDF documents


Easy to create searchable and scanned PDF files from PowerPoint in Visual Basic .NET


Professional .NET PDF converter control for batch conversion


Export PowerPoint hyperlink to PDF


Create PDF file from PowerPoint free online without email


Source code is provided for VB.NET class


Evaluation library and components for .NET framework




VB.NET Demo Code  for Converting PowerPoint to PDF



Add necessary references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Raster.dll


  RasterEdge.XDoc.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


  RasterEdge.XDoc.PowerPoint.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PowerPoint;


  using RasterEdge.XDoc.PDF;


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:

       

       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.

       

       If using x86, the platform target should be x86.




VB.NET Sample Code: Convert PowerPoint to PDF in VB.NET Project



Following is VB.NET demo code for PowerPoint(.pptx/.ppsm/.potm/.ppsx/.potx) to PDF conversion.



Dim inputFilePath As String = "C:\1.pptx"
Dim outputFilePath As String = "C:\Output.pdf"

' Load a PowerPoint(.pptx) document.
Dim doc As PPTXDocument = New PPTXDocument(inputFilePath)

' Convert it to PDF document.
doc.ConvertToDocument(DocumentType.PDF, outputFilePath)




Following is VB.NET demo code for PowerPoint(.ppt/.pps) to PDF conversion.



Dim inputFilePath As String = "C:\1.ppt"
Dim outputFilePath As String = "C:\Output.pdf"

' Load a PowerPoint(.ppt) document.
Dim doc As PPTDocument = New PPTDocument(inputFilePath)

' Convert it to PDF document.
doc.ConvertToDocument(DocumentType.PDF, outputFilePath)





VB.NET Convert two or multiple PowerPoint files to PDF (batch convert)



Following is VB.NET demo code for PowerPoint(.pptx/.ppsm/.potm/.ppsx/.potx) to PDF conversion.



Dim inputDirectory As String = "C:\input\"
Dim outputDirectory As String = "C:\Output\"
Dim files() As String = Directory.GetFiles(inputDirectory, "*.pptx")

' convert powerpoint document to pdf one by one.
For Each filePath As String In  files
       Dim doc As PPTXDocument = New PPTXDocument(filePath)
       Dim startIdx As Integer = filePath.LastIndexOf("\")
       Dim endIdx As Integer = filePath.LastIndexOf(".")
       Dim docName As String = filePath.SubString(startIdx + 1, endIdx - startIdx - 1)
       ' Convert it to PDF document.
       doc.ConvertToDocument(DocumentType.PDF, outputDirectory + docName + ".pdf")
Next




Following is VB.NET demo code for PowerPoint(.ppt/.pps) to PDF conversion.



Dim inputDirectory As String = "C:\input\"
Dim outputDirectory As String = "C:\Output\"
Dim files() As String = Directory.GetFiles(inputDirectory, "*.ppt")

' convert powerpoint document to pdf one by one.
For Each filePath As String In  files
       Dim doc As PPTDocument = New PPTDocument(filePath)
       Dim startIdx As Integer = filePath.LastIndexOf("\")
       Dim endIdx As Integer = filePath.LastIndexOf(".")
       Dim docName As String = filePath.SubString(startIdx + 1, endIdx - startIdx - 1)
       ' Convert it to PDF document.
       doc.ConvertToDocument(DocumentType.PDF, outputDirectory + docName + ".pdf")
Next





VB.NET Convert two or multiple PowerPoint files to one PDF



Following is VB.NET demo code for PowerPoint(.pptx/.ppsm/.potm/.ppsx/.potx) to PDF conversion.



Dim files() As String = { "C:\demo1.pptx", "C:\demo2.pptx", "C:\demo3.pptx" }
Dim outputFilePath As String = "C:\output.pdf"
Dim streams As List(Of MemoryStream) = New List(Of MemoryStream)()
For Each filePath As String In  files
       Dim doc As PPTXDocument = New PPTXDocument(filePath)
       Dim outputStream As MemoryStream = New MemoryStream()
       ' Convert it to PDF document.
       doc.ConvertToDocument(DocumentType.PDF, outputStream)
       streams.Add(outputStream)
Next
PDFDocument.CombineDocument(streams, outputFilePath)




Following is VB.NET demo code for PowerPoint(.ppt/.pps) to PDF conversion.



Dim files() As String = { "C:\demo1.ppt", "C:\demo2.ppt", "C:\demo3.ppt" }
Dim outputFilePath As String = "C:\output.pdf"
Dim streams As List(Of MemoryStream) = New List(Of MemoryStream)()
For Each filePath As String In  files
       Dim doc As PPTDocument = New PPTDocument(filePath)
       Dim outputStream As MemoryStream = New MemoryStream()
       ' Convert it to PDF document.
       doc.ConvertToDocument(DocumentType.PDF, outputStream)
       streams.Add(outputStream)
Next
PDFDocument.CombineDocument(streams, outputFilePath)





VB.NET insert PowerPoint file into pdf document, and create a new PDF file



Following is VB.NET demo code to Insert PowerPoint(.pptx/.ppsm/.potm/.ppsx/.potx) to PDF at specific location.



Dim filePath As String = "C:\demo.pptx"
Dim doc As PPTXDocument = New PPTXDocument(filePath)
Dim stream As MemoryStream = New MemoryStream()
doc.ConvertToDocument(DocumentType.PDF, stream)
Dim pdf As PDFDocument = New PDFDocument(stream)
Dim pageCount As Integer = pdf.GetPageCount()
Dim pages List(Of BasePage) = New List(Of BasePage)() 
For i As Integer = 0 To pageCount - 1
       pages.Add(pdf.GetPage(i))
Next
Dim outputPdf As String = "C:\output.pdf"
Dim desDoc As PDFDocument = New PDFDocument(outputPdf)
Dim insertLocation As Integer = 2
desDoc.InsertPages(pages.ToArray(), insertLocation)
desDoc.Save("C:\desDocument.pdf")




Following is VB.NET demo code to Insert PowerPoint(.ppt/.pps) to PDF at specific location.



Dim filePath As String = "C:\demo.ppt"
Dim doc As PPTDocument = New PPTDocument(filePath)
Dim stream As MemoryStream = New MemoryStream()
doc.ConvertToDocument(DocumentType.PDF, stream)
Dim pdf As PDFDocument = New PDFDocument(stream)
Dim pageCount As Integer = pdf.GetPageCount()
Dim pages List(Of BasePage) = New List(Of BasePage)() 
For i As Integer = 0 To pageCount - 1
       pages.Add(pdf.GetPage(i))
Next
Dim outputPdf As String = "C:\demo.pdf"
Dim desDoc As PDFDocument = New PDFDocument(outputPdf)
Dim insertLocation As Integer = 2
desDoc.InsertPages(pages.ToArray(), insertLocation)
desDoc.Save("C:\desDocument.pdf")