Some test text!

menu

WebViewer

More languages

chevron_right
More languages
JavaScript
C++
C#
C# (.NET Core)
Go
Java
Obj-C
JS (Node.js)
PHP
Python
Ruby
Swift
VB

These samples shows how to integrate PDFNet WebViewer into any HTML5, Silverlight, or Flash web application. The sample is using 'pdftron.PDF.Convert.ToXod()' to convert/stream PDF, XPS, MS Office, RTF, HTML and other document formats to WebViewer 'pdftron.PDF.Convert.ToXod()' is an optional Add-On to the Core SDK and is part of PDFNet WebViewer Publishing Platform.

Get Started Samples Download

To run this sample, get started with a free trial of PDFTron SDK.

//---------------------------------------------------------------------------------------
// Copyright (c) 2001-2021 by PDFTron Systems Inc. All Rights Reserved.
// Consult LICENSE.txt regarding license information.
//---------------------------------------------------------------------------------------

package main
import (
	"fmt"
	. "pdftron"
)

//---------------------------------------------------------------------------------------
// The following sample illustrates how to convert PDF, XPS, image, MS Office, and 
// other image document formats to XOD format.
//
// Certain file formats such as PDF, generic XPS, EMF, and raster image formats can 
// be directly converted to XOD. Other formats such as MS Office 
// (Word, Excel, Publisher, Powerpoint, etc) can be directly converted via interop. 
// These types of conversions guarantee optimal output, while preserving important 
// information such as document metadata, intra document links and hyper-links, 
// bookmarks etc. 
//
// In case there is no direct conversion available, PDFNet can still convert from 
// any printable document to XOD using a virtual printer driver. To check 
// if a virtual printer is required use Convert::RequiresPrinter(filename). In this 
// case the installing application must be run as administrator. The manifest for this 
// sample specifies appropriate the UAC elevation. The administrator privileges are 
// not required for direct or interop conversions. 
//
// Please note that PDFNet Publisher (i.e. 'pdftron.PDF.Convert.ToXod') is an
// optionally licensable add-on to PDFNet Core SDK. For details, please see
// http://www.pdftron.com/webviewer/licensing.html.
//---------------------------------------------------------------------------------------

// Relative path to the folder containing the test files.
var inputPath = "../../TestFiles/"
var outputPath = "../../TestFiles/Output/"

func main(){
    PDFNetInitialize()

    // Sample 1:
    // Directly convert from PDF to XOD.
    ConvertToXod(inputPath + "newsletter.pdf", outputPath + "from_pdf.xod")

    // Sample 2:
    // Directly convert from generic XPS to XOD.
    ConvertToXod(inputPath + "simple-xps.xps", outputPath + "from_xps.xod")

    // Sample 3:
    // Directly convert from PNG to XOD.
    fmt.Println("Converting: " + inputPath + "butterfly.png" + " to: " + outputPath + "butterfly.xod")
    ConvertToXod(inputPath + "butterfly.png", outputPath + "butterfly.xod")

    // Sample 4:
    fmt.Println("Converting: " + inputPath + "numbered.pdf" + " to: " + outputPath + "numbered.xod")
    ConvertToXod(inputPath + "numbered.pdf", outputPath + "numbered.xod")

    // Sample 5:
    // Directly convert from JPG to XOD.
    fmt.Println("Converting: " + inputPath + "dice.jpg" + " to: " + outputPath + "dice.xod")
    ConvertToXod(inputPath + "dice.jpg", outputPath + "dice.xod")

    // Sample 6:
    // Directly convert from generic XPS to XOD.
    fmt.Println("Converting: " + inputPath + "simple-xps.xps" + " to: " + outputPath + "simple-xps.xod")
    ConvertToXod(inputPath + "simple-xps.xps", outputPath + "simple-xps.xod")

    fmt.Println("Done.")
}
close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.