Skip to content
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
51 changes: 6 additions & 45 deletions DemoHighlight/DemoHighlighter.csproj
Original file line number Diff line number Diff line change
@@ -1,55 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{03D26E9E-02B3-474A-BF6F-FC1E6F04BF66}</ProjectGuid>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DemoHighlight</RootNamespace>
<AssemblyName>DemoHighlight</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</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="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Highlighter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<ProjectReference Include="..\MarkdownToPdf\MarkdownToPdf.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MarkdownToPdf\MarkdownToPdf.csproj">
<Project>{3b2a01a0-b940-480b-bb24-4ab041a04aa2}</Project>
<Name>MarkdownToPdf</Name>
</ProjectReference>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
35 changes: 0 additions & 35 deletions DemoHighlight/Properties/AssemblyInfo.cs

This file was deleted.

61 changes: 8 additions & 53 deletions DemoImagePlugin/DemoImagePlugin.csproj
Original file line number Diff line number Diff line change
@@ -1,63 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{02AD716B-4EEC-4094-8B0D-DF2EFD2C2A6A}</ProjectGuid>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DemoImagePlugin</RootNamespace>
<AssemblyName>DemoImagePlugin</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<UseWPF>true</UseWPF>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</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="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="WpfMath, Version=0.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\WpfMath.0.11.0\lib\net452\WpfMath.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="DemoImagePlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<ProjectReference Include="..\MarkdownToPdf\MarkdownToPdf.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MarkdownToPdf\MarkdownToPdf.csproj">
<Project>{3b2a01a0-b940-480b-bb24-4ab041a04aa2}</Project>
<Name>MarkdownToPdf</Name>
</ProjectReference>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<PackageReference Include="WpfMath" Version="0.11.0" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
35 changes: 0 additions & 35 deletions DemoImagePlugin/Properties/AssemblyInfo.cs

This file was deleted.

4 changes: 0 additions & 4 deletions DemoImagePlugin/packages.config

This file was deleted.

12 changes: 6 additions & 6 deletions MarkdownToPdf/Converters/BlockConverterBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private void PrepareVerticalInheritedMargin(BoxSide side)
}
else
{
horizontalMarginsPending.Add((EvaluatedStyle.Margin[side].Eval(FontSize, Width), Parent.EvaluatedStyle.Background));
horizontalMarginsPending.Add((EvaluatedStyle.Margin[side].Eval(FontSize, Width).Point, Parent.EvaluatedStyle.Background));
EvaluatedStyle.Margin[side] = 0;
}
}
Expand All @@ -201,24 +201,24 @@ private void PrepareVerticalInheritedMargin(BoxSide side)

if (!EvaluatedStyle.Margin[side].IsEmptyOrZero(FontSize, Width))
{
horizontalMarginsPending.Add((EvaluatedStyle.Margin[side].Eval(FontSize, Width), Parent.EvaluatedStyle.Background));
horizontalMarginsPending.Add((EvaluatedStyle.Margin[side].Eval(FontSize, Width).Point, Parent.EvaluatedStyle.Background));
}

while (!(parent is IStandaloneContainerConverter) && IsMarginalBlock(parent.Block, side))
{
if (!parent.EvaluatedStyle.Padding[side].IsEmptyOrZero(FontSize, Width))
horizontalMarginsPending.Add((parent.EvaluatedStyle.Padding[side].Eval(FontSize, Width), parent.EvaluatedStyle.Background));
horizontalMarginsPending.Add((parent.EvaluatedStyle.Padding[side].Eval(FontSize, Width).Point, parent.EvaluatedStyle.Background));

if (!parent.EvaluatedStyle.Margin[side].IsEmptyOrZero(FontSize, Width))
horizontalMarginsPending.Add((parent.EvaluatedStyle.Margin[side].Eval(FontSize, Width), parent.Parent.EvaluatedStyle.Background));
horizontalMarginsPending.Add((parent.EvaluatedStyle.Margin[side].Eval(FontSize, Width).Point, parent.Parent.EvaluatedStyle.Background));

parent = parent.Parent;
}

