Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative URL / CSS fixes #37

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion Rotativa.Demo/Rotativa.Demo.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -17,6 +18,15 @@
<UseIISExpress>true</UseIISExpress>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -70,6 +80,13 @@
<Compile Include="Models\AccountModels.cs" />
<Compile Include="Models\TestViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestWebForms.aspx.cs">
<DependentUpon>TestWebForms.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="TestWebForms.aspx.designer.cs">
<DependentUpon>TestWebForms.aspx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="Content\themes\base\images\ui-bg_flat_0_aaaaaa_40x100.png" />
Expand Down Expand Up @@ -116,6 +133,7 @@
<Content Include="Scripts\jquery.validate.min.js" />
<Content Include="Scripts\modernizr-1.7.js" />
<Content Include="Scripts\modernizr-1.7.min.js" />
<Content Include="TestWebForms.aspx" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
Expand Down Expand Up @@ -172,8 +190,13 @@
<ItemGroup>
<Content Include="Views\Home\TestPartialViewWithModel.cshtml" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
16 changes: 16 additions & 0 deletions Rotativa.Demo/TestWebForms.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestWebForms.aspx.cs" Inherits="Rotativa.Demo.TestWebForms" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Testing WebForm Inheriting From PageAsPdf
</div>
</form>
</body>
</html>
25 changes: 25 additions & 0 deletions Rotativa.Demo/TestWebForms.aspx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Rotativa.Demo
{
public partial class TestWebForms : PageAsPdf
{
protected void Page_Load(object sender, EventArgs e)
{
this.PDF.PageMargins = new Options.Margins
{
Bottom = 0,
Right = 0,
Left = 0,
Top = 0
};
}
}
}
24 changes: 24 additions & 0 deletions Rotativa.Demo/TestWebForms.aspx.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Rotativa.Demo/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<li>@Html.ActionLink("Test PartialViewAsPdf with a model", "TestPartialViewWithModel")</li>
<li>@Html.ActionLink("Error Test", "ErrorTest", "Home")</li>
<li>@Html.ActionLink("Binary Test", "BinaryTest", "Home")</li>
<li><a href="/TestWebForms.aspx">Test Web Forms</a></li>
</ul>

