diff --git a/.gitignore b/.gitignore
index d26d7cd..ee63756 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,13 @@
# mstest test results
TestResults
+# Ignore Visual Studio and Visual Studo Code settings
+.vs/
+.vscode/
+
+# ignore the *.lock files
+*.lock.json
+
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config
deleted file mode 100644
index 67f8ea0..0000000
--- a/.nuget/NuGet.Config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe
deleted file mode 100644
index ddc9105..0000000
Binary files a/.nuget/NuGet.exe and /dev/null differ
diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets
deleted file mode 100644
index 4ada616..0000000
--- a/.nuget/NuGet.targets
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
- $(MSBuildProjectDirectory)\..\
-
-
- false
-
-
- false
-
-
- true
-
-
- false
-
-
-
-
-
-
-
-
-
- $([System.IO.Path]::Combine($(SolutionDir), ".nuget"))
- $([System.IO.Path]::Combine($(ProjectDir), "packages.config"))
-
-
-
-
- $(SolutionDir).nuget
- packages.config
-
-
-
-
- $(NuGetToolsPath)\nuget.exe
- @(PackageSource)
-
- "$(NuGetExePath)"
- mono --runtime=v4.0.30319 $(NuGetExePath)
-
- $(TargetDir.Trim('\\'))
-
- -RequireConsent
-
- $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -solutionDir "$(SolutionDir) "
- $(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols
-
-
-
- RestorePackages;
- $(ResolveReferencesDependsOn);
-
-
-
-
- $(BuildDependsOn);
- BuildPackage;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ControllerExtension.cs b/ControllerExtension.cs
new file mode 100644
index 0000000..bc13824
--- /dev/null
+++ b/ControllerExtension.cs
@@ -0,0 +1,47 @@
+namespace RazorPDFCore
+{
+ public class Controller : Microsoft.AspNetCore.Mvc.Controller
+ {
+ public PdfResult ViewPdf(object model, string fileName)
+ {
+ ViewData.Model = model;
+
+ return new PdfResult()
+ {
+ FileName = fileName,
+ TempData = TempData,
+ ViewData = ViewData
+ };
+ }
+
+ public PdfResult ViewPdf(object model, string fileName, bool download = false, iTextSharp.text.Rectangle pageSize = null)
+ {
+ ViewData.Model = model;
+
+ return new PdfResult()
+ {
+ FileName = fileName,
+ TempData = TempData,
+ ViewData = ViewData,
+ Download = download
+ };
+ }
+
+ public PdfResult ViewPdf(object model, string fileName, string viewName, bool download = false, iTextSharp.text.Rectangle pageSize = null)
+ {
+ ViewData.Model = model;
+
+ if (pageSize == null) pageSize = iTextSharp.text.PageSize.A4;
+
+ return new PdfResult()
+ {
+ ViewName = viewName,
+ FileName = fileName,
+ TempData = TempData,
+ ViewData = ViewData,
+ Download = download,
+ PageSize = pageSize
+ };
+ }
+ }
+}
diff --git a/PdfResult.cs b/PdfResult.cs
new file mode 100644
index 0000000..cc14747
--- /dev/null
+++ b/PdfResult.cs
@@ -0,0 +1,90 @@
+// Copyright 2016 Al Nyveldt - http://nyveldt.com, Ole Koeckemann
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+using iTextSharp.text;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.ModelBinding;
+using Microsoft.AspNetCore.Mvc.Rendering;
+using Microsoft.AspNetCore.Mvc.ViewEngines;
+using Microsoft.AspNetCore.Mvc.ViewFeatures;
+using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.IO;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace RazorPDFCore
+{
+ public class PdfResult : ActionResult
+ {
+ ///
+ /// Gets or sets the Content-Type header for the response.
+ ///
+ public string ContentType { get; set; }
+ public string ContentDisposition { get; private set; }
+ ///
+ /// Gets the view data model.
+ ///
+ public object Model => ViewData?.Model;
+
+ public int StatusCode { get { return 200; } }
+
+ public ViewDataDictionary ViewData{ get; set; }
+
+ public ITempDataDictionary TempData { get; set; }
+
+ public string ViewName { get; set; }
+
+ public string FileName { get; set; }
+ public bool Download { get; set; }
+
+ public Rectangle PageSize { get; set; } = iTextSharp.text.PageSize.A4;
+
+ public IViewEngine ViewEngine { get; set; }
+
+
+ //Constructors
+ public PdfResult()
+ {
+ ContentType = "application/pdf";
+ }
+
+ public async override Task ExecuteResultAsync(ActionContext context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ if(Download)
+ ContentDisposition = $"attachment; filename=\"{FileName}\"";
+ else
+ ContentDisposition = $"inline; filename=\"{FileName}\"";
+
+ var services = context.HttpContext.RequestServices;
+ var executor = services.GetRequiredService();
+
+ var result = executor.FindView(context, this);
+ result.EnsureSuccessful(originalLocations: null);
+
+ var view = result.View;
+ using (view as IDisposable)
+ {
+ await executor.ExecuteAsync(context, view, this);
+ }
+ }
+ }
+}
diff --git a/PdfResultExecutor.cs b/PdfResultExecutor.cs
new file mode 100644
index 0000000..a685132
--- /dev/null
+++ b/PdfResultExecutor.cs
@@ -0,0 +1,254 @@
+// Copyright 2016 Al Nyveldt - http://nyveldt.com, Ole Koeckemann
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+using iTextSharp.text;
+using iTextSharp.tool.xml;
+using iTextSharp.text.html.simpleparser;
+using iTextSharp.text.pdf;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.ModelBinding;
+using Microsoft.AspNetCore.Mvc.Rendering;
+using Microsoft.AspNetCore.Mvc.ViewEngines;
+using Microsoft.AspNetCore.Mvc.ViewFeatures;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RazorPDFCore
+{
+ public class PdfResultExecutor : ViewExecutor
+ {
+ private const string ActionNameKey = "action";
+
+ ///
+ /// Creates a new .
+ ///
+ /// The .
+ /// The .
+ /// The .
+ /// The .
+ /// The .
+ /// The .
+ /// The .
+ public PdfResultExecutor(
+ IOptions viewOptions,
+ IHttpResponseStreamWriterFactory writerFactory,
+ ICompositeViewEngine viewEngine,
+ ITempDataDictionaryFactory tempDataFactory,
+ DiagnosticSource diagnosticSource,
+ ILoggerFactory loggerFactory,
+ IModelMetadataProvider modelMetadataProvider)
+ : base(viewOptions, writerFactory, viewEngine, tempDataFactory, diagnosticSource, modelMetadataProvider)
+ {
+ if (loggerFactory == null)
+ {
+ throw new ArgumentNullException(nameof(loggerFactory));
+ }
+
+ Logger = loggerFactory.CreateLogger();
+ }
+
+ ///
+ /// Gets the .
+ ///
+ protected ILogger Logger { get; }
+
+ ///
+ /// Attempts to find the associated with .
+ ///
+ /// The associated with the current request.
+ /// The .
+ /// A .
+ public virtual ViewEngineResult FindView(ActionContext actionContext, PdfResult viewResult)
+ {
+ if (actionContext == null)
+ {
+ throw new ArgumentNullException(nameof(actionContext));
+ }
+
+ if (viewResult == null)
+ {
+ throw new ArgumentNullException(nameof(viewResult));
+ }
+
+ var viewEngine = viewResult.ViewEngine ?? ViewEngine;
+ var viewName = viewResult.ViewName ?? GetActionName(actionContext);
+
+ var result = viewEngine.GetView(executingFilePath: null, viewPath: viewName, isMainPage: false);
+ var originalResult = result;
+ if (!result.Success)
+ {
+ result = viewEngine.FindView(actionContext, viewName, isMainPage: false);
+ }
+
+ if (!result.Success)
+ {
+ if (originalResult.SearchedLocations.Any())
+ {
+ if (result.SearchedLocations.Any())
+ {
+ // Return a new ViewEngineResult listing all searched locations.
+ var locations = new List(originalResult.SearchedLocations);
+ locations.AddRange(result.SearchedLocations);
+ result = ViewEngineResult.NotFound(viewName, locations);
+ }
+ else
+ {
+ // GetView() searched locations but FindView() did not. Use first ViewEngineResult.
+ result = originalResult;
+ }
+ }
+ }
+
+ if (result.Success)
+ {
+ if (DiagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewFound"))
+ {
+ DiagnosticSource.Write(
+ "Microsoft.AspNetCore.Mvc.ViewFound",
+ new
+ {
+ actionContext = actionContext,
+ isMainPage = false,
+ result = viewResult,
+ viewName = viewName,
+ view = result.View,
+ });
+ }
+ }
+ else
+ {
+ if (DiagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.ViewNotFound"))
+ {
+ DiagnosticSource.Write(
+ "Microsoft.AspNetCore.Mvc.ViewNotFound",
+ new
+ {
+ actionContext = actionContext,
+ isMainPage = false,
+ result = viewResult,
+ viewName = viewName,
+ searchedLocations = result.SearchedLocations
+ });
+ }
+ }
+
+ return result;
+ }
+
+ ///
+ /// Executes the asynchronously.
+ ///
+ /// The associated with the current request.
+ /// The .
+ /// The .
+ /// A which will complete when view execution is completed.
+ public async Task ExecuteAsync(ActionContext actionContext, IView view, PdfResult viewResult)
+ {
+ if (actionContext == null)
+ {
+ throw new ArgumentNullException(nameof(actionContext));
+ }
+
+ if (view == null)
+ {
+ throw new ArgumentNullException(nameof(view));
+ }
+
+ if (viewResult == null)
+ {
+ throw new ArgumentNullException(nameof(viewResult));
+ }
+
+ var response = actionContext.HttpContext.Response;
+
+ response.Headers.Add("Content-Disposition", viewResult.ContentDisposition);
+
+
+ string resolvedContentType = null;
+ Encoding resolvedContentTypeEncoding = null;
+ ResponseContentTypeHelper.ResolveContentTypeAndEncoding( viewResult.ContentType, viewResult.ContentType, DefaultContentType, out resolvedContentType, out resolvedContentTypeEncoding);
+
+ response.ContentType = resolvedContentType;
+ response.StatusCode = viewResult.StatusCode;
+
+ var razorStream = new MemoryStream();
+
+ using (var writer = new StreamWriter(razorStream))
+ {
+ var viewContext = new ViewContext(
+ actionContext,
+ view,
+ viewResult.ViewData,
+ viewResult.TempData,
+ writer,
+ ViewOptions.HtmlHelperOptions);
+
+ await view.RenderAsync(viewContext);
+ await writer.FlushAsync();
+
+ Document document = new Document(viewResult.PageSize);
+ // step 2
+ var pdfWriter = PdfWriter.GetInstance(document, response.Body);
+
+ razorStream.Position = 0;
+ using (var tr = new StreamReader(razorStream))
+ {
+ // step 3
+ document.Open();
+ XMLWorkerHelper.GetInstance().ParseXHtml(pdfWriter, document, tr);
+ document.Close();
+ }
+ }
+ }
+
+ private static string GetActionName(ActionContext context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ object routeValue;
+ if (!context.RouteData.Values.TryGetValue(ActionNameKey, out routeValue))
+ {
+ return null;
+ }
+
+ var actionDescriptor = context.ActionDescriptor;
+ string normalizedValue = null;
+ string value;
+ if (actionDescriptor.RouteValues.TryGetValue(ActionNameKey, out value) &&
+ !string.IsNullOrEmpty(value))
+ {
+ normalizedValue = value;
+ }
+
+ var stringRouteValue = routeValue?.ToString();
+ if (string.Equals(normalizedValue, stringRouteValue, StringComparison.OrdinalIgnoreCase))
+ {
+ return normalizedValue;
+ }
+
+ return stringRouteValue;
+ }
+ }
+}
diff --git a/RazorPDF/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
similarity index 52%
rename from RazorPDF/Properties/AssemblyInfo.cs
rename to Properties/AssemblyInfo.cs
index a686879..d90edc1 100644
--- a/RazorPDF/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -2,35 +2,22 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// 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("RazorPDF")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyTitle("RazorPDFCore")]
+[assembly: AssemblyDescription("RazorPDFCore is used to convert PDF documents usign itextshap and razor views")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Al Nyveldt")]
-[assembly: AssemblyProduct("RazorPDF")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyProduct("RazorPDFCore")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
[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
+// 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("9ddef8aa-0f5a-4cfa-a750-3f341eda2042")]
-
-// 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 Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: Guid("523cd2d5-daa0-479b-9d5c-b133daf48978")]
diff --git a/RazorPDF.sln b/RazorPDF.sln
deleted file mode 100644
index 50b8328..0000000
--- a/RazorPDF.sln
+++ /dev/null
@@ -1,27 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RazorPDF", "RazorPDF\RazorPDF.csproj", "{0EEB1093-C4B8-4830-BC01-2C56E618702E}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{8DFF398B-B865-4A7A-B7AC-B52D3AF19524}"
- ProjectSection(SolutionItems) = preProject
- .nuget\NuGet.Config = .nuget\NuGet.Config
- .nuget\NuGet.exe = .nuget\NuGet.exe
- .nuget\NuGet.targets = .nuget\NuGet.targets
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {0EEB1093-C4B8-4830-BC01-2C56E618702E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0EEB1093-C4B8-4830-BC01-2C56E618702E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0EEB1093-C4B8-4830-BC01-2C56E618702E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0EEB1093-C4B8-4830-BC01-2C56E618702E}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/RazorPDF/PdfResult.cs b/RazorPDF/PdfResult.cs
deleted file mode 100644
index 8ca136e..0000000
--- a/RazorPDF/PdfResult.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2012 Al Nyveldt - http://nyveldt.com
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Web.Mvc;
-
-namespace RazorPDF
-{
- public class PdfResult : ViewResult
- {
- //Constructors
- public PdfResult(object model, string name)
- {
- ViewData = new ViewDataDictionary(model);
- ViewName = name;
- }
- public PdfResult() : this(new ViewDataDictionary(), "Pdf")
- {
- }
- public PdfResult(object model) : this(model, "Pdf")
- {
- }
-
- //Override FindView to load PdfView
- protected override ViewEngineResult FindView(ControllerContext context)
- {
- var result = base.FindView(context);
- if (result.View == null)
- return result;
-
- var pdfView = new PdfView(result);
- return new ViewEngineResult(pdfView, pdfView);
- }
- }
-}
diff --git a/RazorPDF/PdfView.cs b/RazorPDF/PdfView.cs
deleted file mode 100644
index e875f75..0000000
--- a/RazorPDF/PdfView.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2012 Al Nyveldt - http://nyveldt.com
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Web.Mvc;
-using System.Xml;
-using System.Xml.Linq;
-using iTextSharp.text;
-using iTextSharp.text.html;
-using iTextSharp.text.pdf;
-using iTextSharp.text.xml;
-
-namespace RazorPDF
-{
- public class PdfView : IView, IViewEngine
- {
- private readonly ViewEngineResult _result;
-
- public PdfView(ViewEngineResult result)
- {
- _result = result;
- }
-
- public void Render(ViewContext viewContext, TextWriter writer)
- {
- // generate view into string
- var sb = new System.Text.StringBuilder();
- TextWriter tw = new System.IO.StringWriter(sb);
- _result.View.Render(viewContext, tw);
- var resultCache = sb.ToString();
-
- // detect itext (or html) format of response
- XmlParser parser;
- using (var reader = GetXmlReader(resultCache))
- {
- while (reader.Read() && reader.NodeType != XmlNodeType.Element)
- {
- // no-op
- }
-
- if (reader.NodeType == XmlNodeType.Element && reader.Name == "itext")
- parser = new XmlParser();
- else
- parser = new HtmlParser();
- }
-
- // Create a document processing context
- var document = new Document();
- document.Open();
-
- // associate output with response stream
- var pdfWriter = PdfWriter.GetInstance(document, viewContext.HttpContext.Response.OutputStream);
- pdfWriter.CloseStream = false;
-
- // this is as close as we can get to being "success" before writing output
- // so set the content type now
- viewContext.HttpContext.Response.ContentType = "application/pdf";
-
- // parse memory through document into output
- using (var reader = GetXmlReader(resultCache))
- {
- parser.Go(document, reader);
- }
-
- pdfWriter.Close();
- }
-
- private static XmlTextReader GetXmlReader(string source)
- {
- byte[] byteArray = Encoding.UTF8.GetBytes(source);
- MemoryStream stream = new MemoryStream(byteArray);
-
- var xtr = new XmlTextReader(stream);
- xtr.WhitespaceHandling = WhitespaceHandling.None; // Helps iTextSharp parse
- return xtr;
- }
-
- public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache)
- {
- throw new System.NotImplementedException();
- }
-
- public ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache)
- {
- throw new System.NotImplementedException();
- }
-
- public void ReleaseView(ControllerContext controllerContext, IView view)
- {
- _result.ViewEngine.ReleaseView(controllerContext, _result.View);
- }
- }
-}
diff --git a/RazorPDF/RazorPDF.csproj b/RazorPDF/RazorPDF.csproj
deleted file mode 100644
index fdd67b1..0000000
--- a/RazorPDF/RazorPDF.csproj
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {0EEB1093-C4B8-4830-BC01-2C56E618702E}
- Library
- Properties
- RazorPDF
- RazorPDF
- v4.0
- 512
- ..\
- true
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- false
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- false
-
-
-
- ..\packages\iTextSharp.4.1.2\lib\itextsharp.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/RazorPDF/packages.config b/RazorPDF/packages.config
deleted file mode 100644
index a82249e..0000000
--- a/RazorPDF/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/RazorPDFCore.csproj b/RazorPDFCore.csproj
new file mode 100644
index 0000000..c73845b
--- /dev/null
+++ b/RazorPDFCore.csproj
@@ -0,0 +1,29 @@
+
+
+
+ RazorPDF used to conver PDF documents usign itextshap and razor views
+ 1.0.7
+ Al Nyveldt;Ole Koeckemann
+ net461
+ RazorPDFCore
+ RazorPDFCore
+ false
+ false
+ false
+ false
+ false
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Readme.md b/Readme.md
index 6bcd483..9177e86 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,13 +1,69 @@
-RazorPDF
+RazorPDF Core
==============
RazorPDF is a simple project that makes it a breeze to create PDFs using the Razor view engine. Since Razor is really a template syntax, it can do lot more than just generate HTML. RazorPDF uses it to generate iText XML. Then using the iTextSharp library, we turn that iText XML into a PDF to return. The end result is a easy to use, clean method for generating PDFs.
-##Usage
-The easiest way to get started with RazorPDF is to add the Nuget package to your MVC project. There is a short screencast on [my blog](http://nyveldt.com/blog/page/razorpdf) to get you started so well as a sample project and some syntax samples.
+## Installation
-##Acknowledgements
-RazorPDF likely wouldn't exist without the [Spark view engine](http://sparkviewengine.com/). The ability to create PDFs with the Spark view engine is something I've missed often since switching to using Razor as my default view engine in MVC projects. Huge thanks to [Louis DeJardin](http://whereslou.com/) for putting together the Spark view engine many years ago and for the idea of mixing Spark with iTextSharp as a nice way to make PDFs.
+**PLEASE NOTE:** This installation only applies to the original package
-Also, RazorPDF is worthless without [iTextSharp](http://sourceforge.net/projects/itextsharp/). Thanks so much to the team that works on that incredible project.
+For Visual Studio 2015 use the Package Manager Console to install `RazorPDFCore` (https://www.nuget.org/packages/RazorPDFCore/)
+
+`PM> Install-Package RazorPDFCore`
+
+or download it from here and add it as additional project
+
+## Usage
+
+Add the `PdfResultExecutor` service into your `Startup.cs`
+
+```
+public void ConfigureServices(IServiceCollection services) {
+ // [...]
+ services.AddSingleton();
+}
+```
+
+Return the below command in your controller action
+
+`ViewPdf(object model, string fileName, string viewName, bool download)`
+
+Example:
+
+```
+class YourBaseController : RazorPDF.Controller {
+ // [...]
+ public IActionResult Pdf() {
+ var model = /* any model you wish */
+ return ViewPdf(model);
+ }
+}
+```
+
+PLEASE NOTE:
+This method becomes ONLY available, when you use the inherited Controller class `RazorPDF.Controller`
+
+## Changelog
+
+**1.0.7**
+- extend PdfResult to defined PageSize properties
+
+**1.0.6**
+- updated AspNetCore v2.0
+
+**1.0.5**
+- updated AspNetCore v1.1.3
+
+**1.0.3**
+- make use of the XMLWorker instead to give more html/css flexibility
+
+**1.0.2**
+- replaced *.csproj with *.xproj
+
+
+**1.0.1**
+- updated source code to work with ASP.NET Core (tested on v1.0.1)
+
+**1.0.0**
+- forked from RazorAnt/RazorPDF