How Linux can help Windows users convert PDF files free of charge

Source: Internet
Author: User


I'm a Linux system administrator, and I've had an extra job lately-helping some Windows users convert PostScript files to PDF format. This is because there is a free Ghostscript tool on Linux that can be easily implemented, but there is no free conversion tool under Windows.



I figured out a way for Windows users not to learn Linux commands, simply to "print" The file, to complete the conversion, as described below.



Basic principle



The rationale for this approach is to use Ghostscript to convert PostScript files to PDF format, and then create a virtual Ps-printer printer under Linux via Samba, The virtual printer is then used to output the converted PDF file to a shared directory for use by Windows users. The following is a brief introduction to the software that is applied.



1.Samba



Samba is a software operating in a Linux environment that provides Windows access to Linux, allowing users to easily share files and printers in different system environments.



2.Ghostscript



The Ghostscript includes a ps2pdf tool that converts PostScript to PDF format. If the system has a GS command, then the Ghostscript has been installed, otherwise you need to install according to the system version.



Set method



1. Create a "print" script



Create a script that converts the PostScript file in the print pool to PDF format and outputs it to the specified directory. By sharing the directory with Samba, users can read the PDF file they created.



First, set the read and write permissions for the file output directory for the relevant users:


#chown nobody/home/becks/pdf
#chmod 740/home/becks/pdf


Then, set the permissions of the other person according to the actual need.



When the permissions are set, create a script that converts the PostScript file to PDF format:


#! / bin / sh
name = 'date +% b% d-% h% m% s'
#Fill in the path to output the PDF file below
outdir = / home / becks / pdf
ps2pdf $ $ OUTDIR / $ Name.temp
MV $ OUTDIR / $ NAME. Temp $ OUTDIR / $ NAME. PDF
RM $ 


Place the script in the/usr/bin directory under the Linux system and name it printpdf. The script can also be downloaded to the http://www.ec-base.com/download/printpdf.txt.





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.