</p>
Expand Down
195 changes: 195 additions & 0 deletions Rotativa.MVC4/Rotativa.MVC4.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{733E5EA3-068F-439D-B0F9-35D06C668657}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Rotativa</RootNamespace>
<AssemblyName>Rotativa.MVC4</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Mvc.FixedDisplayModes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.Mvc.FixedDisplayModes.1.0.0\lib\net40\Microsoft.Web.Mvc.FixedDisplayModes.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Net.Http">
</Reference>
<Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.4.0.20710.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Net.Http.WebRequest">
</Reference>
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40\System.Web.Http.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.20710.0\lib\net40\System.Web.Http.WebHost.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.20710.0\lib\net40\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.Razor.2.0.20715.0\lib\net40\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\Rotativa\ActionAsPdf.cs">
<Link>ActionAsPdf.cs</Link>
</Compile>
<Compile Include="..\Rotativa\AsPdfResultBase.cs">
<Link>AsPdfResultBase.cs</Link>
</Compile>
<Compile Include="..\Rotativa\HtmlAsPdf.cs">
<Link>HtmlAsPdf.cs</Link>
</Compile>
<Compile Include="..\Rotativa\Options\Enums.cs">
<Link>Options\Enums.cs</Link>
</Compile>
<Compile Include="..\Rotativa\Options\Margins.cs">
<Link>Options\Margins.cs</Link>
</Compile>
<Compile Include="..\Rotativa\Options\OptionFlag.cs">
<Link>Options\OptionFlag.cs</Link>
</Compile>
<Compile Include="..\Rotativa\PageAsPdf.cs">
<Link>PageAsPdf.cs</Link>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="..\Rotativa\PartialViewAsPdf.cs">
<Link>PartialViewAsPdf.cs</Link>
</Compile>
<Compile Include="..\Rotativa\Properties\AssemblyInfo.cs">
<Link>Properties\AssemblyInfo.cs</Link>
</Compile>
<Compile Include="..\Rotativa\RouteAsPdf.cs">
<Link>RouteAsPdf.cs</Link>
</Compile>
<Compile Include="..\Rotativa\UrlAsPdf.cs">
<Link>UrlAsPdf.cs</Link>
</Compile>
<Compile Include="..\Rotativa\ViewAsPdf.cs">
<Link>ViewAsPdf.cs</Link>
</Compile>
<Compile Include="..\Rotativa\WkhtmltopdfDriver.cs">
<Link>WkhtmltopdfDriver.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="..\Rotativa\Rotativa\libeay32.dll">
<Link>Rotativa\libeay32.dll</Link>
</Content>
<Content Include="..\Rotativa\Rotativa\libgcc_s_dw2-1.dll">
<Link>Rotativa\libgcc_s_dw2-1.dll</Link>
</Content>
<Content Include="..\Rotativa\Rotativa\mingwm10.dll">
<Link>Rotativa\mingwm10.dll</Link>
</Content>
<Content Include="..\Rotativa\Rotativa\README.txt">
<Link>Rotativa\README.txt</Link>
</Content>
<Content Include="..\Rotativa\Rotativa\ssleay32.dll">
<Link>Rotativa\ssleay32.dll</Link>
</Content>
<Content Include="..\Rotativa\Rotativa\wkhtmltopdf.exe">
<Link>Rotativa\wkhtmltopdf.exe</Link>
</Content>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
<ProjectExtensions />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target> -->
</Project>
18 changes: 12 additions & 6 deletions Rotativa.sln
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rotativa", "Rotativa\Rotativa.csproj", "{D93FAA11-31F0-4629-B53C-AA8680283529}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rotativa.Demo", "Rotativa.Demo\Rotativa.Demo.csproj", "{8EC08BFB-6ABA-4D71-8405-77AFF5859F3D}"
EndProject
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{C58DBD7F-8582-4005-AD32-E94AB45A338F}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\nuget.exe = .nuget\nuget.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rotativa", "Rotativa\Rotativa.csproj", "{D93FAA11-31F0-4629-B53C-AA8680283529}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rotativa.Demo", "Rotativa.Demo\Rotativa.Demo.csproj", "{8EC08BFB-6ABA-4D71-8405-77AFF5859F3D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rotativa.Tests", "Rotativa.Tests\Rotativa.Tests.csproj", "{DE9EB72A-2AE7-42E8-9A44-AA525B463688}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rotativa.UnitTests", "Rotativa.UnitTests\Rotativa.UnitTests.csproj", "{26A2783C-662D-4885-BD2B-A9AFB55C6BF9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rotativa.MVC4", "Rotativa.MVC4\Rotativa.MVC4.csproj", "{733E5EA3-068F-439D-B0F9-35D06C668657}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -38,6 +40,10 @@ Global
{26A2783C-662D-4885-BD2B-A9AFB55C6BF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26A2783C-662D-4885-BD2B-A9AFB55C6BF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26A2783C-662D-4885-BD2B-A9AFB55C6BF9}.Release|Any CPU.Build.0 = Release|Any CPU
{733E5EA3-068F-439D-B0F9-35D06C668657}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{733E5EA3-068F-439D-B0F9-35D06C668657}.Debug|Any CPU.Build.0 = Debug|Any CPU
{733E5EA3-068F-439D-B0F9-35D06C668657}.Release|Any CPU.ActiveCfg = Release|Any CPU
{733E5EA3-068F-439D-B0F9-35D06C668657}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 3 additions & 0 deletions Rotativa/AsPdfResultBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ namespace Rotativa
{
public abstract class AsPdfResultBase : ActionResult
{
protected Regex _urlRootReplacement = new Regex(@"( href=[""']| src=[""']|[ :]url\()/", RegexOptions.IgnoreCase | RegexOptions.Multiline);
protected Regex _urlRelativeReplacement = new Regex(@"( href=[""']| src=[""']|[ :]url\()(?!(?:http|https|ftp):)", RegexOptions.IgnoreCase | RegexOptions.Multiline);

private const string ContentType = "application/pdf";

/// <summary>
Expand Down
Loading