Showing posts with label pdf. Show all posts
Showing posts with label pdf. Show all posts

Sunday, March 25, 2012

Automatically generating PDF with ReportViewer

Hi, I've been using the Report viewer control for a bit, and was wondering how I can automatically run the report as a PDF. I can run it and prompt the user to open or save the PDF, but I'm not sure how to auto generate it. This is the code which prompts the user:

ProtectedSub Page_SaveStateComplete(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.SaveStateComplete

Dim pdfContentAsByte() =Me.ReportViewer1.LocalReport.Render("pdf",Nothing,Nothing,Nothing,Nothing,Nothing,Nothing)

Me.Response.Clear()

Me.Response.ContentType ="application/pdf"

Dim modCodeAsString = Request.QueryString("modCode")

Me.Response.AddHeader("Content-disposition","attachment; filename=ModuleCode-" & modCode &".pdf")

Me.Response.BinaryWrite(pdfContent)

Me.Response.End()

EndSub

Has anybody done this?

Thanks

Hi,

Do you want to save the PDF file which generates by the reporting service automatically, right?

Based on my understanding, I think when you have generate the byte[] content for your PDF file, what you should do is to use FileStream class and FileInfo class to create the corresponding file, and write the content into files, save it onto your hard disk.

If you want the method be called automatically, you can invoke the method when page loads.
For more reference on FileStream and FileInfo, see:

http://msdn2.microsoft.com/en-us/library/system.io.fileinfo.aspx
http://msdn2.microsoft.com/en-us/library/system.io.filestream.aspx

Thanks.

|||

Thanks for that, I'll have a look. Also, when I ask the user to save as .xls or .pdf for example, how can I specify that the file will be saved on the D drive, rather than the C drive as the C drive is full?

Thanks

|||

Hi,

When you are creating and storing the file, you can specify the actual disk drive where to store the file. Also, you can import the "System.Runtime.InteropServices" namespace to check the free disk volume, so that you can determine which disk drive to store the file.

Thanks.

Thursday, March 22, 2012

automaticall render as pdf after parameter selection

I am using reporting services and have a report that requires three
parameters. After the parameters are selected and the report is generated by
clicking the View Report button, I want the report to default to pdf view
instead of having to select that format and export after running it. Is this
possible? This way users can print or save from the pdf view without having
to take the extra step of exporting.
Thank you for your help!
SharlynI'm also interested in it.
tnx.
Tom.sql

Monday, March 19, 2012

Automatic PDF/TIFF generation and saving?

Ello folks...
Question for you all - I'd like to make a call from a webpage (asp or aspx)
that will call up a report with a given set of parameters, format it as a pdf
or tiff file, and save it to a location. Any ideas?
I know I can use the /ReportServer/ instance to directly call the report,
pass it the parameters I need, and render it out as a different format, but
it's the saving part that's throwing me.
Thanks!
- TerosTeros,
How about a subscription instead, or does it have to be on request?
A subscription can do this for you, but rendering on demand will always
ask.
Sorry, I don't think it can be done.
Chris
Teros wrote:
> Ello folks...
> Question for you all - I'd like to make a call from a webpage (asp or
> aspx) that will call up a report with a given set of parameters,
> format it as a pdf or tiff file, and save it to a location. Any
> ideas?
> I know I can use the ReportServer instance to directly call the
> report, pass it the parameters I need, and render it out as a
> different format, but it's the saving part that's throwing me.
> Thanks!
> - Teros|||I have seen someone say you can save the output stream as a file . I looked
for a previous post but didn;t find it.
The other way is to create a data-based subscription... in the subscription
row you can choose the filename and path...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Teros" <Teros@.discussions.microsoft.com> wrote in message
news:1BCA0EE4-E9B9-4BE9-8F35-55A0EB09FD96@.microsoft.com...
> Ello folks...
> Question for you all - I'd like to make a call from a webpage (asp or
> aspx)
> that will call up a report with a given set of parameters, format it as a
> pdf
> or tiff file, and save it to a location. Any ideas?
> I know I can use the /ReportServer/ instance to directly call the report,
> pass it the parameters I need, and render it out as a different format,
> but
> it's the saving part that's throwing me.
> Thanks!
> - Teros|||Check out the web method - RenderStream - you can render to a stream then
save the stream to a file
"Teros" wrote:
> Ello folks...
> Question for you all - I'd like to make a call from a webpage (asp or aspx)
> that will call up a report with a given set of parameters, format it as a pdf
> or tiff file, and save it to a location. Any ideas?
> I know I can use the /ReportServer/ instance to directly call the report,
> pass it the parameters I need, and render it out as a different format, but
> it's the saving part that's throwing me.
> Thanks!
> - Teros|||Teros,
AFAIK there is no way to do this from URL access. We do what you're doing
by calling the web service and saving the stream off to a file.
Ted
"Teros" wrote:
> Ello folks...
> Question for you all - I'd like to make a call from a webpage (asp or aspx)
> that will call up a report with a given set of parameters, format it as a pdf
> or tiff file, and save it to a location. Any ideas?
> I know I can use the /ReportServer/ instance to directly call the report,
> pass it the parameters I need, and render it out as a different format, but
> it's the saving part that's throwing me.
> Thanks!
> - Teros|||Thanks for the input - the report does need to be rendered on demand, so the
subscriptions wouldn't work. I'm playing with the renderstream now to see
what I can play with. It's looking pretty hopeful thus far.
Thanks!|||For PDF or TIFF files, you use the Render() method. RenderStream is used for
things like images on an HTML page.
Ted
"Mary Bray [SQL Server MVP]" wrote:
> Check out the web method - RenderStream - you can render to a stream then
> save the stream to a file
> "Teros" wrote:
> > Ello folks...
> >
> > Question for you all - I'd like to make a call from a webpage (asp or aspx)
> > that will call up a report with a given set of parameters, format it as a pdf
> > or tiff file, and save it to a location. Any ideas?
> >
> > I know I can use the /ReportServer/ instance to directly call the report,
> > pass it the parameters I need, and render it out as a different format, but
> > it's the saving part that's throwing me.
> >
> > Thanks!
> > - Teros|||Any luck Teros? I'm trying to do the same thing (I think). We have a report
that will be called from a third party application, and when it is called we
want it to create a pdf to a specific location, and then close. I'd be very
interested in knowing how you did it.
Michael C.
"Teros" wrote:
> Thanks for the input - the report does need to be rendered on demand, so the
> subscriptions wouldn't work. I'm playing with the renderstream now to see
> what I can play with. It's looking pretty hopeful thus far.
> Thanks!
>

