Image to XPS Converter

How to convert image to XPS file from C#?

         In this article, I will show you how to convert image to XPS from C# programming language. The software I will use is named as VeryDOC Image to XPS Converter Command Line, by which you can also call it together with any programming or scripting languages, such as Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc.

Supported image file formats:TIF, TIFF, JPG, JPEG, GIF, PNG, BMP, TGA, WMF, EMF, PCX
Supported system: all the Window platforms both of 32-bit and 64-bit.

When you use this software, you are able to specify any other printer name to instead of "Microsoft XPS Document Writer" printer; after converting, you can add watermark to output XPS file at any place in any kind of forms. Please check more functions of this application on homepage, in the following part, I will show you how to call it from C#.

Step 1. Free download Image to XPS Converter Command Line

  • You can download it to your computer and have a free trial then decide whether this software is good for you or not.
  • When downloading finishes, you will get a zip file. Please extract it to some folder then you can call it normally.
  • When you use this software, please refer to the usage and following examples.

Step 2. Convert image to XPS from C#

  • Here is the usage for your reference:img2xps.exe [options] <Image files> [XPS files]
  • When call it from C#, please refer to the following code template:
  • Make use of the PROCESS class available in SYSTEM.DIOGNOSTICS namaspace, use the following piece of code to execute the img2xps.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:\\img2xps.exe";
    string strArguments = "";
    strArguments += " D:\\temp\\sample.tif D:\\temp\\out.xps";
    Console.WriteLine(strArguments);
    proc.StartInfo.Arguments = @strArguments;
    proc.Start();
    proc.WaitForExit();
    }
    }
    }
    ~~~~~~~~~~~~~~~~~

  • Here are some parameters for your reference:
  • -printer <string> : set printer name to create XPS file
    -paper <string>   : set paper size to XPS format
      auto   : retrieve paper size from image file
      number : standard paper size
      others : user defined paper size
    -xoffset <int>  : specify left offset for output image
    -yoffset <int>  : specify top offset for output image
    -width <int>    : specify width for output image
    -height <int>   : specify height for output image
    -getpagecount   : read page count from input image file
    -wtext <string> : set watermark on output XPS pages
    -wtype <int>    : type of watermark
      0 : normal watermark
      1 : watermark on header
      2 : watermark on footer
    -wf <string> : font name of watermark
    -wh <int> : font height of watermark
    -ww <int> : font width of watermark
    -wb : specify bold font
    -wi : specify an italic font
    -wu : specify an underlined font
    -ws : specify a strikeout font
    -wo <int> : opacity of watermark, from 0 to 100
    -wa <int> : angle of watermark
    -wc <string> : color of watermark,

During the using, if you have any question, please contact us as soon as possible.

DOC to Any Converter

Dynamically insert content into PDF files with PHP

Question:I have an eBook in word that I convert to PDF before distributing to my clients. I'd like to dynamically insert their email address into all links in the eBook to allow them access to the members-only content on my site, and I'd like to do this on the fly, as part of the book download process.I've briefly looked at some software and website, but I was wondering what specific technique I'd use to insert this data.I was thinking I'd insert an email token string where I want the email address to go, and then use some function to update those tokens in the PDF document. Can anyone point me in the right direction? I have PHP experience, but not with editing / generating PDF documents from PHP. Is there any solution on VeryDOC?

Answer: According to your needs, I guess you can convert word to PDF eBook and then stamp PDF by email address then this matter can be solved. You can insert data in the format of stamping PDF. If you feel this solution is good, please refer to the following part.  The software I use here is named as VeryDOC DOC to Any Converter, by which you can convert doc to PDF and directly insert email address as stamp. And this is command line version software, you can call it from PHP. If you need to use the SDK version, there is also one available. In the following part, I will show you how to process it.

Step 1. Free download DOC to Any Converter Command Line

  • As this is command line version software, when downloading finishes, it is a zip file. Please extract it to some folder then you can call the executable file from MS Dos Windows.
  • When you use this software, please refer to the usage and example.

