PDA

View Full Version : How to embed Pdf in ext tab in EXT JS



Gopala
May 18, 2016, 12:46 PM
Hi, I am using below code to embed pdf in ext tab.It is working fine in IE browser.In google chrome the tab is unable to show the pdf file.

Please help me for this.

@(Html.X().Panel().ID("ReviewTurnIn").Width(900).Border(false)
.Layout(LayoutType.Table)
.LayoutConfig(new TableLayoutConfig() { Columns = 1 }).PaddingSpec("30px 0px 0px 50px")
.Items(mainPanleItems =>
{
mainPanleItems.Add(Html.X().Label().Text("Review Turn-in").Cls("header-text"));
})

.Items(mainPanleItems =>
{
mainPanleItems.Add(Html.X().Label().CellCls("info-text").Html("This is what we’ve so far."));
})

.Items(mainPanleItems =>
{
mainPanleItems.Add(Html.X().Container().ID("PdfEmbed").Width(850)
.Html(string.Format("<embed src='{0}' type='application/pdf' style='margin: 0 auto; width:100%; height:1000px;'></embed>",
Url.Action("ReviewTurnInPDF", new { ServiceId = ServiceId, hashcode = Request.QueryString("hashcode") }))));
})
.BottomBar(Html.X().Toolbar().BaseCls("m1-toolbar-bottom")

.Items(Html.X().Button().GrayButton(Url.Content("~/SupplierTurnIn/SupplierTurnIn/SwitchView"), CurrentWizardId),
Html.X().ToolbarFill(),
Html.X().Button().OrangeButton(Url.Content("~/SupplierTurnIn/Order/ReviewTurnIn"), CurrentWizardId, "SuccessTurnIn").Width(200).Text("Submit Turn-In")
)
)
)

fabricio.murta
May 18, 2016, 7:21 PM
Hello @Gopala! Welcome to Ext.NET forums!

May you tell us which version of Ext.NET you are using so we can move your question to the correct forum?

About .pdf embedding if you want to have a definitive portable solution, you will need a PDF JavaScript library to render the PDF on the page, else the browser uses third-party integrations (like Adobe reader) to show the PDF inside -- that would be a client-dependent thing. In the case the client browser has no default PDF handler, the file is either shown as a broken/missing applet or a download is attempted.

As you are new in the forums you may not be aware of the tools to write posts so, whenever you paste code in messages, please wrap the code between [code ] [/code ] tags so they show nice for everyone to see (and copy-paste). This greatly helps understand your code on a first sight.

And there are already some discussions on the forums about PDF embedding. If you want to know details about solutions, please give the forums a search for the "PDF" keyword, and you'll going to get good results about it.

This thread may be particularly useful for you:
IFrame's Loader "Load" listener is not fired when non-html content is loaded (http://forums.ext.net/showthread.php?53451)