Creating a PDF from a Stored Procedure in SQL Server

  • I used this procedure it is good, but according to my requirement for text formatting in PDF. kindly suggest how can do.

  • jairamkumar01 - Wednesday, November 15, 2017 12:44 AM

    I used this procedure it is good, but according to my requirement for text formatting in PDF. kindly suggest how can do.

    You need to tell us what your "requirement" is before anyone can actually suggest how to meet your "requirement".

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • There are following requirement:
    1- Text Formatting in some place like bold , underline
    2- Some dynamic data display like address or name there length are  flexible. How it's set in fixed width
    3- How it possible to support HTML tag on PDF

  • jairamkumar01 - Friday, November 17, 2017 11:07 PM

    There are following requirement:
    1- Text Formatting in some place like bold , underline
    2- Some dynamic data display like address or name there length are  flexible. How it's set in fixed width
    3- How it possible to support HTML tag on PDF

    I guess the original author has gone missing.  They haven't responded to any of the questions the others have had in quite some time.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • This would actually be a good interview question. If the candidate laughs or responds only with raised eyebrows, then they answered correctly.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Eric M Russell - Monday, November 20, 2017 12:30 PM

    This would actually be a good interview question. If the candidate laughs or responds only with raised eyebrows, then they answered correctly.

    BWAAA-HAAA!!!  That would make it an "advanced" question... heh... right after the GETDATE() question. 😉

    To your point (or at least I think it's a part of your point), there's an awful lot of code out there that does things like this correctly and with full functionality such as page breaks, headers, foots, page numbers, graphic hot spots, the whole nine yards.  Some of them are free and some only cost something like 20 bucks.  If you want to go enterprise class, you can do that too and not have to worry about doing things like installing WORD (or parts of it) on your SQL Server.

    I'm all for doing things in T-SQL but creating PDFs using T-SQL isn't one of the things that I think should be done using only T-SQL.  There are just too many good and properly tested methods that T-SQL could call or send a "Merge File" to.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Dating back to 2002, SSRS has had export to PDF functionality. I'd use that.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Hi there! how can i set page orientation? thanks!

  • Natalia-252090 - Tuesday, February 28, 2006 11:35 AM

    Works awesome. Specially after adding bug fixes suggested by blinard and ivica to prevent data from being truncated: use smaller fonts,  seting in table #pdf code nvarchar(400)  setting @trenutnired nvarchar(400) However I would like to know if it's possible:

     - add in graphics into file / or use templates with graphics/watermark - add fonts, bold, colors, etc - insert created file on the fly into database as a Blob without storing locally - wrapping text inside  if anyone have solution - please post the code! Thanks!Natalia 

    Did anyone ever figure out a way to change the font color or font face?  Thanks

  • mivica - Sunday, July 27, 2003 12:00 AM

    Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/mivica/creatingapdffromastoredprocedure.asp

    Can you explain how to use html tags inside of this procedure which you post.?
    because i have used this procedure for creating PDF inside the PDF i have to highlighted some texts and has to include images at all.

  • For those longing for additional information on this article and code, the author hasn't even logged into SQLServerCentral.com in the last 11 years and has never made a reply to his own article discussion (this thread) nor any post.  I suspect the author has left the building.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Very use full procedure, Thanks author.

  • Does the same can be done for generating PDF file using Oracle PL/SQL ?

     

  • mynksoni wrote:

    Does the same can be done for generating PDF file using Oracle PL/SQL ?  

    No, not using the same stored procedure. If you do a search, you will find links to some ways to do it in Oracle.

    Sue

  • While sql2pdf produces a PDF that 'works' it's not valid.  Parsing the example given in the article at https://www.pdf-online.com/osa/validate.aspx resulted in:

    File: test.pdf

    Compliance: pdf1.2

    Result: Document does not conform to PDF/A.DetailsValidating file "test.pdf" for conformance level pdf1.2

    The 'xref' keyword was not found or the xref table is malformed.

    The file trailer dictionary is missing or invalid.

    The document does not conform to the requested standard.

    The file format (header, trailer, objects, xref, streams) is corrupted.

    The document does not conform to the PDF 1.2 standard.

    Done.

Viewing 15 posts - 136 through 150 (of 152 total)

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