Java calls GSview to print PDF, java calls gsviewpdf

Source: Internet
Author: User

Java calls GSview to print PDF, java calls gsviewpdf
Preface

In a previous article, I introduced the Java PrintService API. Although it supports printing, it does not have the ability to interpret documents such as PDF and MS Word.

In addition, the support for Post Script standard printers is usually expensive, and cheap printers (using host-based Drivers) on the market are basically not supported.

In addition, the previous article provided the use of Adobe Reader to plug-in PDF printing. This article adopts the same method, but only GSview.

Compared with Adobe Reader, GSview can achieve silent printing, because when I use Adobe Reader, an Adobe Reader Center window will pop up, which is disgusting ~ The solution is not found.

This does not happen when GSView is used.


Preparations

First, go to the GSView official website to download the latest version of GSview,

I am using gsv50w32.exe and Ghostscript 9.15The two versions must match. The former is the main program, and the latter is something like a script interpreter (ENGINE) or an environment ~


Usage
Public static void printByGSview (String printerName, String filePath) {try restarting runtime.getruntime(cmd.exe c ("cmd.exe/C gsprint-printer \" "+ printerName +" \ "" + filePath );} catch (IOException e) {e. printStackTrace ();}}

The-printer parameter specifies the printer Based on the name.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.