Skip to end of metadata
Go to start of metadata
  

Try online

You can check the quality of Aspose.PDF conversion and view the results online at this link:

products.aspose.app/pdf/merger

Convert XPS files to PDF format

The XPS file type is primarily associated with the XML Paper Specification by Microsoft Corporation. The XML Paper Specification (XPS), formerly codenamed Metro and subsuming the Next Generation Print Path (NGPP) marketing concept, is Microsoft's initiative to integrate document creation and viewing into its Windows operating system.

The file format is basically a zipped XML file which is primarily used for distribution and storage. It's very difficult to edit and mostly implemented by Microsoft.

In order to convert XPS to PDF with Aspose.PDF for .NET, we have introduced a class named XpsLoadOptions which is used to initialize a LoadOptions object. Later, this object is passed as an argument during the Document object initialization and it helps the PDF rendering engine to determine the source document's input format.

In both XP and Windows 7, you should find an XPS Printer pre-installed if you look in the Control Panel and then Printers. To create these files you can use that printer for the output device. In Windows 7, you should be able to just double-click the file to open it in a XPS viewer. You may also download XPS viewer from Microsoft's website.

The following code snippet shows the process of converting XPS file into PDF format.

Convert PCL File to PDF Format

Try online

You can check the quality of Aspose.PDF conversion and view the results online at this link:

products.aspose.app/pdf/conversion/pcl-to-pdf

PCL (Printer Command Language) is a Hewlett-Packard printer language developed to access standard printer features. PCL levels 1 through 5e/5c are command based languages using control sequences that are processed and interpreted in the order they are received. At a consumer level, PCL data streams are generated by a print driver. PCL output can also be easily generated by custom applications

Currently only PCL5 and older versions are supported.

Conversion of PCL File to PDF Format

To allow conversion from PCL to PDF, Aspose.PDF has the class PclLoadOptions which is used to initialize the LoadOptions object. Later on this object is passed as an argument during Document object initialization and it helps the PDF rendering engine to determine the input format of source document. The following code snippet shows the process of converting a PCL file into PDF format.

Supported Features

Sets of Commands

Support

Exceptions

Description

Job control commands

+

Duplex printing mode

Control print process: number pf copies, output bin, simplex/duplex printing, left and top offsets etc.

Page control commands

+

 

Specify a size of page, margins, page orientation inter -lines, -character distances etc.

Cursor Positioning Commands

+

 

Specify cursor position and, hence, origins of text, raster or vector images and details.

Font selection commands

+

 

Allow loading soft (embedded) fonts from PCL file and managing them in memory.

Raster graphics commands

+

 

Allow loading raster images from PCL file to memory, specify raster parameters.
such as width, height, compression type, resolution etc.

Color commands

+

 

Allow coloring for all printable objects.

Print Model commands

+

 

Allow filling text, raster images and rectangular areas with a raster predefined and
user-defined patterns specify transparency mode for patterns and source raster image.
Predefined patterns are hatching, cross-hatch and shading ones.

Rectangle area fill commands

+

 

Allow creation and filling rectangular areas with patterns.

HP-GL/2 Vector Graphics commands

+

Screened Vector Command (SV), Transparent Data Command (TD), Scalable or Bitmap Fonts Command (SB), Character Slant Command (SL) and Extra Space (ES) are not implemented and DV (Define Variable Text Path) commands is realized in beta version.

Allow loading HP-GL/2 vector images from PCL file into memory. Vector image has an origin at lower left corner of the printable area, can be scaled, translated, rotated and clipped.
Vector image can contain text, as labels, and geometric figures such as rectangle, circle, ellipse, line, arc, bezier curve and complex figures composed from the simple ones.
Closed figures including letters of labels can be filled with solid fill or vector pattern.
Pattern can be hatching, cross-hatch, shading, raster used-defined, PCL hatching or cross-hatch and PCL user-defined. PCL patterns are raster. Labels can be individually rotated, scaled, and directed in four directions: up, down, left and right. Left and Right directions involve one-after-another letter arrangement. Up and Down directions involve one-under-another letter arrangement.

