Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 9th November 2009, 08:24 PM
stlouis Offline
Registered User
 
Join Date: Oct 2008
Location: CANADA
Posts: 176
linuxfedorafirefox
Shell Trick #1: Show me the PDF

Show me the PDF


I've been using Linux for many years now, and have come up with some cool TRICKS that some of you may find useful. I hope you enjoy them as much as I do. I'll be posting them at random on this site, as time permits.




Trick #1: Show me the PDF

Have you ever been logged onto a System, trying to read a MAN PAGE or another TEXT document and said, that would be nice if I could just have it pop up as PDF? If so, try this:

Requirements:

a) Enscript installed on Linux Server
b) PuTTY Terminal Emulator for Windows
c) PDFCreator (from SourcForge) installed on Windows Workstation, with Auto-Save Option enabled and the Open in Default PDF Viewer option enabled. You must also set PDFCreator as the default printer to send output to in PuTTY.


Copy and Paste the following code into a BASH script on your linux server called "pdfit"

Code:
#!/bin/bash
# script: pdfit

# Capture stream and convert to Postscript
cat $@ | enscript -p stream.$$.ps

# Open/Close VT Compatible Transparent/Passthrough Print Channel, and Send File
printf "\033[5i"
cat stream.$$.ps
printf "\033[4i"

# Clean-up workfile
rm -f stream.$$.ps

# Exit Clean
exit 0

*** Copy/Put pdfit script into executable path, and give execute permissions. Eg. mv pdfit /usr/local/bin or /usr/bin and chmod +x pdfit

Sample Usages:

pdfit <filename>

cat <filename> | pdfit

man <command> | pdfit


*** I recommend the use of FOXIT PDF READER, much, much faster than Adobe. If you are PDF'ing a very large file, this may take some time. More so if the stream is being passed via from an External Source (NOT ON YOU LAN). But it's still very fast, in my opinion ***


You imagination is your limitation. I have a custom print script written specifically for PCL and TEXT based print streams for PDF Generation in this fashion. I've also added additional functionality such as usage of Overlays/Watermarks, Format Manipulation using GREP/SED/AWK based on Job Type, etc... A lot of which is specific to the software my company runs, as we are still utilizing a character based software. It's actually quite neat. About 1000 lines of BASH code



Last edited by stlouis; 9th November 2009 at 08:26 PM. Reason: Forgot Something
Reply With Quote
  #2  
Old 9th November 2009, 08:28 PM
stlouis Offline
Registered User
 
Join Date: Oct 2008
Location: CANADA
Posts: 176
linuxfedorafirefox
One more note, here's the links to the software you'll need.

PDFCreator
http://sourceforge.net/projects/pdfcreator/files/

PuTTY
http://www.chiark.greenend.org.uk/~s.../download.html

Foxit PDF Reader (recommend over Adobe, much faster)
http://www.foxitsoftware.com/pdf/reader/
Reply With Quote
  #3  
Old 9th November 2009, 08:29 PM
stlouis Offline
Registered User
 
Join Date: Oct 2008
Location: CANADA
Posts: 176
linuxfedorafirefox
If anyone needs help with PDFCreator, just post your questions, and I'll do my best to help you out... Haven't tested with Windows 7 though, but don't see why it wouldn't work.
Reply With Quote
  #4  
Old 9th November 2009, 08:34 PM
khrombaa Offline
Registered User
 
Join Date: Oct 2009
Posts: 41
linuxubuntufirefox
nice trick buddy thank you

Linux Archive

Last edited by khrombaa; 14th December 2009 at 07:15 AM.
Reply With Quote
  #5  
Old 9th November 2009, 08:38 PM
stlouis Offline
Registered User
 
Join Date: Oct 2008
Location: CANADA
Posts: 176
linuxfedorafirefox
UPDATE:

I forgot to add the --no-header to the enscript command. This will remove the header that gets stamped on every page.

NEW CODE:

Code:
#!/bin/bash
# script: pdfit

# Capture stream and convert to Postscript
cat $@ | enscript --no-header -p stream.$$.ps

# Open/Close VT Compatible Transparent/Passthrough Print Channel, and Send File
printf "\033[5i"
cat stream.$$.ps
printf "\033[4i"

# Clean-up workfile
rm -f stream.$$.ps

# Exit Clean

exit 0
Reply With Quote
Reply

Tags
pdf, shell, trick

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to do the IPV6 Trick in Opera CrossGT-6 Servers & Networking 0 15th November 2008 07:09 PM
NOBODY, ever thought of this little trick in KDE mickeyboy Using Fedora 6 4th April 2006 01:59 PM
Kpackage tar.gz trick ThersOnly1Hutch Using Fedora 3 19th September 2005 09:08 AM
Partition Magic's trick not so magical... trijuice Using Fedora 1 22nd June 2005 05:00 AM


Current GMT-time: 23:52 (Thursday, 23-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat