SQL Server Performance

Post Script file generation.

Discussion in 'General DBA Questions' started by a_lateef, Nov 11, 2002.

  1. a_lateef New Member

    Hi,
    I have sql server db and a table holds data required for printing. Now i need to extract the data from that table and put it in a new .PDF file. And, i require PS(POST SCRIPT FILE) to be created. This post script file is then finally converted to pdf file(with the use of adobe acrobat distiller).
    I am not aware of creating this PS file. Which is nothing but the flat file(but some formating done(like spaces.. control break... etc.,)..
    If anyone has got experienced this.. Kindly share with me..

    Regards


    Abdul Lateef.
    Polaris Software Labs.
    001 91 44 4341964.
  2. Chappy New Member

    We have a similar system, although it was written with the help of applciation code. I think you might struggle to get SQL server to output the postscript directly.

    Basically you have a set of functions at the top of your postscript for different entities in your postscript file. Lets say you wanted a bold line of text, and a non bold, it might look something like (from the top of my head, could actually be a little different..)

    /BOLDLINE (text) (xpos) (ypos)
    {
    code to draw bold line
    } def
    /NORMALLINE (text) (xpos) (ypos)
    {
    code to draw normal line
    } def

    after this 'header' you would then output all your lines of data
    (ypos) (xpos) (this is some bold text) BOLDTEXT
    (ypos) (xpos) (this is normal text) NORMALTEXT

    What our software does is pull data from the sql server and insert the two lines above into a temporary table. Once this is done, we must then do a second pass on the data in the temporary table, deciding the vertical position of each line, and also inserting page breaks (and page headers). It is at this point the app writes the raw postscript file, and then prepends the header.ps which contains the actual function definitions.

    If youre using application code to help you, technology has improved enough to be able to write PDF's directly from a variety of languages, and thats the route id probably choose these days.

    Hope this is at least of some use

    Chappy
  3. a_lateef New Member

    thanks chappy,
    I understand what you referred. But my concern right now is to write information to a flat file (.ps). And, i want to know how does the sqlserver stored procedure supports creating file in o/s. And, how can we write information into it.

    Regards

    Abdul lateef.

    Abdul Lateef.
    Polaris Software Labs.
    001 91 44 4341964.
  4. bradmcgehee New Member

    I am not aware of any easy way to have a SQL Server stored procedure write text files. But there is an article on the web that might help. Check out:http://www.sqlteam.com/item.asp?ItemID=4722
    for information on how to Export Data Programatically with bcp and xp_cmdshell.


    ------------------
    Brad M. McGehee
    Webmaster
    SQL-Server-Performance.Com

Share This Page