In this article, I will share a method of creating XPS file and add company logo on output XPS file from ASP. The software I will use is named as VeryDOC Image to XPS Converter, by which you can create XPS file from image files easily. And this converter is command line version software, so you can call this software from ASP directly. If you need, this software also allows you to call it from Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc. Using the COM object (or DLL Library, or Command Line), file conversions can be done consecutively or simultaneously.
The XPS document format consists of structured XML markup that defines the layout of a document and the visual appearance of each page, along with rendering rules for distributing, archiving, rendering, processing and printing the documents. Notably, the markup language for XPS is a subset of XAML, allowing it to incorporate vector-graphic elements in documents, using XAML to mark up the Windows Presentation Foundation (WPF) primitives. Now this file formats is widely used in printing area. For creating XPS file, please refer to the following steps.
Step 1. Download Image to XPS Converter Command Line
- When downloading finishes, you can find a zip file. Please unzip it and then check elements, usage, parameters carefully.
- When you call this software from ASP, please refer to the example in user manual.
Step 2. Create XPS file from image together with ASP.
- This software supports the following image file formats:TIF, TIFF, JPG, JPEG, GIF, PNG, BMP, TGA, WMF, EMF, PCX. You can create XPS from those image file.
- Here is one code template about calling this software from ASP, please have a check.
Please by following steps to call img2xps.exe inside a special user account,
1. Please download and install EXEShell COM Library (freeware) from following URL first,
https://www.verydoc.com/exeshell.html
https://www.verydoc.com/download/exeshell.zip
2. Please use following ASP code to run the conversion inside a special user account,
~~~~~~~~~~~~~~~~~
<%
Set comEXEShell = Server.CreateObject("exeshell.shell")
RootPath = Server.MapPath(".") & "\"
EXEFile = RootPath & "img2xps\img2xps.exe"
InFile = RootPath & "test.tif"
OutFile = RootPath & "out.xps"
strCommandLine = EXEFile & " " & InFile & " " & OutFile
response.write strCommandLine & "<br>"
comEXEShell.RunCommandLine "UserName", "Password", strCommandLine
Set comEXEShell = Nothing
%>
~~~~~~~~~~~~~~~~~
The above example can help you create XPS from tiff file. During the using, if you have any question, please contact us as soon as possible.