Friday, 25 February 2022 08:01

Java: Convert PDF to TIFF

The Tagged Image File Format (TIFF) is a relatively flexible image format which has the advantages of not requiring specific hardware, as well as being portable. Spire.PDF for Java supports converting TIFF to PDF and vice versa. This article will show you how to programmatically convert PDF to TIFF using it from the two aspects below.

Install Spire.PDF for Java

First of all, you're required to add the Spire.Pdf.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.pdf</artifactId>
        <version>11.11.11</version>
    </dependency>
</dependencies>

Convert All Pages of a PDF File to TIFF

The following steps show you how to convert all pages of a PDF file to a TIFF file.

  • Create a PdfDocument instance.
  • Load a PDF sample document using PdfDocument.loadFromFile() method.
  • Save all pages of the document to a TIFF file using PdfDocument.saveToTiff(String tiffFilename) method.
  • Java
import com.spire.compression.TiffCompressionTypes;
import com.spire.pdf.PdfDocument;

public class PDFToTIFF {
    public static void main(String[] args) {

        //Create a PdfDocument instance
        PdfDocument pdf = new PdfDocument();
       
 //Load a PDF sample document
        pdf.loadFromFile("sample.pdf");

        //Save all pages of the document to Tiff
        pdf.saveToTiff("output/PDFtoTiff.tiff");
     }
}

Java: Convert PDF to TIFF

Convert Some Specified Pages of a PDF File to TIFF

The following steps are to convert specified pages of a PDF document to a TIFF file.

  • Create a PdfDocument instance.
  • Load a PDF sample document using PdfDocument.loadFromFile() method.
  • Save specified pages of the document to a TIFF file using PdfDocument.saveToTiff(String tiffFilename, int startPage, int endPage, int dpix, int dpiy) method.
  • Java
import com.spire.pdf.PdfDocument;

public class PDFToTIFF {
    public static void main(String[] args) {
        //Create a PdfDocument instance
        PdfDocument pdf = new PdfDocument();
 
       //Load a PDF  sample document
        pdf.loadFromFile("sample.pdf");

        //Save specified pages of the document to TIFF and set horizontal and vertical resolution
        pdf.saveToTiff("output/ToTiff2.tiff",0,1,400,600);
    }
}

Java: Convert PDF to TIFF

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Published in Conversion
Thursday, 23 December 2021 07:24

Java: Convert Word to PCL

A PCL file is a digital printed document created in the Printer Command Language. It can be printed to HP LaserJet printers directly without having to be opened in an application. At some point, you might need to convert Word document to PCL. This article will introduce how to implement the conversion programmatically in Java using Spire.Doc for Java.

Install Spire.Doc for Java

First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>13.11.2</version>
    </dependency>
</dependencies>

Convert Word to PCL

The following are the steps to convert a Word document to PCL:

  • Create an instance of Document class.
  • Load a Word document using Document.loadFromFile() method.
  • Save the document to PCL using Document.saveToFile() method.
  • Java
import com.spire.doc.Document;
import com.spire.doc.FileFormat;

public class ConvertWordToPCL {
    public static void main(String[] args){
        //Create a Document instance
        Document document= new Document();
        //Load a Word document
        document.loadFromFile("Sample.docx");

        //Save the document to PCL
        document.saveToFile("ToPCL.pcl", FileFormat.PCL);
    }
}

Java: Convert Word to PCL

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Published in Conversion
Thursday, 16 December 2021 07:04

Java: Convert Word to PostScript

PostScript is a page description language designed by Adobe in 1984 for the purpose of printing. A file described in PostScript language may contain text, raster/vector graphics and can be printed by any printer that supports PostScript without being opened in an application. In some cases, you might need to convert your Word document to PostScript. This article will show you how to achieve this task programmatically in Java using Spire.Doc for Java.

Install Spire.Doc for Java

First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>13.11.2</version>
    </dependency>
</dependencies>

Convert Word to PostScript

The following are the steps to convert a Word document to PostScript:

  • Create an instance of Document class.
  • Load a Word document using Document.loadFromFile() method.
  • Save the document to PostScript using Document.saveToFile() method.
  • Java
import com.spire.doc.Document;
import com.spire.doc.FileFormat;

public class ConvertWordToPostScript {
    public static void main(String[] args){
        //Create a Document instance
        Document document= new Document();
        //Load a Word document
        document.loadFromFile("Sample.docx");
        
        //Save the document to PostScript 
        document.saveToFile("ToPostScript.ps", FileFormat.Post_Script);
    }
}

Java: Convert Word to PostScript

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Published in Conversion
Friday, 26 November 2021 06:18

Java: Convert Word to EPUB

