Batch Converting PDF to XPS from C#

Question:I'm looking for an inexpensive way of batch converting 1300 PDF documents to XPS documents. I know that I can simply print them in that format, but that would take a very long time. Is there a way to do this programmatically in C#? Is there a method on VeryDOC website?

Answer: When you need to convert PDF to XPS in batch from C#, maybe you can have a free trial of this software:VeryDOC PDF to Vector Converter, by which you can convert PDF to XPS also from programming languages like  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. This software also can help you convert PDF to other file formats like WMF, SVG, Postscript (PS), EPS, SWF (Flash), HPGL, PCL etc. Please check more information of this software on homepage, in the following part, I will show you how to use this software.

Step 1. Free download PDF to Vector Converter Command Line

  • This software is command line version, when downloading finishes, there will be a zip file. Please extract it to some folder then you can find the executable file.
  • If you download SDK version, in the extracted folder, there will be many code templates of calling this software from other languages.

Step 2. Converting PDF to XPS in batch from C#

  • When you use this software, please refer to usage and example.
  • When converting PDF to XPS, you many use the following parameters and command line templates:
  • -firstpage <int> : first page to print, from 1 to max page.
    -lastpage <int>  : last page to print, from 1 to max page.
    -scale <int> : specify the factor by which the printed output is to be scaled, The apparent page size is scaled from the physical page size by a factor of scale/100,  this option is available for PCL, HPGL, XPS, PS and EPS formats.
    pdf2vec.exe C:\in.pdf C:\out.xps
    pdf2vec.exe C:\*.pdf C:\*.xps

  • When you need to call this software from C#, please refer to the following code templates:
  • Make use of the PROCESS class available in SYSTEM.DIOGNOSTICS namaspace, use the following piece of code to execute the pdf2vec.exe file,
    ~~~~~~~~~~~~~~~~~
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Diagnostics;

    namespace ConsoleApplication1
    {
        class Program
    {
    static void Main(string[] args)
    {
    Process proc = new Process();
    proc.StartInfo.FileName = @"C:\\pdf2vec.exe";
    string strArguments = "";
    strArguments += "--scale";
    strArguments += " D:\\temp\\sample.pdf D:\\temp\\out.xps";
    Console.WriteLine(strArguments);
    proc.StartInfo.Arguments = @strArguments;
    proc.Start();
    proc.WaitForExit();
    }
    }
    }
    ~~~~~~~~~~~~~~~~~

If you need to check more information on homepage. During the using, if you have any question, please contact us as soon as possible.

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!