Automatic PDF output

Normally if I want a report in PDF I have to first view the report in the web browser, then select export as PDF and save the PDF file.

Is there a way to avoid the first step (web browser viewing) and have the report immediatly in PDF as soon as I click the "View Report" button? (without using email/file subscription)

Thank you,

Roberto

use this link

http://www.codeproject.com/sqlrs/PDFUsingSQLRepServices.asp

Wednesday, March 7, 2012

Automate exporting reports to PDF

I have read these two sites:
http://blogs.msdn.com/bryanke/articles/71491.aspx
http://scruffylookingcatherder.com/archive/2007/12/07/printing-reporting-services-2005-reports.aspx
But I'm new to Reporting Services and these methods aren't well documented
(that I can find). I have a report that has four parameters -- the second
parameter is queried off the value of the first, and could potentially have
up to five unique values for each unique first value. I need to generate a
report for each unique device listed in the second parameter, spit it out to
PDF for us to review and email to the clients.
Is there a command that can be used to do this? Or do I need to do a SQL
query or two myself to pull those values, and using a foreach statement
generate a report for each?
Any suggestions would be fantastic.
--Nathan Loding
Systems Associate, Special Projects
WESCO NetI doubt that RS has the capabilities you're looking for as that kind of
round-tripping would be frought with really complicated issues (mainly
maintaining state management). I did a cursory look at the client proxy
objects and nothing lept out at me that seems like it'd do what you're
looking for. I can't claim this to be an authoritative answer, but
personally, I'm betting you'll have to redo the queries client-side if you're
going to mimic the Report Manager functionality.
Jacob
"Nathan Loding" wrote:
> I have read these two sites:
> http://blogs.msdn.com/bryanke/articles/71491.aspx
> http://scruffylookingcatherder.com/archive/2007/12/07/printing-reporting-services-2005-reports.aspx
> But I'm new to Reporting Services and these methods aren't well documented
> (that I can find). I have a report that has four parameters -- the second
> parameter is queried off the value of the first, and could potentially have
> up to five unique values for each unique first value. I need to generate a
> report for each unique device listed in the second parameter, spit it out to
> PDF for us to review and email to the clients.
> Is there a command that can be used to do this? Or do I need to do a SQL
> query or two myself to pull those values, and using a foreach statement
> generate a report for each?
> Any suggestions would be fantastic.
> --Nathan Loding
> Systems Associate, Special Projects
> WESCO Net

Sunday, February 19, 2012

Auto UpLoad

Is there a way to automate the upload of reports (.PDF's).
My DD Subscription produces .PDF files of the reports , I would like to
upload them automatically so the user can see the files via Report Manager.
Has anyone had to do thi yet?
Many thanks in advance
PaulIf I understand you correctly, (and I'm assuming some things), you have a
report(s) that take some time to generate and you want to generate them in
the background but enable the users to see them through the web-page without
the latency?
If this is correct, set up the history so that it creates the report at a
regular interval, then when someone requests the report, it will pull it from
the history.
"PaulQld" wrote:
> Is there a way to automate the upload of reports (.PDF's).
> My DD Subscription produces .PDF files of the reports , I would like to
> upload them automatically so the user can see the files via Report Manager.
> Has anyone had to do thi yet?
> Many thanks in advance
> Paul

Monday, February 13, 2012

Auto Render as .pdf

Is there a way to force the output of a manually run report using
Report Manager to output as .pdf rather than html and having to export
from there?
I would like to enter a shipment number as a prompt, then go straight
to creating a shippping document as a .pdf
Thanks
BobHi Bob,
This should answer your query
http://msdn2.microsoft.com/en-us/library/ms152835.aspx
"Bob" wrote:
> Is there a way to force the output of a manually run report using
> Report Manager to output as .pdf rather than html and having to export
> from there?
> I would like to enter a shipment number as a prompt, then go straight
> to creating a shippping document as a .pdf
> Thanks
> Bob
>