Macroses

+

 

Allow loading a sequence of PCL commands into memory and use this sequence many times, for example, to print page header or set one formatting for a set of pages.

Unicode text

+

 

Allow printing non ASCII characters.

PCL6 (PCL-XL)

+

JetReady extension is not supported because it is impossible to have JetReady specification.

Binary file format.

Known Issues

  1. Origin of text strings and images can be slightly differed from the ones in a sorce PCL file If print direction is not 0º. The same refers to vector images if coordinate system of vector plot is rotated (RO command preceded).
  2. Origin of labels in vector images can be differ from the ones in a sorce PCL file If the labels are influenced by a sequence of commands: Label Origin (LO), Define Variable Text Path (DV), Absolute Direction (DI) or Relative Direction (DR).
  3. If parsed PCL file contains Intellifont or Universal soft fonts exception will be thrown, because Intellifont and Universal font are not supported at all.

Convert PostScript to PDF Format

Try online

You can check the quality of Aspose.PDF conversion and view the results online at this link:

products.aspose.app/pdf/conversion/ps-to-pdf

In order to convert a PostScript file to PDF format, Aspose.PDF for .NET offers PsLoadOptions class which is used to initialize the LoadOptions object. Later this object can be passed as an argument to Document object constructor, which will help PDF Rendering Engine to determine the format of source document. Following code snippet can be used to convert a PostScript file into PDF format:

 

Convert SVG File to PDF Format

Scalable Vector Graphics (SVG) is a family of specifications of an XML-based file format for two-dimensional vector graphics, both static and dynamic (interactive or animated). The SVG specification is an open standard that has been under development by the World Wide Web Consortium (W3C) since 1999.

SVG images and their behaviors are defined in XML text files. This means that they can be searched, indexed, scripted and, if required, compressed. As XML files, SVG images can be created and edited with any text editor, but it is often more convenient to create them with drawing programs such as Inkscape.

To convert SVG files to PDF, use the class named SvgLoadOptions which is used to initialize the LoadOptions object. Later, this object is passed as an argument during the Document object initialization and helps the PDF rendering engine to determine the input format of the source document.

The following code snippet shows the process of converting SVG file into PDF format.

Get SVG dimensions

It is also possible to get the dimensions of the source SVG file. This information can be useful if we want the SVG to cover the entire page of the output PDF. The ScgLoadOption class' AdjustPageSize property fulfills this requirement. The default value of this property is false. If the value is set to true, the output PDF will have same size (dimensions) as the source SVG.

The following code snippet shows the process of getting the source SVG file's dimensions and generating a PDF file.

SVG Supported Features

SVG Tag

Sample Use

circle

<circle id="r2" cx="10" cy="10" r="10" stroke="blue" stroke-width="2"/>

defs 

<defs> 
<rect id="r1" width="15" height="15" stroke="blue" stroke-width="2" /> 
<circle id="r2" cx="10" cy="10" r="10" stroke="blue" stroke-width="2"/> 
<circle id="r3" cx="10" cy="10" r="10" stroke="blue" stroke-width="3"/> 
</defs> 
<use x="25" y="40" xlink:href="#r1" fill="red"/> 
<use x="35" y="15" xlink:href="#r2" fill="green"/> 
<use x="58" y="50" xlink:href="#r3" fill="blue"/>

ellipse 

<ellipse cx="2.5" cy="1.5" rx="2" ry="1" fill="red" />

font

<text x="10" y="100" font-size="15" fill="red" > 
    Sample text 
</text>

<g fill="none" stroke="dimgray" stroke-width="1.5" > 
                <line x1="-7" y1="-7" x2="-3" y2="-3"/> 
                <line x1="7" y1="7" x2="3" y2="3"/> 
                <line x1="-7" y1="7" x2="-3" y2="3"/> 
                <line x1="7" y1="-7" x2="3" y2="-3"/> 
</g> 

image