Step 2. Convert word to PDF eBook and inset data as email address.

  • When you need to convert word to PDF eBook and insert data as email address, you may need the following parameters and please refer to the following command line templates:
  • -useprinter     : Convert DOC files to other formats via virtual printer
    -width <int>    : Set page width to PDF file
    -height <int>   : Set page height to PDF file
    -xres <int>     : Set X resolution to image file
    -yres <int>     : Set Y resolution to image file
    -bitcount <int> : Set color depth for image conversion
    -compression <int>     : Set compression for TIFF image
    -wtext <string>        : watermark on printed document
    -wtype <int>           : type of watermark
        0 : normal watermark
        1 : watermark on header
        2 : watermark on footer
    -wf <string>           : font name of watermark
    -wh <int>              : font size of watermark
    -wb                    : specify bold font
    -wi                    : specify an italic font

    Some examples:
    doc2any.exe -wtext "support@verydoc.com" "C:\in.doc" C:\out.pdf
    doc2any.exe -wtext "support@verydoc.com" -wc "0000FF" "C:\in.doc" C:\out.pdf
    doc2any.exe -wtext "support@verydoc.com" -wx 100 -wy 100 "C:\in.doc" C:\out.pdf

  • When you need to call it from PHP, please refer to the following code template:
  • <?php
        $exeshell =new COM("exeshell.shell") or die("Can't start exeshell");
        $exeshell->RunCommandLine("UserName", "Password", ' "C:\doc2any.exe" "C:\test.doc" "C:\out.pdf" ');
        $exeshell = null;
    ?>

During the using, if you have any question, please contact us as soon as possible.

DOC to Any Converter

Is there a better way to convert files into PDF files using PHP?

Question:What is on VeryDOC the best way to convert uploaded files of any kind (.doc, .docx,...) into a PDF-file using nothing but PHP. Is it even possible to do so?I looked at FPDF, but this creates the PDF files from text.An other solution previously given was to use the some library on your server, but unfortunately, my server doesn't support this library...What is the best way to convert to files my users upload on my site to PDF files?

Answer: According to your needs, maybe you can have a free trial of this software: VeryDOC Doc Converter COM,by which you can convert files of Microsoft Word, PowerPoint, Excel, JPG, PNG, GIF, and HTML to PDF. And this COM is available via an easily integrated COM object (or DLL Library, or Command Line), enabling developers to access the converter via any programming or scripting languages, such as Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc.  This COM is quite popular for developer to install it on sever for file formats conversion, so I guess there should have any problem to make it work on your server. Please know more detail information on its homepage, in the following part, let us check how to use this software.

Step 1. Free download Doc Converter COM

  • This is COM version, when downloading finishes, there will be a zip file. Please extract it to some folder then you can check related element and help documents.
  • When you open it then you will find code template of PHP, simply follow it then you can use this software easily at once.

Step 2. Convert Files to PDF using PHP

  • When you need to create PDF from files using PHP, please refer to the following code templates:

Some examples for call DocConverter COM Service from PHP code:
By this code template, we can create PDF from file URL, which means you can also convert website to PDF.

Example 1:
<?php
$url = "http://www.verypdf.com";
$path = "C:\\test.pdf";
$com = new COM("PdfOut.PdfCreator");
$com->html2PDF = $url;
$com->fileName = $path;
$com->Doc2PDFViaSocket();
?>
By this code template, we can convert local file to PDF.
Example 2:
<?php
$PdfCreator =new COM("PdfOut.PdfCreator") or die("Cannot start PdfCreator");
$PdfCreator->Doc2PDFCommandLine(' "c:\input.doc" "c:\output.pdf" ');
$PdfCreator = null;
?>
Example 3:
<?php
$url = "http://www.verypdf.com";
$path = "C:\\test.pdf";
$com = new COM("PdfOut.PdfCreator");
$com->Doc2PDFCommandLine("\"$url\" \"$path\"
\"paperType=0,PrintHTMLBackground=yes,
overwrite=yes\"");
?>

During the using, if you have any question, please contact us as soon as possible.

PDF to Vector Converter

PDF to SVG without size specification