EPUB (short for electronic publication) is a popular file format for e-books. EPUB files can be read on numerous e-readers and most smartphones, tablets and computers. In some circumstances, you might need to convert your Word document to EPUB file format to make it readable on various devices. This article will show you how to achieve this task programmatically in Java using Spire.Doc for Java.

Install Spire.Doc for Java

First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>13.11.2</version>
    </dependency>
</dependencies>

Convert Word to EPUB

The following are the steps to convert a Word document to EPUB file format:

  • Create a Document instance.
  • Load a Word document using Document.loadFromFile() method.
  • Save the Word document to EPUB using Document.saveToFile() method.
  • Java
import com.spire.doc.Document;
import com.spire.doc.FileFormat;

public class ConvertWordToEpub {
    public static void main(String[] args){
        //Create a Document instance
        Document doc = new Document();
        //Load a Word document
        doc.loadFromFile("Sample.docx");

        //Save the Word document to EPUB format
        doc.saveToFile("ToEpub.epub", FileFormat.E_Pub);
    }
}

Java: Convert Word to EPUB

Convert Word to EPUB with a Cover Image

The following are the steps to convert a Word document to EPUB with a cover image:

  • Create a Document instance.
  • Load a Word document using Document.loadFromFile() method.
  • Create a DocPicture instance.
  • Load an image using DocPicture.loadImage() method.
  • Save the Word document to EPUB with cover image using Document.saveToEpub(String, DocPicture) method.
  • Java
import com.spire.doc.Document;
import com.spire.doc.fields.DocPicture;

public class ConvertWordToEpubWithCoverImage {
    public static void main(String[] args){
        //Create a Document instance
        Document doc = new Document();
        //Load a Word document
        doc.loadFromFile("Sample.docx");

        //Create a DocPicture instance
        DocPicture picture = new DocPicture(doc);
        //Load an image
        picture.loadImage("Cover.png");

        //Save the Word document to EPUB with cover image
        doc.saveToEpub("ToEpubWithCoverImage.epub", picture);
    }
}

Java: Convert Word to EPUB

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Published in Conversion

Spire.Doc for Java allows developers to convert Word documents to password-protected PDF documents by using the Document.saveToFile(String, ToPdfParameterList) method. The ToPdfParameterList parameter controls how a Word document will be converted to PDF, for example, whether to encrypt the document while converting.

Install Spire.Doc for Java

First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>13.11.2</version>
    </dependency>
</dependencies>

Convert Word to Password-Protected PDF

The following are the steps to convert a Word document to password-protected PDF:

  • Create a Document instance.
  • Load a Word document using Document.loadFromFile() method.
  • Create a ToPdfParameterList instance.
  • Set open password and permission password for PDF using ToPdfParameterList.getPdfSecurity().encrypt() method.
  • Save the Word document to PDF with password using Document.saveToFile(String, ToPdfParameterList) method.
  • Java
import com.spire.doc.Document;
import com.spire.doc.ToPdfParameterList;
import com.spire.pdf.security.PdfEncryptionKeySize;
import com.spire.pdf.security.PdfPermissionsFlags;

public class ConvertWordToPasswordProtectedPDF {
    public static void main(String[] args){

        //Create a Document instance
        Document document = new Document(false);
        //Load a Word document
        document.loadFromFile("Sample.docx");

        //Create a ToPdfParameterList instance
        ToPdfParameterList toPdf = new ToPdfParameterList();
        //Set open password and permission password for PDF
        String password = "password";
        toPdf.getPdfSecurity().encrypt(password, password, PdfPermissionsFlags.None, PdfEncryptionKeySize.Key_128_Bit);

        //Save the Word document to PDF with password
        document.saveToFile("ToPdfWithPassword.pdf", toPdf);
    }
}

Java: Convert Word to Password-Protected PDF

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Published in Conversion

In daily work, converting a Word document to other formats can be extremely frequent. For example, sometimes you may need to convert a Word document to XML to store and organize data; on some occasions, you may also need to convert Word to SVG for sharing graphics contents on the Internet. In this article, you will learn how to convert Word to XPS, XML, RTF, TXT and SVG using Spire.Doc for Java.

Install Spire.Doc for Java

First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>13.11.2</version>
    </dependency>
</dependencies>

Convert Word to XPS, XML, RTF, TXT and SVG

The following are the main steps to convert Word to XPS, XML, RTF, TXT and SVG.

  • Create a Document object.
  • Load the document using Document.loadFromFile() method.
  • Use Document.saveToFile() method to save the document as SVG, RTF, XPS, XML and TXT respectively.
  • Java
