diff --git a/App_Start/BundleConfig.cs b/App_Start/BundleConfig.cs new file mode 100644 index 0000000..ca7f4c7 --- /dev/null +++ b/App_Start/BundleConfig.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Optimization; +using System.Web.UI; + +namespace AspxToPdfTutorial +{ + public class BundleConfig + { + // For more information on Bundling, visit https://go.microsoft.com/fwlink/?LinkID=303951 + public static void RegisterBundles(BundleCollection bundles) + { + bundles.Add(new ScriptBundle("~/bundles/WebFormsJs").Include( + "~/Scripts/WebForms/WebForms.js", + "~/Scripts/WebForms/WebUIValidation.js", + "~/Scripts/WebForms/MenuStandards.js", + "~/Scripts/WebForms/Focus.js", + "~/Scripts/WebForms/GridView.js", + "~/Scripts/WebForms/DetailsView.js", + "~/Scripts/WebForms/TreeView.js", + "~/Scripts/WebForms/WebParts.js")); + + // Order is very important for these files to work, they have explicit dependencies + bundles.Add(new ScriptBundle("~/bundles/MsAjaxJs").Include( + "~/Scripts/WebForms/MsAjax/MicrosoftAjax.js", + "~/Scripts/WebForms/MsAjax/MicrosoftAjaxApplicationServices.js", + "~/Scripts/WebForms/MsAjax/MicrosoftAjaxTimer.js", + "~/Scripts/WebForms/MsAjax/MicrosoftAjaxWebForms.js")); + + + + ScriptManager.ScriptResourceMapping.AddDefinition( + "respond", + new ScriptResourceDefinition + { + Path = "~/Scripts/respond.min.js", + DebugPath = "~/Scripts/respond.js", + }); + } + } +} \ No newline at end of file diff --git a/App_Start/RouteConfig.cs b/App_Start/RouteConfig.cs new file mode 100644 index 0000000..98b092d --- /dev/null +++ b/App_Start/RouteConfig.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.Routing; +using Microsoft.AspNet.FriendlyUrls; + +namespace AspxToPdfTutorial +{ + public static class RouteConfig + { + public static void RegisterRoutes(RouteCollection routes) + { + var settings = new FriendlyUrlSettings(); + settings.AutoRedirectMode = RedirectMode.Permanent; + routes.EnableFriendlyUrls(settings); + } + } +} diff --git a/ApplicationInsights.config b/ApplicationInsights.config new file mode 100644 index 0000000..57f0b40 --- /dev/null +++ b/ApplicationInsights.config @@ -0,0 +1,79 @@ + + + + + + + + + + + search|spider|crawl|Bot|Monitor|AlwaysOn + + + + + + + + + + + + + + + + + + + + + + System.Web.Handlers.TransferRequestHandler + Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler + System.Web.StaticFileHandler + System.Web.Handlers.AssemblyResourceLoader + System.Web.Optimization.BundleHandler + System.Web.Script.Services.ScriptHandlerFactory + System.Web.Handlers.TraceHandler + System.Web.Services.Discovery.DiscoveryRequestHandler + System.Web.HttpDebugHandler + + + + + + + + 5 + + + + \ No newline at end of file diff --git a/AspxToPdfTutorial.csproj b/AspxToPdfTutorial.csproj new file mode 100644 index 0000000..2ff6962 --- /dev/null +++ b/AspxToPdfTutorial.csproj @@ -0,0 +1,216 @@ + + + + + + + Debug + AnyCPU + + + 2.0 + {DB2F36D9-95CA-46EC-B001-9FEC69B78271} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + AspxToPdfTutorial + AspxToPdfTutorial + v4.5 + true + + + + + + + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + true + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\packages\IronPdf.4.4.6.2\lib\net40\IronPdf.dll + + + ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.7\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll + + + + + + + + + + + + + + + + + + + + True + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + + + ..\packages\AspNet.ScriptManager.bootstrap.3.0.0\lib\net45\AspNet.ScriptManager.bootstrap.dll + + + ..\packages\AspNet.ScriptManager.jQuery.1.10.2\lib\net45\AspNet.ScriptManager.jQuery.dll + + + ..\packages\Microsoft.AspNet.ScriptManager.MSAjax.5.0.0\lib\net45\Microsoft.ScriptManager.MSAjax.dll + + + ..\packages\Microsoft.AspNet.ScriptManager.WebForms.5.0.0\lib\net45\Microsoft.ScriptManager.WebForms.dll + + + ..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll + + + True + ..\packages\WebGrease.1.5.2\lib\WebGrease.dll + + + True + ..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll + + + True + ..\packages\Microsoft.AspNet.Web.Optimization.WebForms.1.1.3\lib\net45\Microsoft.AspNet.Web.Optimization.WebForms.dll + + + ..\packages\Microsoft.AspNet.FriendlyUrls.Core.1.0.2\lib\net45\Microsoft.AspNet.FriendlyUrls.dll + + + + + ..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll + + + ..\packages\Microsoft.ApplicationInsights.2.2.0\lib\net45\Microsoft.ApplicationInsights.dll + + + ..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.0.6\lib\net45\Microsoft.AI.Agent.Intercept.dll + + + ..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.2.0\lib\net45\Microsoft.AI.DependencyCollector.dll + + + ..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.2.0\lib\net45\Microsoft.AI.PerfCounterCollector.dll + + + ..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.2.0\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll + + + ..\packages\Microsoft.ApplicationInsights.WindowsServer.2.2.0\lib\net45\Microsoft.AI.WindowsServer.dll + + + ..\packages\Microsoft.ApplicationInsights.Web.2.2.0\lib\net45\Microsoft.AI.Web.dll + + + + + + + PreserveNewest + + + + + + + + + + + Global.asax + + + + ViewSwitcher.ascx + ASPXCodeBehind + + + ViewSwitcher.ascx + + + Invoice.aspx + ASPXCodeBehind + + + Invoice.aspx + + + + + + + + + Web.config + + + Web.config + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 62190 + / + http://localhost:62190/ + False + False + + + False + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AspxToPdfTutorial.csproj.user b/AspxToPdfTutorial.csproj.user new file mode 100644 index 0000000..4ec7211 --- /dev/null +++ b/AspxToPdfTutorial.csproj.user @@ -0,0 +1,36 @@ + + + + true + + + + + + + + + + + + Invoice.aspx + SpecificPage + True + False + False + False + + + + + + + + + True + True + + + + + \ No newline at end of file diff --git a/Bundle.config b/Bundle.config new file mode 100644 index 0000000..ebacdf4 --- /dev/null +++ b/Bundle.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Global.asax b/Global.asax new file mode 100644 index 0000000..e26110e --- /dev/null +++ b/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="AspxToPdfTutorial.Global" Language="C#" %> diff --git a/Global.asax.cs b/Global.asax.cs new file mode 100644 index 0000000..084b1a0 --- /dev/null +++ b/Global.asax.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Optimization; +using System.Web.Routing; +using System.Web.Security; +using System.Web.SessionState; + +namespace AspxToPdfTutorial +{ + public class Global : HttpApplication + { + void Application_Start(object sender, EventArgs e) + { + // Code that runs on application startup + RouteConfig.RegisterRoutes(RouteTable.Routes); + BundleConfig.RegisterBundles(BundleTable.Bundles); + } + } +} \ No newline at end of file diff --git a/Invoice.aspx b/Invoice.aspx new file mode 100644 index 0000000..d84c976 --- /dev/null +++ b/Invoice.aspx @@ -0,0 +1,382 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Invoice.aspx.cs" Inherits="AspxToPdfTutorial.Invoice" %> + + + + + My Invoice + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Some companyInvoice #: 101
+ Created: January 1, 2017
+ Due: February 1, 2017
+
+ + + + + +
Just another company, Inc.
+ 01 Another st.
+ Another City, AK 00001
Awesome company, Inc.
+ Steve Stevenson
+ awesomeSteve@awesomecompany.com
+
Item namePrice
Architecture design100.00
Prototyping100.00
Back End development100.00
Front End development100.00
Testing100.00
Bug fixing100.00
Support100.00
Just couple of more items to hit Paging for A4 size page. (lost my courage on this one, sorry)100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Just couple of more items to hit Paging for A4 size page.100.00
Total: 100500.00
+
+ + \ No newline at end of file diff --git a/Invoice.aspx.cs b/Invoice.aspx.cs new file mode 100644 index 0000000..48ad990 --- /dev/null +++ b/Invoice.aspx.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace AspxToPdfTutorial +{ + public partial class Invoice : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + var AspxToPdfOptions = new IronPdf.PdfPrintOptions() + { + Header = new IronPdf.SimpleHeaderFooter() + { + CenterText = "Invoice", + DrawDividerLine = false, + FontFamily = "Arial", + FontSize = 12 + }, + Footer = new IronPdf.SimpleHeaderFooter() + { + LeftText = "{date} - {time}", + DrawDividerLine = true, + RightText = "Page {page} of {total-pages}", + FontFamily = "Arial", + FontSize = 11 + }, + PaperSize = IronPdf.PdfPrintOptions.PdfPaperSize.A4, + PaperOrientation = IronPdf.PdfPrintOptions.PdfPaperOrientation.Portrait + + }; + + IronPdf.AspxToPdf.RenderThisPageAsPdf(IronPdf.AspxToPdf.FileBehavior.InBrowser, "Invoice.pdf", AspxToPdfOptions); + } + } +} \ No newline at end of file diff --git a/Invoice.aspx.designer.cs b/Invoice.aspx.designer.cs new file mode 100644 index 0000000..959c299 --- /dev/null +++ b/Invoice.aspx.designer.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AspxToPdfTutorial { + + + public partial class Invoice { + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d240619 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("AspxToPdfTutorial")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AspxToPdfTutorial")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("db2f36d9-95ca-46ec-b001-9fec69b78271")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ViewSwitcher.ascx b/ViewSwitcher.ascx new file mode 100644 index 0000000..8c0880b --- /dev/null +++ b/ViewSwitcher.ascx @@ -0,0 +1,4 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ViewSwitcher.ascx.cs" Inherits="AspxToPdfTutorial.ViewSwitcher" %> +
+ <%: CurrentView %> view | Switch to <%: AlternateView %> +
\ No newline at end of file diff --git a/ViewSwitcher.ascx.cs b/ViewSwitcher.ascx.cs new file mode 100644 index 0000000..2f82bbc --- /dev/null +++ b/ViewSwitcher.ascx.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Routing; +using System.Web.UI; +using System.Web.UI.WebControls; +using Microsoft.AspNet.FriendlyUrls.Resolvers; + +namespace AspxToPdfTutorial +{ + public partial class ViewSwitcher : System.Web.UI.UserControl + { + protected string CurrentView { get; private set; } + + protected string AlternateView { get; private set; } + + protected string SwitchUrl { get; private set; } + + protected void Page_Load(object sender, EventArgs e) + { + // Determine current view + var isMobile = WebFormsFriendlyUrlResolver.IsMobileView(new HttpContextWrapper(Context)); + CurrentView = isMobile ? "Mobile" : "Desktop"; + + // Determine alternate view + AlternateView = isMobile ? "Desktop" : "Mobile"; + + // Create switch URL from the route, e.g. ~/__FriendlyUrls_SwitchView/Mobile?ReturnUrl=/Page + var switchViewRouteName = "AspNet.FriendlyUrls.SwitchView"; + var switchViewRoute = RouteTable.Routes[switchViewRouteName]; + if (switchViewRoute == null) + { + // Friendly URLs is not enabled or the name of the switch view route is out of sync + this.Visible = false; + return; + } + var url = GetRouteUrl(switchViewRouteName, new { view = AlternateView, __FriendlyUrls_SwitchViews = true }); + url += "?ReturnUrl=" + HttpUtility.UrlEncode(Request.RawUrl); + SwitchUrl = url; + } + } +} \ No newline at end of file diff --git a/ViewSwitcher.ascx.designer.cs b/ViewSwitcher.ascx.designer.cs new file mode 100644 index 0000000..334c62e --- /dev/null +++ b/ViewSwitcher.ascx.designer.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AspxToPdfTutorial { + + + public partial class ViewSwitcher { + } +} diff --git a/Web.Debug.config b/Web.Debug.config new file mode 100644 index 0000000..c1a5642 --- /dev/null +++ b/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Web.Release.config b/Web.Release.config new file mode 100644 index 0000000..19058ed --- /dev/null +++ b/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Web.config b/Web.config new file mode 100644 index 0000000..266a3bf --- /dev/null +++ b/Web.config @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..a3a7999 Binary files /dev/null and b/favicon.ico differ diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..cf71b72 --- /dev/null +++ b/packages.config @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file