<image id="ShadedRelief" x="24" y="4" width="64" height="82" xlink:href="relief.jpg" /> 

line

<line style="stroke:#eea;stroke-width:8" x1="10" y1="30" x2="260" y2="100"/> 

path

<path style="fill:#daa;fill-rule:evenodd;stroke:red" d="M 230,150 C 290,30 10,255 110,140 z "/> 

polygon

<polygon style="stroke:#24a;stroke-width:1.5;fill:#eefefe" points="10,10 180,10 10,250 10,10" />

polyline

<polyline fill="none" stroke="dimgray" stroke-width="1" points="-3,-6 3,-6 3,1 5,1 0,7 -5,1 -3,1 -3,-5"/>

rect 

<rect x="0" y="0" width="400" height="600" stroke="none" fill="aliceblue" />

style

<path style="fill:#daa;fill-rule:evenodd;stroke:red" d="M 230,150 C 290,30 10,255 110,140 z "/>

svg

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="10cm" height="5cm" >

text

<text font-family="sans-serif" fill="dimgray" font-size="22px" font-weight="bold" x="58" y="30" pointer-events="none">Map Title</text>

tref

<defs> 
    <text id="ReferencedText"> 
      Referenced character data 
    </text> 
</defs> 
<text x="10" y="100" font-size="15" fill="red" > 
    <tref xlink:href="#ReferencedText"/> 
</text>

tspan

<tspan dy="25" x="25">six ink color input value. Here it will </tspan>

use

<defs> 
    <text id="Text" x="400" y="200" 
          font-family="Verdana" font-size="100" text-anchor="middle" > 
      Masked text 
    </text> 
<use xlink:href="#Text" fill="blue"  />

SVG Tag Property

Sample Use

fill

<circle cx="120" cy="50" r="40" stroke="green" stroke-width="2" fill="magenta"/>

fill-opacity

<path id="Blue50" d="M 0 125 L 100 125 L 100 225 z" fill="#00ffff" fill-opacity=".5" />

font-stretch

<text x="10" y="20" font-family="arial" font-size="15" fill="blue" font-stretch="normal" > 
    font-stretch normal 
</text>

font-weight

<text font-family="sans-serif" fill="dimgray" font-size="22px" font-weight="bold" x="58" y="30" pointer-events="none">Map Title</text>

opacity

<circle id="a" r="30" fill="url(#g1)" stroke="black" opacity="0.5" />

stroke-dasharray

<path d="M 50 50 L 100 50 L 100 100 L 150 100 L 150 50 L 200 50" 
        fill="none" stroke="red" stroke-width="2" 
    stroke-dashoffset="0" stroke-dasharray="1 2 3 4 5 6"  />

stroke-dashoffset

<text stroke="black" y="1em" 
        stroke-dashoffset="1%" 
        stroke-dasharray="1px"> 
    Sample text 
</text>

stroke-linecap

<circle cx="100" cy="100" r="0.00001" stroke="black" stroke-width="20" stroke-linecap="round"/>

stroke-linejoin

<svg stroke-linecap="square" stroke-miterlimit="10" stroke-opacity="1" rendering="auto" fill="black" stroke-dasharray="none" stroke-width="1" stroke-linejoin="miter"  stroke-dashoffset="0">

stroke-opacity

<line x1="75%" x2="75%" y2="100%" stroke="url(#red)" stroke-width="50%" stroke-opacity="0"/>

text-decoration

<text x="10" y="20" word-spacing="0">Sample text </text> 
<text x="10" y="45" text-decoration="underline">text-decoration underline</text> 
<text x="10" y="70" text-decoration="line-through">text-decoration line-through</text> 
<text x="10" y="95" text-decoration="overline">text-decoration overline</text>

word-spacing

<text x="10" y="20" word-spacing="0">Sample text </text> 
<text x="10" y="45" word-spacing="20">Word space 20</text> 
<text x="10" y="70" word-spacing="40">Word space 40</text> 
<text x="10" y="95" word-spacing="0">Sample text</text>

