Creating a PDF from a Stored Procedure in SQL Server

  • have you got any solution for this i have same prob like you not solved yet

    thanks in advance

  • I run SQL2PDF it is running fine but pdf file is not getting created...

  • Hi,

    I am able to run the SQL2PDF procedure, but .pdf is not creating... someone pls. help...

    thanks in advance

    Thanks

    Sandeep

  • I want to create a file with at least 100.000 rows but there is a problem, I get error 104 when open the pdf file created...please any suggestions are welcome...??

  • Reviving a somewhat zombified thread here, but....

    Has anyone figured out how, using this procedure, to put a graphic image into the created pdf?

  • Hey Ivica. Your stored procedure is very good. Thanks for that. I just want to know one thing. I am trying to get 20 columns per row. I have changed column lengths of #pdf , #xref, #text and also modified substring part to include the length.. tables and all that. The query executes properly.

    The problem is that the pdf displays rows only upto a certain length. Rest of the columns are discarded or maybe cutoff.

    How do I turn the orientation of pdf from portrait to landscape?

    OR

    How do I increase page width?

    I have taken a look at Acrobat Reference Manual but didn't find anything useful as for page width or orientation.

    I got some annotations for Font and RichMediawindow. For eg.

    3 0 obj

    << /Type /Page

    /Parent 4 0 R

    /MediaBox [0 0 612 792]

    /Resources << /Font << /F3 7 0 R

    /F5 9 0 R

    /F7 11 0 R

    >>

    /ProcSet [/PDF]

    >>

    /Contents 12 0 R

    /Thumb 14 0 R

    /Annots [ 23 0 R

    24 0 R

    ]

    >>

    endobj

    Is there anything like this I can change in sp to increase page width or orientation.

    BTW. Thanks again. Your SP is great.

  • Anyway I solved my problem. Apparently acrobat api doesn't have any width or orientation properties.

    Width is controlled by Mediabox parameters and orientation is controlled by Rotation property.

    I was able to accommodate 15 columns with consistent spacing among all rows by increasing mediabox's parameters.

    That gives it a landscape orientation effect.

    Also whatever formatting I did was only before the sql2pdf execution. i.e. By using SPACE() function in sql.

    Maybe I'll look into how to directly enter a whole table as a parameter.

    Once again.

    Thanks alot.

    Regards,

    C.Pednekar.

  • Has anyone been able to increase the max line length above 80 characters?

    Nevermind. found it.

    FOR SELECT SUBSTRING((code + SPACE(81)), 1, 80) FROM #text WHERE idnumber BETWEEN ((@nopg * 60) + 1) AND ((@nopg + 1) * 60 )

    To

    FOR SELECT code FROM #text WHERE idnumber BETWEEN ((@nopg * 60) + 1) AND ((@nopg + 1) * 60 )

  • I am sorry I couldn't respond to you any early. Didn't you read my previous comment?

    I have clearly stated that length of the pdf horizontally can be controlled by MediaBox parameter.

    But here is the catch.

    Before running the sql proc you have to make sure of three things.

    1. Apply consistent spacing using the SPACE() function in sql server.

    2. Increase width of following parameters -

    - #pdf , #xref, #text and MediaBox

    3. Enable a monospace font in the sql2pdf proc. If you don't then despite of equivalent and consistent spacing the formatting would be messed since other fonts which are not monospace output characters in different widths.

    Finally fill the table with the formatted data and then run the query.

    TBH you can work a lot on this and get a decent enough output but its really not worth the effort.

    I asked my manager and got this functionality replaced with SSRS 2005.

    Anyway.

    Later.

  • Hi

    could you please help me to formatthe pdf

    like put company imange

    header,footer, page mumber defalt created date

    it will be very help full if you reply quick

    Thanks

    Jalpa

  • How can you make pdf landscape? I have a report that has 20 columns.

  • How can you make pdf landscape? I have a report that has 20 columns.

  • Where did you increase Mailbox params? I am trying to get 20 columns in one report. It keeps getting truncated.

  • I was able increase width. However, my row still gets truncated. How can I increase the lenght of the row so it does not truncate

    I set MediaBox to:

    INSERT INTO #pdf (code) VALUES ('/MediaBox [ 10 0 900 842 ]')

    I can see the width increased on the page but not the row it self.

    Thanks, Richard

  • Hi I implemented your code change but my line lenght did not change. My lines still get runcated.

    I replace:

    FOR SELECT code FROM #text WHERE idnumber BETWEEN ((@nopg * 60) + 1) AND ((@nopg + 1) * 60 )

    with this code:

    FOR SELECT SUBSTRING((code + SPACE(81)), 1, 300) FROM #text WHERE idnumber BETWEEN ((@nopg * 60) + 1) AND ((@nopg + 1) * 60 )

    Any ideas on what I need to do to increse line/row lenght?

    Thanks, Richard

Viewing 15 posts - 106 through 120 (of 152 total)

You must be logged in to reply to this topic. Login to reply