Question:I want to convert PDF to SVG using some software without the width and height specification that is automatically added (for the purpose to make it fit to the container along the lines of what is mentioned here). I couldn't find any option to do this. What is the most realistic reliable way to do this? If scripting is available, I would use it my project.Is there a solution on VeryDOC?

Answer: According to your needs, maybe you can have a free trial of this software:VeryDOC PDF to Vector Converter, by which you can convert PDF to SVG easily either from script or together with other applications 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. By this software, we can also convert PDF files to other scalable vector graphics formats, such as EMF, WMF, SVG, Postscript (PS), EPS, SWF (Flash), XPS, HPGL, PCL etc. If you need to know more information,please check on homepage.In the following part, let us check how to use this software.

Step 1. Free download PDF to Vector Converter Command Line

  • Now there is no single computer version, there are  server version and developer version available. If you need to use it under single computer, please download the server version which is also available.
  • When downloading finishes, there will be a zip file. Please extract it to some folder then you can call the executable file in MS Dos Windows easily.

Step 2. Convert PDF to SVG without size specification.

  • When you use this software, please refer to the usage and example in readme.txt.
  • Here is the usage for your reference: pdf2vec.exe [options] [Options] <PDF Files>
  • This software will convert PDF to SVG directly, you do not need to specify any parameters the it will help you convert PDF to SVG according to its original size.
  • When converting PDF to SVG, please refer to the following command line templates:
    pdf2vec.exe C:\in.pdf C:\out.svg
    When you use this software, there are two following parameters avaiable for you. By them you can choose PDF conversion page range.
  • -firstpage <int> : first page to print, from 1 to max page
    -lastpage <int>  : last page to print, from 1 to max page

  • When you need to do batch conversion, this software support using wild characters.

By this software, we can convert PDF to SVG without size speciation. During the using, if you have any question, please contact us as soon as possible.

Raster to Vector Converter

How to convert image to PDF and cut margins by command line?

    When converting image to PDF, we also meet some kinds of image with big margins, it will be a waste to print or save this kind of PDF. Based on this needs, VeryDOC developed software named VeryDOC Raster to Vector Converter Command Line, by which you can convert image to PDF and cut margins by command line in four directions.   By this software, you can also convert raster image to vector image and cut margins by command line. Please know more functions of this software on homepage, in the following part, let us check how to use this software.

Step 1. Free trial Raster to Vector Converter Command Line

  • For now there is no single computer version here, so if you need to use it on single computer, please download the server version.
  • When downloading finishes, there will be a zip file. Please extract it to some folder then you can check related elements.

Step 2. Convert image to PDF and cut margins in four direction by command line.

  • When you use this software, please refer to the usage here: RasterToVector [options] <in-file> [<out-file>]
  • When converting image to PDF and cut margins, please refer to the following command line templates:
    Raster2Vector.exe -margin 30pt C:\in.png C:\out.pdf
    By this command line templates, we can convert image to PDF and specify margins as 30 Pt. This command line will help you define margins in the same. So the output PDF margins will be 30 pt in four directions. The unit could be changed as
  • in/cm/pt.
    Raster2Vector.exe -lmargin 10pt -tmargin 10pt -rmargin 10pt -bmargin 10pt C:\in.png C:\out.pdf
    By this command line, we can specify margins in four directions. You can specify margins from top, bottom, left and right. Here also the unit could be changed as in/cm/pt
    The following parameters can help you specify margins in various methods.

    -margin <string>     : set margin to output file, unit: in/cm/pt
      -lmargin <string>    : set left margin to output file, unit: in/cm/pt
      -rmargin <string>    : set right margin to output file, unit: in/cm/pt
      -tmargin <string>    : set top margin to output file, unit: in/cm/pt
      -bmargin <string>    : set bottom margin to output file, unit: in/cm/pt

  • This software also can help you convert image to PDF and specify standard formats in output like A4, A3, A5, B5, Letter, Legal, Tabloid, Statement, Executive, Folio, Quarto, 10x14. When you use those parameters, please make sure the format names are case insensitive.

If you need to know more functions of this software, please check parameters in readme.txt. During the using, if you have any question, please contact us as soon as possible.