SVG Tag Attribute

Sample Use

transform

<text id="myScaleTextH" font-family="sans-serif" fill="dimgray" font-size="15px" text-anchor="middle" transform="translate(55,36),rotate(90)" >81,000 m</text>

cx

<circle cx="100" cy="50" r="40" stroke="green" stroke-width="2" fill="magenta"/>

cy

<circle fill="dimgray" cx="0" cy="0" r="1" pointer-events="none"/>

dx

<svg xmlns="http://www.w3.org/2000/svg"> 
<text dx="㾫"/> 
</svg>

dy

<tspan dy="25" x="25">fallback to an icc-color or RGB color.</tspan>

fill

<text x="10" y="20" fill="green">SVG Image 20</text>

font-family

<tspan x="10" dy="10" font-family="serif"> 
                Have you gazed on naked grandeur where there's nothing else to gaze on, 
</tspan>

font-size

<text font-family="sans-serif" fill="dimgray" font-size="22px" font-weight="bold" x="58" y="30" pointer-events="none">Map Title</text>

font-stretch

<text x="10" y="20" font-family="arial" font-size="15" fill="blue" font-stretch="normal" > 
    font-stretch normal 
</text> 

<text x="10" y="40" font-family="arial" font-size="15" fill="blue" font-stretch="wider" > 
    font-stretch wider 
</text> 

<text x="10" y="60" font-family="arial" font-size="15" fill="blue" font-stretch="narrower" > 
    font-stretch narrower 
</text>

font-style

<text x="20" y="40" font-family="Arial" font-size="12" font-style="normal"> 
Sample text 
</text>

height

<rect x="-6" y="-6" width="12" height="12" fill="white" stroke="dimgray" stroke-width="1.5"/>

id

<defs> 
    <text id="ReferencedText"> 
      Referenced character data 
    </text> 
</defs> 
<text x="10" y="100" font-size="15" fill="red" > 
    <tref xlink:href="#ReferencedText"/> 
</text>

points

<polyline fill="none" stroke="dimgray" stroke-width="1" points="-3,-6 3,-6 3,1 5,1 0,7 -5,1 -3,1 -3,-5"/>

r

<circle cx="120" cy="50" r="40" stroke="green" stroke-width="2" fill="magenta"/>

rx

<ellipse stroke="black" stroke-width="5" cx="400" cy="200" rx="350" ry="150" />

ry

<rect x="20" y="20" rx="20" ry="20" width="250" height="100" style="fill:red;stroke:black; stroke-width:5;opacity:0.5"/>

style

<rect x="20" y="20" width="250" height="250" style="fill:blue;stroke:red;stroke-width:5; fill-opacity:0.5;stroke-opacity:0.5;"/>

transform

<circle cx="6cm" cy="2cm" r="100" fill="red" transform="translate(0,50)" />

width

<rect style="stroke:#2aa;stroke-width:7;fill:#ded;opacity:.8" x="30" y="80" height="120" width="220" />

x

<text x="10" y="20" fill="green">SVG Image 20</text>

y

<text x="10" y="50" fill="green">SVG Image 50</text>

y1

<line style="stroke:#eea;stroke-width:8" x1="10" y1="30" x2="260" y2="100"/>

y2

<line x1="0" y1="0" x2="30" y2="30" style="stroke:rgb(99,99,99);stroke-width:2"/>

Convert SVG File to PDF Format Known Issues

  1. Shorten path strings that not covered by specification but as I checked, rendered in browser fine.
  2. Elliptical arc segments with transformations evolve complex 2D geometry calculations, require more testing..
  3. Big SVG files (megabytes size) take more than few seconds to parse, code optimization required.
  4. Graphical filters API in the Pdf layer was extended recently, this make possible make more full integration of the corresponding SVG layer graphics functions.

Convert EPUB File to PDF Format

Try online

You can check the quality of Aspose.PDF conversion and view the results online at this link:

products.aspose.app/pdf/conversion/epub-to-pdf

