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

Friday, March 30, 2012

How to simulate Nothing from a deep link

Hello-

I'm working on an app that will create an HTTP connection to the SSRS server to gather a PDF generated by SSRS and place it on the LAN. looks something like this :

http://server/ReportServer?%2fDEV%2frpt_Sheet&rs%3aCommand=Render&rc:Toolbar=false&userID=NULL&StoreID=23&rs:Format=PDF

We have a few reports where 1 or more parameters can be null, but I'm having one heck of a time trying get this to work with a null value. Does anyone know what value is actually passed to SSRS when a parameter is NULL?

I have tried Nothing, but to no avail.

Thanks in adavance,

Tristan

Do not include that parameter in the link and set its default value as null or send something like this:

parameter name = "param1"

&param1%3aisnull=True

http://reportserver/?%2fReport1Test&param1%3aisnull=True&rs%3aParameterLanguage=&rc%3aParameters=Collapsed

Maciej

Monday, March 26, 2012

How to show a stored PDF

New to asp and have no idea what I'm doing wrong here. I just want to open a pdf that I have stored in a table and show it on the page. Here is my code. I keep getting theSystem.NullReferenceException was unhandled by user code.

<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:smithsdaConnectionStringtest %>"

ProviderName="<%$ ConnectionStrings:smithsdaConnectionStringtest.ProviderName %>"

SelectCommand="SELECT * FROM [correspondence] WHERE ([facilitiesID] = ?)">

<SelectParameters>

<asp:QueryStringParameterName="facilitiesID"QueryStringField="DACorr"Type="Int32"/>

</SelectParameters>

</asp:SqlDataSource>

<scriptrunat="server">

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)

Dim ScanDocAsNew DataViewDim argAsNew DataSourceSelectArguments

ScanDoc = SqlDataSource1.Select(arg)

Dim ScanLet(1)AsByte

ScanLet(0) =CByte(ScanDoc(0)("Letter"))

If ScanDocIsNot""Then

Response.Buffer =True

Response.Clear()

Response.ClearContent()

Response.ClearHeaders()

Response.ContentType ="application/pdf"

Response.BinaryWrite(ScanLet)

Response.End()

EndIf

EndSub

</script

Any Help greatly appreciated.

My suggestion would be to store the PDF files, all in one directory, then, in the database, store the names of the PDF files.

Then, show the relevant information in the database, using a Gridview, including one TemplateField, which would have a Hyperlink to the folder where the pDFs are stored, and the PDF itself. Then, when people clicked on the hyperlink, the PDF would show

|||

David,

Thanks for the reply. I wish I could do it that way, unfortunately they want the pdfs stored in the database so noone can accidentally delete them. The db has probably 200 stored pdfs associated with records and they need to be able to pull them up for viewing.

Thanks,

DeWayne

|||

I've changed the code to this and now it just opens a blank web page.

Dim ScanDocAsNew DataViewDim argAsNew DataSourceSelectArguments

ScanDoc = SqlDataSource1.Select(arg)

Dim ScanLet(1)AsByte

ScanLet(0) =CByte(Request.QueryString("Letter"))

If ScanDocIsNot""Then

Response.Buffer =True

Response.Clear()

Response.ClearContent()

Response.ClearHeaders()

'Response.AddHeader("content-disposition", "inline;filename=" + ScanLet)

Response.ContentType ="application/pdf"

'Response.AppendHeader("content-disposition", "inline;filename=" + "Scan.PDF")

Response.BinaryWrite(ScanLet)

Response.End()

'Else

' Response.Write("Error")

EndIf

I think I am on the right track but no PDF file yet.

|||

I finally got it, thanks to reading other posts in the forum and especially the one from adam v on how to strip the ole header. Now I just have to deal with .doc and .tif headers. This is a great forum and I have found lots of useful tips and tricks in here.

Thanks.

Here is the code I ended up with...

