Thursday, March 21, 2013

Creating a Free PDF Printer in Windows 7 using Ghostscript and Redmon that is one tenth the size of a full Adobe install


Introduction
(download a pdf of this article with screenshots here)

Adobe PDF's are the lingua franca of online document distribution and while the Adobe Acrobat Professional software is great, it is rather expensive for students, teachers, or anyone who wants to save $115-$180.  The steps described below will give you a completely free working PDF printer but it is important to point out that this won't let you create forms, binders, or any of the advanced Acrobat features that come in the commercial package.  It will however let you render documents to a PDF exactly like you would see on your printer and that is 80-90% of what most people need.

In addition, the total install will only occupy ~40MB on your computer, which is approximately one tenth the size of the smallest Acrobat Professional install (and it doesn't require a reboot).

At a very high level we are going to do 3 things:
  1. Create a virtual printer port that works just like a USB cable or network address does for a real printer using a free program called RedMon.
  2. Attach a printer driver (that comes with Windows) to that port which creates PostScript output (PostScript is a page description language that tells printers what to print) 
  3. Pipe the PostScript output to a free, open source, rendering engine called "Ghostscript" that will turn it in to a PDF (or TIFF, or PNG... it can do lots of neat things)
That's it.  Here are the step by step instructions for creating a pdf printer in Windows 7

Step 1: Installing a virtual Printer Port using RedMon

  1. Download RedMon, the Redirection Port Monitor.  The latest (as of this writing) download is version 1.9 and can be foundhere.  The RedMon home page is found here.
  2. Unzip Redmon19.zip and run the appropriate 32 (setup.exe) or 64 bit (setup64.exe) installer.  You may need to be an administrator on your machine to do this so either log in as an admin, or right click on the appropriate setup executable and choose "Run As Administrator"
  3. Click "Yes" to the dialog asking "Do you want to install the RedMon redirection port monitor?"
  4. Click "OK" on the "Installation Successful" dialog.
  5. Don't worry that there aren't any icons or apparent signs of something being installed, You have actually added a new type of port called a "Redirect Port" to the guts of Windows.

Step 2: Create the Virtual PDF Printer using a Windows Driver

  1. Open "Devices and Printers from the "Start" menu
  2. Click "Add a Printer" in the upper left
  3. Choose "Create a new port:" and select "Redirected Port"
  4. Use the Port Name "RPT1:" (this should be the default) and click "OK"
  5. Now choose a printer driver from the list (Note: The printer MUST be postscript.  An "HP ColorLaserJet 2800 PS" works because it is both color and postscript).
  6. Name the printer something useful (like "PDF Printer" for example)
  7. Decide whether or not to share the printer... it is easiest to choose "Do not share this printer"
  8. Windows should install the printer driver.  You will have a new printer in your "Devices and Printers" window
  9. Click "Finish"  Don't click "print a test page" because nothing will happen yet, you need to redirect the PostScript to your rendering engine using the steps below.

Step 3: Install a PostScript rendering engine using Ghostscript

  1. Download Ghostscript.  The latest version (as of this writing) is found here.  You will need to select the correct 32 or 64 bit version depending on your version of Windows.  The homepage for Ghostscript is here.
  2. I find it is easier to create a folder called "gs" before I install Ghostscript.  I do this at the root of my system drive: "c:\gs"  This removes the spaces from the folder names and just makes Ghostscript behave better.
  3. Run the Ghostscript installer downloaded from step 1. (Click "Next")
  4. Agree to the license terms after carefully reviewing them.
  5. Choose the installation folder "c:\gs"
  6. Let the install finish.
  7. Now open notepad.exe and add the following text to it:

    #begin config file c:\gs\pdfwrite.txt
    #creates a 600dpi, letter sized PDF
        -IC:\gs\gs\lib;C:\gs\fonts
        -sDEVICE=pdfwrite
        -r600
        -dNOPAUSE
        -dSAFER
        -sPAPERSIZE=letter
        -dCompatibilityLevel=1.4
        -dPDFSETTINGS=/prepress
    #end config file c:\gs\pdfwrite.txt
  8. Save this file with the filename: c:\gs\pdfwrite.txt  This configuration file will be used to tell Ghostscript how to create a PDF file.  This will create a 600 dpi Letter sized PDF from your printed output.
  9. Optional:  You can actually create many printers and do things like create TIFF images using different config files and printer names.  Here is a file named "c:\gs\tiffwrite.txt" that creates TIFF images.  If you created another virtual port (RPT2:) and used this file instead in the above instructions, you would be making TIFF's instead of PDF's

    #begin config file c:\gs\tiffwrite.txt
    #creates a 600 dpi Black and White Group 4 TIFF
        -IC:\gs\gs9.00\lib;C:\gs\fonts
        #sDEVICE info from http://pages.cs.wisc.edu/~ghost/doc/cvs/Devices.htm
        -sDEVICE=tiffg4
        -r600
        -dNOPAUSE
        -dSAFER
        -dBATCH
        -sPAPERSIZE=letter
    #end config file c:\gs\tiffwrite.txt

Step 4: Configure your Virtual PDF printer to use Ghostscript

  1. Go to "Devices and Printers" from the "Start Menu"
  2. Double click on the printer created above "PDF Printer"
  3. Double click on "Customize your printer"
  4. Select the "Ports" tab and click "Configure Port" for "RPT1:"
  5. Browse to "c:\gs\bin" and select gswin64c.exe.  Your "Redirect this port to the program:" field should read "c:\gs\gs\bin\gswin64c.exe"
  6. The "Arguments for this program are:" Field should be the following text exactly:

          @C:\gs\pdfwrite.txt -sOutputFile="%1.pdf" -c .setpdfwrite -f -
  7. Select "Prompt for filename" under "Output"
  8. Select "Hidden" under run
  9. Click "OK"
  10. Select the "Advanced" tab and choose "Print directly to the printer
  11. Under the “Device Settings” tab we will make 2 changes.  The first is to set “Send Ctrl-D before each job” to “No.” And then set the “Wait Timeout” to 1 second (this is a very fast printer since it isn’t actually printing anything).  Finally Click “Apply” to commit the changes
  12. Print a test page, you will be prompted for a file name and directory to save your pdf in.
  13. Open your freshly minted PDF in any reader of your choice (At a tiny 4.2 MB, my favorite is Sumatra PDF Reader)
That is it.  You should be able to create PDF's at will by using this simple set up.  To do this, simply print a document like you would any other document, but instead of choosing a physical printer, choose the "PDF Printer"

Monday, March 11, 2013

SQL Server 2008 Express Full



1. Giới Thiệu : SQL Server 2008 có nhiều phiên bản khác nhau, trong đó bản Express là bản thấp nhất, được Microsoft cung cấp miễn phí cho người dùng với mục đích học tập và ứng dụng vào những ứng dụng nhỏ, không yêu cầu cao về các tính năng khác ngoài việc lưu trữ và xử lý đơn giản.

2. Yêu cầu về phần cứng và hệ điều hành sử dụng:- Hệ điều hành tối thiểu: Windows XP SP3, Windows Wista SP1, Windows 7, Windows 2003 SP2.
- Phần cứng: Pentium IV 2Gb MHz trở lên. Tối thiểu 1 GB RAM. Ổ cứng 10 GB.

3. Link Download :
- Để cài đặt SQL Server 2008 Express download về tại địa chỉ:
or 

- Để cài đặt SQL Server 2008 Express with management tools download về tại địa chỉ:
or 

- Microsoft .Net Framework 2.0 SP2 download về tại địa chỉ: 



- Bạn phải có Windows Installer 4.5 download về tại địa chỉ: 



- Bạn phải có Windows PowerShell 1.0


+ Chú ý : đối với máy tính cài Windows XP, khi cài SQL Express 2008, nó sẽ thường báo lỗi máy tính phải có cài .Net Framework 2.0 SP2 và Windows Installer 4.5 rồi nó mới cho cài SQL Express 2008. Thì các bạn phải down Net framework 2.0 sp2 và Windows Installer 4.5 ở link trên về cài đặt xong rồi mới cài Sql Express 2008.



4. Các bước cài đặt :
- Bước 1 : Tại màn hình cài đặt SQL Server 2008 bạn chọn mục Installation sau đó chọn New SQL Server stand-alone installation or add features to an existing installation

- Bước 2 : Tại màn hình Setup Support Rules chọn OK

- Bước 3 : Tại màn hình "Product Key", chọn Next để tiếp tục

- Bước 4 : Tại màn hình License Term, đánh dấu chọn nút "I accept the licence terms", rồi chọn "Next"

[IMG]http://seablogs.zenfs.com/u/U9MTH16GHxbZdIXBkXA_5lSmi7gn/photo/ap_201105020902***51.jpg[/IMG]

- Bước 5 : Tại màn hình "setup support files" nhấn nút "install" để tiếp tục.

- Bước 6 : tại màn hình "Setup Support Rules", nếu mỗi thứ suôn sẽ, thì nhấn nút "Next" để tiếp tục.

- Bước 7 : Trên màn hình "features selection", nhất nút "Sellect All" để chọn tất cả, sau đó nhấn nút "Next".

- Bước 8 : tại màn hình "instance Configuratio", có 2 lựa chọn : chọn như hình dưới, rồi nhấn nút Next để tiếp tục ....

- Bước 9 : Chọn Next để tiếp tục.

- Bước 10 : Chọn "Account Name" và chọn là NT AUTHORITY\NETWORK như trong hình sau đây, sau đó nhấn Next để tiếp tục.

- Bước 11 : Trên màn hình "Database Engine Configuration", trong phần Account Provisioning, ta chọn "Windows Authotication Mode" hoặc "Mixed Mode" đều được cả
+ Chọn "Windows Authotication Mode" không cần nhập PassWord, để đơn giản ta nên chọn "Windows Authotication Mode"
+ Chọn "Mixed Mode" thì ta phải nhập PassWord.
+ Sau cùng ta nhấn vào nút "Add Current User", rồi nhấn nút Next để tiếp tục.



- Bước 12 : nhấn nút "Next" để tiếp tục

- Bước 13 : nhấn nút "Next" để tiếp tục

- Bước 14 : nhấn nút "Install" để tiến hành cài đặt, quá trình cài đặt khoảng 3 phút ...

- Bước 15 : Nhấn nút "Next" để hoàn thành quá trình cài đặt. Cuối cùng cũng xong 


Nguồn: http://www.ddth.com/showthread.php/818221-SQL-Server-2008-Express-Full-Hướng-dẫn-cài-đặt#ixzz2NIXSmKvS