Java calls GSview to print PDFs

Source: Internet
Author: User

Objective

In a previous article, the Java Printservice API was introduced, although it supports print functionality, but does not have the ability to interpret documents such as PDF, MS Word, and so on.

And because printers that support post script standards are often expensive, inexpensive printers circulating on the market (using host-based drivers) are largely unsupported.

And the previous article provided a way to print PDFs using Adobe Reader, this article is in the same fashion, but with GSview.

GSview is more capable of silent printing than Adobe Reader, because I always pop up a window of Adobe Reader Center in the process of using Adobe Reader, and it's disgusting ~ and I can't find a workaround.

There is no such situation when using GSview.


Preparatory work

First go to GSview's official online download GSview The latest version, here by the way GSview's official website,

I'm using Gsv50w32.exe and Ghostscript 9.15, and these two versions need to be matched to the main program, followed by something like the script interpreter (engine) or the environment.


Specific use
public static void Printbygsview (string printername, String filePath) {try {runtime.getruntime (). EXEC ("cmd.exe/c Gsprint-printer \ "" + PrinterName + "\" "+ FilePath);} catch (IOException e) {e.printstacktrace ();}}

Where the-printer parameter can specify the printer by name

Java calls GSview to print PDFs

Related Article

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.