myConnection.Open()Dim myDataReaderAs OleDbDataReader = myCommand.ExecuteReader() myDataReader.Read()Dim intLoopCountAs Integer Dim intPositionAs Integer Dim ScanLetAs Byte() = myDataReader("letter")Do While intLoopCount < ScanLet.LengthIf ScanLet(intLoopCount) = 37Then'%If ScanLet(intLoopCount + 1) = 80Then'PIf ScanLet(intLoopCount + 2) = 68Then'DIf ScanLet(intLoopCount + 3) = 70Then'FIf ScanLet(intLoopCount + 4) = 45Then'- intPosition = intLoopCount intLoopCount = ScanLet.LengthEnd If End If End If End If End If intLoopCount = intLoopCount + 1Loop Dim bytStrippedData(ScanLet.Length - intPosition - 1)As Byte System.Buffer.BlockCopy(src:=ScanLet, srcOffset:=intPosition, dst:=bytStrippedData, dstOffset:=0, count:=ScanLet.Length - intPosition) Response.Clear() Response.ClearContent() Response.ClearHeaders() Response.ContentType ="application/pdf" Response.BinaryWrite(bytStrippedData) Response.Flush() Response.End() myConnection.Close() Response.Write("Person info successfully retrieved!")End UsingEnd Sub

Monday, March 19, 2012

How to set the Timeout and Timeoutspecified property?

Hi all
We are getting a 'Operation Timedout' error when trying to render a report
as pdf. Will setting the Timeout and Timeoutspecified property will help
resolve this issue. Based on some criteria this report can take long time.
Also I cant find how to set the timeout and timeoutspecified property?
Please help
Thanks
RahulI think for a report you can set the timeout in the report
manager.
>--Original Message--
>Hi all
>We are getting a 'Operation Timedout' error when trying
to render a report
>as pdf. Will setting the Timeout and Timeoutspecified
property will help
>resolve this issue. Based on some criteria this report
can take long time.
>Also I cant find how to set the timeout and
timeoutspecified property?
>Please help
>Thanks
>Rahul
>
>.
>

Friday, March 9, 2012

How to set Report manager PDF export timeout?

In the report manager you have the option to export to PDF which pops up a
windows that has a timeout encoded into the URL that generates the PDF. The
URL generated looks like:
http://localhost/Reports/Reserved.ReportViewerWebControl.axd?Server=http%3a%2f%2flocalhost%2fReportServer&Timeout=100000&ReportSession=ayxrhe45b5gzjh55mcra5o45&ControlID=18a6c1bb-379f-4332-9b44-16aa3eb2468b&OpType=Export&Format=PDF
I'm pretty sure it's this hardcoded value in the URL because when I increase
it; it works. Is there any way to configure this? I searched the web but I
haven't seen this addressed anywhere.
Windows 2003 server -
SQL Server April 2005 CTPAny ideas on this...
Is there no way to increase this timeout? Can Microsoft maybe add a
configuration setting into the 2005 version so this can be set in the config
file? It seems like an easy request since someone hardcoded the default to
100000.
Thanks,
Jeff
"Jeff Glenn" wrote:
> In the report manager you have the option to export to PDF which pops up a
> windows that has a timeout encoded into the URL that generates the PDF. The
> URL generated looks like:
> http://localhost/Reports/Reserved.ReportViewerWebControl.axd?Server=http%3a%2f%2flocalhost%2fReportServer&Timeout=100000&ReportSession=ayxrhe45b5gzjh55mcra5o45&ControlID=18a6c1bb-379f-4332-9b44-16aa3eb2468b&OpType=Export&Format=PDF
> I'm pretty sure it's this hardcoded value in the URL because when I increase
> it; it works. Is there any way to configure this? I searched the web but I
> haven't seen this addressed anywhere.
> Windows 2003 server -
> SQL Server April 2005 CTP

How to set PDF margins when rendering via WS

I'm rendering reports in PDF format in aspx pages by calling the ssrs
webservice. Is there a way to adjust the side margins in the PDF?
Currently the margins are a default of 1 inch on each side and I want to
reduce it to 1/2 inch on each side.
Thanks.
--
moondaddy@.nospam.nospamHello,
I suggest that you refer to the following topics in Reporting Services
Books Online:
PDF Device Information Settings
Device Information Settings
Render Method
I hope the information is helpful.
Sophie Guo
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
=====================================================When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.