if (!(parent is IStandaloneContainerConverter))
{
horizontalMarginsPending.Add((parent.EvaluatedStyle.Padding[side].Eval(FontSize, Width), parent.EvaluatedStyle.Background));
horizontalMarginsPending.Add((parent.EvaluatedStyle.Margin[side].Eval(FontSize, Width), parent.Parent.EvaluatedStyle.Background));
horizontalMarginsPending.Add((parent.EvaluatedStyle.Padding[side].Eval(FontSize, Width).Point, parent.EvaluatedStyle.Background));
horizontalMarginsPending.Add((parent.EvaluatedStyle.Margin[side].Eval(FontSize, Width).Point, parent.Parent.EvaluatedStyle.Background));
}
return horizontalMarginsPending;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ protected override void PrepareStyling()
EvaluatedStyle.Font = EvaluatedStyle.Font.MergeWith(Parent.EvaluatedStyle.Font);
EvaluatedStyle.Background = EvaluatedStyle.Background.IsEmpty ? Parent.EvaluatedStyle.Background : EvaluatedStyle.Background;

FontSize = EvaluatedStyle.Font.Size.Eval(Parent.FontSize, Parent.Width);
FontSize = EvaluatedStyle.Font.Size.Eval(Parent.FontSize, Parent.Width).Point;
Width = Parent.Width - (EvaluatedStyle.Margin.Left + EvaluatedStyle.Margin.Right + EvaluatedStyle.Padding.Left + EvaluatedStyle.Padding.Right)
.Eval(FontSize, Parent.Width);
.Eval(FontSize, Parent.Width).Point;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public RootBlockConvertor(MarkdownDocument block, string rawText, MigraDocBlockC
RawText = rawText;
OutputContainer = output;
ElementDescriptor = new SingleElementDescriptor { Attributes = Attributes, Type = ElementType.Root };
Width = Owner.RealPageWidth;
Width = Owner.RealPageWidth.Point;
Split(rawText);
}

Expand All @@ -32,8 +32,8 @@ private void Split(string rawText)
protected override void PrepareStyling()
{
base.PrepareStyling();
Width = Owner.RealPageWidth;
FontSize = EvaluatedStyle.Font.Size.Eval(12, Owner.RealPageWidth);
Width = Owner.RealPageWidth.Point;
FontSize = EvaluatedStyle.Font.Size.Eval(12, Owner.RealPageWidth.Point).Point;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override void PrepareStyling()

if (!EvaluatedStyle.Table.Width.IsEmpty)
{
Width = EvaluatedStyle.Table.Width.Eval(FontSize, Parent.Width);
Width = EvaluatedStyle.Table.Width.Eval(FontSize, Parent.Width).Point;
tableWidthSet = true;
}
if (Attributes.ContainsKey("align"))
Expand All @@ -60,7 +60,7 @@ protected override void PrepareStyling()
try
{
var w = Dimension.Parse(Attributes.Attributes["width"]);
Width = w.Eval(FontSize, Parent.Width);
Width = w.Eval(FontSize, Parent.Width).Point;
tableWidthSet = true;
}
catch (ArgumentException e)
Expand Down Expand Up @@ -164,7 +164,7 @@ private void AddSimulatedMargin(Unit margin, bool top = false)
private void PrepareColumns()
{
var colWidths = GetColumnWidths();
var totalColumnsWidth = colWidths.Sum(x => x.Eval(FontSize, Width));
var totalColumnsWidth = colWidths.Sum(x => x.Eval(FontSize, Width).Point);
var scale = totalColumnsWidth > Width || tableWidthSet ? Width / totalColumnsWidth : 1.0;

for (var i = 0; i < colWidths.Count; i++)
Expand Down
4 changes: 2 additions & 2 deletions MarkdownToPdf/Converters/LeafConverters/LeafBlockConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ protected override void PrepareStyling()
}
}

