ByteScout Premium Suite - VB.NET - Convert xps to pdf with pdf sdk - ByteScout

ByteScout Premium Suite – VB.NET – Convert xps to pdf with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Premium Suite – VB.NET – Convert xps to pdf with pdf sdk

How to convert xps to pdf with pdf sdk in VB.NET and ByteScout Premium Suite

Learn to code in VB.NET to convert xps to pdf with pdf sdk with this step-by-step tutorial

The coding instructions are formulated to help you to try-out the features without the requirement to write your own code. ByteScout Premium Suite: the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording. It can convert xps to pdf with pdf sdk in VB.NET.

These VB.NET code samples for VB.NET guide developers to speed up coding of the application when using ByteScout Premium Suite. Simply copy and paste in your VB.NET project or application you and then run your app! Applying VB.NET application mostly includes various stages of the software development so even if the functionality works please test it with your data and the production environment.

All these programming tutorials along with source code samples and ByteScout free trial version are available for download from our website.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.vb
      
Imports System.Drawing.Imaging Imports System.IO Imports Bytescout.PDF Imports xps2img Imports Page = Bytescout.PDF.Page ''' <summary> ''' This example demonstrates converting xps document to pdf ''' </summary> Class Program Shared Sub Main() ' Create new document Dim pdfDocument = New Document() pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" 'Create instance And load file Dim xps2Image As New Xps2Image("Sample.xps") ' Set parameter Dim oParam As New Parameters() oParam.Dpi = 300 ' Set Dpi oParam.ImageType = ImageType.Png ' Output image type ' Get Bitmap from input file Dim outBitmapList = xps2Image.ToBitmap(oParam) For Each itmBitmap In outBitmapList ' Create New pdf page Dim page As New Page(PaperFormat.A4) ' Save image to a bytestream Dim byteStream As New MemoryStream() itmBitmap.Save(byteStream, ImageFormat.Png) ' Fill page with image Dim pageImage As New Image(byteStream) page.Canvas.DrawImage(pageImage, 5, 5, pageImage.Width / 2, pageImage.Height / 3) ' Add pdf page to pdf document pdfDocument.Pages.Add(page) Next ' Save document to file pdfDocument.Save("result.pdf") ' Cleanup pdfDocument.Dispose() ' Open result document in default associated application (for demo purpose) Dim processStartInfo As New ProcessStartInfo("result.pdf") processStartInfo.UseShellExecute = True Process.Start(processStartInfo) End Sub End Class

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

app.config
      
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.diagnostics> <sources> <!-- This section defines the logging configuration for My.Application.Log --> <source name="DefaultSource" switchName="DefaultSwitch"> <listeners> <add name="FileLog"/> <!-- Uncomment the below section to write to the Application Event Log --> <!--<add name="EventLog"/>--> </listeners> </source> </sources> <switches> <add name="DefaultSwitch" value="Information"/> </switches> <sharedListeners> <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/> <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log --> <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> --> </sharedListeners> </system.diagnostics> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

packages.config
      
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="xps2img" version="0.2.0" targetFramework="net45" /> </packages>

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next