What I want to accomplish is simple. Generate a PDF from scratch and send it to the user through the web browser. I just don't understand why these powerful tools don't seem to lead to that end.
After finally figuring out how to create a report, I just want the user to get it and go. First, I don't even know if my report is going to render anything. I can't, due to policy on the job site, be expected to use the Report.Publish method because all documentation I see for it shows the Publish method will ONLY save a file.
I want the user to click a button on a webpage and then receive a prompt to open or save the PDF document that gets sent. I don't want to cache or queue temp documents because multiple people will be using the same site and temp caches get messy to manage.
I thought the Document Exporter control would offer me a solution, but that control expects an Ultra WebGrid as an export parameter. I'm not using grids. I want to put some text at certain spots on the page and images or charts at other parts of the page. I don't even know if my current code is generating a proper report with a section of text because I can't get it to export. Here's the code I'm using to create a report:
Dim scoreCard As Report = New Report Dim sectionScoreCard As Section.ISection = scoreCard.AddSection Dim textBP1 As QuickText.IQuickText = sectionScoreCard.AddQuickText("I expect to see this text on a PDF page") textBP1.Alignment.Horizontal = Alignment.Left textBP1.Margins.Left = 40 textBP1.Margins.Right = 40 textBP1.Margins.Top = 40 textBP1.Margins.Bottom = 300Am I at least on the right track? Some people on this forum say they can get reports from this control, or say it's easy. Can anybody just post a sample section of code that worked for them?
I'm using ASP.NET not Windows Forms
Hi,
Try doing:
Context.Response.ContentType = "application/pdf" Report.Publish(Context.Response.OutputStream, Infragistics.Documents.Report.FileFormat.PDF)
Regards,
Andres
Thanks!
It seems to be working. At least there are no errors. However, my page just hangs.
I use a button which when clicked, runs the server code to generate the Report and publish it as PDF. This button is inside a WARP. I get the wait animation as expected when clicking the button, but it just keeps spinning without any response from the server. I'm wondering if the WARP and the associated async mode is causing problems with the Publish function.
Can you try placing the button outside the WARP panel?
Moving it out of the WARP works fine. But it doesn't work as I wish. I only want to show the Export button after I generate data. Leaving it visible before the data to be exported in a custom PDF is generated, is impractical. It just invites support question from the user who wonders why nothing happens when clicking Export without any data generated. Leaving the button in the WARP allows me to show/hide the button as needed. But that gets back to the original problem. I can't export the PDF seamlessly while the export button is in a WARP.
I'm generating data that's in grids inside a WARP. Unless there's something I'm missing, I can't get a .visible method to work on any control outside of a WARP. I even tried linking WARP panels together, with the export button in it's own WARP, but I can't get that to work. Is that even possible?
If you have not resolved this issue yet..
Capture the RefreshRequest client side event of the WARP and set fullpostback=true whenever export button is triggering the postback..
You may have to set some flag on export button onclick client side event to indicate that the postback is trigerred from the export button..