import com.spire.doc.Document;
import com.spire.doc.FileFormat;
import com.spire.doc.documents.ImageType;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class ConvertWordToOtherFormats {

    public static void main(String[] args) throws IOException {

        //Create a Document object.
        Document doc = new Document();

        //Load the Word document.
        doc.loadFromFile("C:\\Users\\Administrator\\Desktop\\sample.docx");

        //Save Word as SVG.
        doc.saveToFile("output/ToSVG.svg",FileFormat.SVG);

        //Save Word as RTF.
        doc.saveToFile("output/ToRTF.rtf",FileFormat.Rtf);

        //Save Word as XPS.
        doc.saveToFile("output/ToXPS.xps",FileFormat.XPS);

        //Save Word as XML.
        doc.saveToFile("output/ToXML.xml",FileFormat.Xml);

        //Save Word as TXT.
        doc.saveToFile("output/ToTXT.txt",FileFormat.Txt);
    }
}

The original Word file:

Java: Convert Word to XPS, XML, RTF, TXT and SVG

The generated XPS file:

Java: Convert Word to XPS, XML, RTF, TXT and SVG

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Published in Conversion
Thursday, 21 October 2021 08:50

Java: Convert Word to HTML

An HTML (Hyper Text Markup Language) file is a webpage coded in HTML that can be displayed in a Web browser. It is widely used on the Web as most static webpages have an .html extension. In some cases, you need to convert some document formats (such as Word) to HTML. This tutorial will demonstrate how to convert Word to HTML using Spire.Doc for Java.

Install Spire.Doc for Java

First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>13.11.2</version>
    </dependency>
</dependencies>

Convert Word to HTML

Spire.Doc for Java can easily convert Word to HTML using Document.saveToFile() method. You can find the steps as blow.

  • Create a Document instance.
  • Load a Word document using Document.loadFromFile() method.
  • Save the document as an HTML file using Document.saveToFile() method.
  • Java
import com.spire.doc.*;

public class WordToHtml {
    public static void main(String[] args) {
        //Create a Document instance
        Document document = new Document();
        //Load a Word document
        document.loadFromFile("C:\\Users\\Test1\\Desktop\\sample.docx");

        //Save the document as HTML 
        document.saveToFile("output/toHtml.html", FileFormat.Html);
    }
}

Java: Convert Word to HTML

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Published in Conversion
Thursday, 14 October 2021 08:50

Java: Convert Word to TIFF

TIFF (Tagged Image File Format) is a flexible file format for storing raster graphics images. It's popular and widely supported by image-manipulation, scanning, faxing and word processing applications etc. The ability to store image data in a lossless format makes a TIFF file to be a useful image archive. In some cases, developers may need to convert documents in other format like Word to TIFF. In this article, we will describe how to achieve this task in Java using Spire.Doc for Java.

Install Spire.Doc for Java

First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>13.11.2</version>
    </dependency>
</dependencies>

Convert Word to TIFF

Spire.Doc for Java provides the Document.saveToTiff() method for converting Word to TIFF. This method accepts a String parameter which specifies the file path of the converted TIFF.

You can follow the steps below to convert a Word document to TIFF format:

  • Create a Document instance.
  • Load a Word document using Document.loadFromFile() method.
  • Save the document to TIFF using Document.saveToTiff() method.
  • Java
import com.spire.doc.Document;

public class ConvertWordToTiff {
    public static void main(String[] args){

        //Create a Document instance
        Document document = new Document();
        //Load a Word document
        document.loadFromFile("Sample.docx");

        //Save the document as multi-page TIFF
        document.saveToTiff("toTIFF.tiff");
    }
}

Java: Convert Word to TIFF

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Published in Conversion
Wednesday, 29 September 2021 08:40

Java: Convert RTF to Word Doc/Docx and Vice Versa

RTF, short for Rich Text Format, is created by Microsoft in 1987 for the purpose of cross-platform document interchange. It is supported by many word processing applications, and the most popular one among them is Microsoft Word. In certain circumstances, you may need to convert an RTF document to Word Doc/Docx format or convert a Word Doc/Docx document to RTF. In this article, you will learn how to accomplish this task using Spire.Doc for Java.

Install Spire.Doc for Java

First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>13.11.2</version>
    </dependency>
</dependencies>

Convert RTF to Word Doc/Docx

The following are the steps to convert an RTF document to Word Doc/Docx using Spire.Doc for Java:

  • Create a Document instance.
  • Load an RTF document using Document.loadFromFile(String, FileFormat) method.
  • Save the RTF to Doc/Docx format using Document.saveToFile(String, FileFormat) method.
  • Java
import com.spire.doc.Document;
import com.spire.doc.FileFormat;

public class RtfToDocDocx {
    public static void main(String[] args){
        //Create a Document instance
        Document document = new Document();

        //Load a RTF document
        document.loadFromFile("Input.rtf", FileFormat.Rtf);

        //Save the document to Doc
        document.saveToFile("toDoc.doc", FileFormat.Doc);

        //Save the document to Docx
        document.saveToFile("toDocx.docx", FileFormat.Docx_2013);
    }
}