EPUB (short for electronic publication) is a free and open e-book standard from the International Digital Publishing Forum (IDPF). Files have the extension .epub. EPUB is designed for reflowable content, meaning that an EPUB reader can optimize text for a particular display device. EPUB also supports fixed-layout content. The format is intended as a single format that publishers and conversion houses can use in-house, as well as for distribution and sale. It supersedes the Open eBook standard.

In order to convert EPUB files to PDF format, Aspose.PDF for .NET has a class named EpubLoadOptions which is used to load source EPUB file. After that, the object is passed as an argument to Document object initialization, as it helps the PDF rendering engine to determine the source document's input format. The following code snippet shows the process of converting an EPUB file into PDF format.

Convert MHT to PDF Format

 

Try online

You can check the quality of Aspose.PDF conversion and view the results online at this link:

products.aspose.app/pdf/conversion/mht-to-pdf

or

products.aspose.app/pdf/conversion/mhtml-to-pdf

You can check the quality of Aspose.PDF conversion and view the results online at this link:

 

MHTML, short for MIME HTML, is a web page archive format used to combine resources that are typically represented by external links (such as images, Flash animations, Java applets, and audio files) with HTML code into a single file. The content of an MHTML file is encoded as if it were an HTML email message, using the MIME type multipart/related. Aspose.PDF for .NET can convert HTML files to PDF format and with the release of Aspose.PDF for .NET 9.0.0, we have introduced a new feature that lets you convert MHT files to PDF format.

To convert MHT files to PDF, Aspose.PDF has the class MhtLoadOptions used as second argument to the Document(...) constructor. Please take a look at the following code snippet to accomplish this requirement.

Convert TeX file to PDF format

Try online

You can check the quality of Aspose.PDF conversion and view the results online at this link:

products.aspose.app/pdf/conversion/tex-to-pdf

The LaTeX file format is a text file format with markup in the LaTeX derivative of the TeX family of languages and LaTeX is a derived format of the TeX system. LaTeX (ˈleɪtɛk/ lay-tek or lah-tek) is a document preparation system and document markup language. It is widely used for the communication and publication of scientific documents in many fields, including mathematics, physics, and computer science. It also has a prominent role in the preparation and publication of books and articles that contain complex multilingual materials, such as Sanskrit and Arabic, including critical editions. LaTeX uses the TeX typesetting program for formatting its output, and is itself written in the TeX macro language.

Aspose.PDF for .NET supports the feature to convert TeX files to PDF format and in order to accomplish this requirement, Aspose.Pdf namespace has a class named LatexLoadOptions which provides the capabilities to load LaTex files and render the output in PDF format using Document class. The following code snippet shows the process of converting LaTex file to PDF format.

Convert Text File to PDF Format

Aspose.PDF for .NET provides the capability to convert Text files to PDF format. In this article we demonstrate that how easily and efficiently we can convert a text file to PDF using Aspose.Pdf.

When you need to convert a Text file to PDF, initially read the source text file in some reader. We used TextReader for the purpose. Instantiate Documnet object and add a new page in Pages collection. Create a new object of TextFragment and pass TextReader object to its constructor. Add a new paragraph in Paragraphs collection using TextFragment object and save the resultant PDF file using Save method of Document class.

Convert CGM file to PDF format

CGM is a file extension for a computer graphics metafile file format commonly used in CAD (computer-aided design) and presentation graphics applications. CGM is a vector graphics format that supports three different encoding methods: binary (best for program read speed), character-based (produces the smallest file size and allows for faster data transfers) or cleartext encoding (allows users to read and modify the file with a text editor)

CGM is an ANSI (American National Standards Institute) standard format that can be used on any operating system that supports it (unlike the WMF format which is designed only for Windows).

The CgmLoadOptions class provides the capabilities to load CGM image and convert it to PDF format. Please try using following code snippet.

You may consider having a look over attached ISO 8632-3 - Binary encoding.pdf which details CGM specifications.

Labels
  • No labels