Viewing PDF from business layer

Viewing PDF from business layer

Forum member · Apr 23, 2007
Sorry if this is a bit of a newbie question. I would like to handle the report creation and viewing in my business layer, which I have mostly done, but can`t quite see how to view the document if the DrawToWeb no longer accepts a system.web.ui.page object? Can it only be done by calling from a webpage or would I have to force a download and re-open?

Re: Viewing PDF from business layer

Support · Apr 23, 2007
Hello, The DrawToWeb method no longer takes the Page object in its constructor, but it still opens the PDF in the browser. You can use the DrawToWeb method in your business logic also without any problem. Thanks, ceTe Software Support Team.

Re: Viewing PDF from business layer

Forum member · Apr 23, 2007
Hi, Have tried this but am getting a System.NullReferenceException. I have checked the document for all the usual ie title, page,template and all are present. At the moment i`m just trying to show a report title. Here is the stack trace: " at ceTe.DynamicPDF.Page.a(DocumentWriter A_0, Int32 A_1, Int32 A_2, Int32 A_3) at zz93.aa.d(Int32 A_0) at zz93.aa.v() at ceTe.DynamicPDF.Document.a(HttpRequest A_0, HttpResponse A_1, Boolean A_2, String A_3, Boolean A_4) at ceTe.DynamicPDF.Document.DrawToWeb(Boolean allowBrowserCaching, String downloadAsFileName, Boolean ForceDownload) at ceTe.DynamicPDF.Document.DrawToWeb() at LetoReportWriter.ReportProvider.ViewReport(String ReportName, Report MyReport) in C:\Src\ADL\DataTrak.19\LetoReportWriter\ReportProvider.vb:line 39 at Delta6BusinessLogicLayer.Delta6RecallProvider.PrintRecalls(ArrayList Recalls, String DocumentName) in C:\Src\ADL\Customer.19\Delta6_A\Delta6BusinessLogic\Notes\Delta6RecallProvider.vb:line 144" String Thanks

Re: Viewing PDF from business layer

Support · Apr 23, 2007
Hello, You can only use the DrawToWeb method in the web applications. You can not use this in console or winform applications. You can use the DrawToWeb method in your business logic if you are calling that from a web form. In order to open the PDF documents from applications other than the web applications, then you will have to save the PDF to disk and you can open the PDF using the System.Diagnostics.Process.Start method. You can also add an IE control to the Winform and you can display the PDF in the winform if you are working in winform application. You can refer to the Winform examples downloaded with the product download. Thanks, ceTe Software Support Team.

Re: Viewing PDF from business layer

Forum member · Apr 23, 2007
Hi, Should perhaps of made it clearer in my first post, it is a web application but my report business logic resides in a class library. Is there anyway I can implement something to enable the DrawToWeb to work from with my class library? Thanks

Re: Viewing PDF from business layer

Support · Apr 23, 2007
Hello, It is possible to display the PDF by calling the method which creates a PDF in the class library from the web form. Make sure that the System.Web.HttpContext.Current is not null as it is required by the DrawToWeb. We are able to do a similar example succesfully. Please send a mail to our [^a|mailto:support@cete.com|Support Team^] if you want a sample example which shows creating PDFs from class library. Thanks, ceTe Software Support Team.

Re: Viewing PDF from business layer

Forum member · Apr 24, 2007
Hi Sorry was my mistake, the pagedimensions was nothing! Thanks for the excellent support though!