Java: Convert RTF to Word Doc/Docx and Vice Versa

Convert Word Doc/Docx to RTF

The steps to convert a Word Doc/Docx document to RTF is very similar with that of the above example:

  • Create a Document instance.
  • Load a Doc or Docx document using Document.loadFromFile(String) method.
  • Save the Doc/Docx document to RTF using Document.saveToFile(String, FileFormat) method.
  • Java
import com.spire.doc.Document;
import com.spire.doc.FileFormat;

public class DocDocxToRtf {
    public static void main(String[] args){
        //Create a Document instance
        Document document = new Document();

        //Load a Docx document
        document.loadFromFile("input.docx");

        //Load a Doc document
        //document.loadFromFile("sample.doc");

        //Save the document to RTF
        document.saveToFile("toRTF.rtf", FileFormat.Rtf);
    }
}

Java: Convert RTF to Word Doc/Docx and Vice Versa

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Published in Conversion
Thursday, 23 January 2025 08:40

Java: Convert HTML to PDF

When processing HTML file, you may sometimes find them render differently depending on the browser and screen size. By converting HTML to PDF, you can maintain the layout and formatting of your HTML files, ensuring that the content looks consistent across devices and platforms. In this article, you will learn how to convert a HTML file or a HTML string to PDF in Java using Spire.Doc for Java.

Install Spire.Doc for Java

First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>13.11.2</version>
    </dependency>
</dependencies>

Convert an HTML File to PDF in Java

You can load an HTML file and then save it as a PDF file using the Document.saveToFile() method. The following are the detailed steps.

  • Create a Document object.
  • Load an HTML file using Document.loadFromFile() method.
  • Convert the HTML file to PDF using Document.saveToFile(String fileName, FileFormat.PDF) method.
  • Java
import com.spire.doc.*;
import com.spire.doc.documents.XHTMLValidationType;

public class htmlFileToPdf {
    public static void main(String[] args) {

        // Create a Document object
        Document document = new Document();

        // Load an HTML file into the document object
        document.loadFromFile("sample1.html", FileFormat.Html, XHTMLValidationType.None);

        // Save the HTML file to a PDF file
        document.saveToFile("htmlFileToPdf.pdf", FileFormat.PDF);
        document.dispose();
    }
}

Convert an HTML file to a PDF file

Convert an HTML String to PDF in Java

To convert an HTML string to PDF, you first need to add the HTML string to a paragraph in Word through the Paragraph.appendHTML() method, and then save the it as a PDF file. The following are the detailed steps.

  • Create a Document object.
  • Add a section using Document.addSection() method.
  • Add a paragraph using Section.addParagraph() method.
  • Specify the HTML string, and then add the HTML string to the paragraph using Paragraph.appendHTML() method.
  • Save the document as a PDF file using Document.saveToFile(String fileName, FileFormat.PDF) method.
  • Java
import com.spire.doc.*;
import com.spire.doc.documents.Paragraph;

import java.io.*;

public class htmlStringToPdf {
    public static void main(String[] args) throws IOException {

        // Create a Document object
        Document document = new Document();

        // Add a section to the document
        Section sec = document.addSection();

        // Add a paragraph to the section
        Paragraph paragraph = sec.addParagraph();

        // Specify the HTML string
        String htmlString = "<html><head><title>HTML to Word Example</title><style>, body {font-family: 'Calibri';}, h1 {color: #FF5733; font-size: 24px; margin-bottom: 20px;}, " +
                "p {color: #333333; font-size: 16px; margin-bottom: 10px;} ul {list-style-type: disc; margin-left: 20px; margin-bottom: 15px;}, " +
                "li {font-size: 14px; margin-bottom: 5px;}, table {border-collapse: collapse; width: 100%; margin-bottom: 20px;}" +
                "th, td {border: 1px solid #CCCCCC; padding: 8px; text-align: left;}, th {background-color: #F2F2F2; font-weight: bold;}, td {color: #0000FF;}</style></head>" +
                "<body><h1>This is a Heading</h1><p>This is a paragraph demonstrating the conversion of HTML to Word document.</p>" +
                "<p>Here's an example of an unordered list:</p><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul> " +
                "<p>Here's a table:</p><table><tr><th>Product</th><th>Quantity</th><th>Price</th></tr><tr><td>Jacket</td>" +
                "<td>30</td><td>$150</td></tr><tr><td>Sweater</td><td>25</td><td>$99</td></tr></table></body></html>";

        // Append the HTML string to the paragraph
        paragraph.appendHTML(htmlString);

        // Save the HTML string to a pdf file
        document.saveToFile("htmlStringToPDF.pdf", FileFormat.PDF);
        document.dispose();
    }
}

Convert an Html string to a PDF file

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Published in Conversion
Page 2 of 3