FontSize = EvaluatedStyle.Font.Size.Eval(Parent.FontSize, Parent.Width);
Width = Parent.Width - (EvaluatedStyle.Margin.Left + EvaluatedStyle.Margin.Right + EvaluatedStyle.Padding.Left + EvaluatedStyle.Padding.Right).Eval(FontSize, Parent.Width);
FontSize = EvaluatedStyle.Font.Size.Eval(Parent.FontSize, Parent.Width).Point;
Width = Parent.Width - (EvaluatedStyle.Margin.Left + EvaluatedStyle.Margin.Right + EvaluatedStyle.Padding.Left + EvaluatedStyle.Padding.Right).Eval(FontSize, Parent.Width).Point;
}

protected override void AdjustInheritedHorizontalMargins()
Expand Down
2 changes: 1 addition & 1 deletion MarkdownToPdf/Dimension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static implicit operator Dimension(string value)

public static implicit operator Dimension(Unit value)
{
return FromPoints(value);
return FromPoints(value.Point);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion MarkdownToPdf/Documentation/articles/conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pdf
Headers and footers can be added by `AddHeader()` and `AdFooter()` and their variants - see the [MarkDownToPdfClass](xref:Orionsoft.MarkdownToPdfLib.MarkdownToPdf) documentation. Like in this example:

```csharp
var markdown = File.ReadAllText("../../data/alice1.md");
var markdown = File.ReadAllText("data/alice1.md");
var footer = "{align=center}\r\n\\- [](md:page) - ";

var pdf = new MarkdownToPdf();
Expand Down
14 changes: 7 additions & 7 deletions MarkdownToPdf/MarkdownToPdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,10 @@ public IMarkdownToPdf PaperOrientation(PaperOrientation po)
public IMarkdownToPdf PageMargins(Dimension left, Dimension right, Dimension top, Dimension bottom)
{
PageSetup target = GetCurrentPageSetup();
target.LeftMargin = left.Eval(defaultStyles.fontSize, RealPageWidth);
target.RightMargin = right.Eval(defaultStyles.fontSize, RealPageWidth);
target.TopMargin = top.Eval(defaultStyles.fontSize, RealPageWidth);
target.BottomMargin = bottom.Eval(defaultStyles.fontSize, RealPageWidth);
target.LeftMargin = left.Eval(defaultStyles.fontSize, RealPageWidth.Point);
target.RightMargin = right.Eval(defaultStyles.fontSize, RealPageWidth.Point);
target.TopMargin = top.Eval(defaultStyles.fontSize, RealPageWidth.Point);
target.BottomMargin = bottom.Eval(defaultStyles.fontSize, RealPageWidth.Point);
return this;
}

Expand All @@ -422,7 +422,7 @@ public IMarkdownToPdf PageMargins(Dimension left, Dimension right, Dimension top
public IMarkdownToPdf HeaderDistance(Dimension distance)
{
PageSetup target = GetCurrentPageSetup();
target.HeaderDistance = distance.Eval(defaultStyles.fontSize, RealPageWidth);
target.HeaderDistance = distance.Eval(defaultStyles.fontSize, RealPageWidth.Point);
return this;
}

Expand All @@ -432,7 +432,7 @@ public IMarkdownToPdf HeaderDistance(Dimension distance)
public IMarkdownToPdf FooterDistance(Dimension distance)
{
PageSetup target = GetCurrentPageSetup();
target.FooterDistance = distance.Eval(defaultStyles.fontSize, RealPageWidth);
target.FooterDistance = distance.Eval(defaultStyles.fontSize, RealPageWidth.Point);
return this;
}

Expand Down Expand Up @@ -514,7 +514,7 @@ private Unit GetRealPageWidth()

private PdfDocumentRenderer Render()
{
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true)
PdfDocumentRenderer pdfRenderer = new()
{
Document = MigraDocument
};
Expand Down
Loading