You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm starting to use your library to parse pdf and extract data from it. This is working perfectly for windows, however I'm not able to even compile with .Net core because of all the GUI library ( like silverlight or Winform) dependency that the base library has.
Do you thing it would be possible to have a base pdfSharp.Core library that only contain parsing and creation of of pdf ?
I'm would be happy to help if you need
Reacted by Chrysostomos Kolovos, Miko, Jason Sylvestre, Bruno Pessanha, zzyykk123456, jsutt88, David Fallah, Sam Shores, Valdis Zobēla, Dale Mckeown and 50 more
I'm starting to use your library to parse pdf and extract data from it.
This is working perfectly for windows, however I'm not able to even compile
with .Net core because of all the GUI library ( like silverlight or
Winform) dependency that the base library has.
Do you thing it would be possible to have a base pdfSharp.Core library
that only contain parsing and creation of of pdf ?
I'm would be happy to help if you need
PDFsharp uses the GUI for image handling. We have plans to handle images in own code, but this is not going to happen soon. Creating PDFs without images is of little use in most cases.
Parsing PDFs is a different story. This should be rather simple with .NET Core.
I don't know if Stefan has any plans to support .NET Core.
There is already a conditional build flag #Core spread in the code. I don't assume its specifically for .Net Core but a first step to get what we want. Even if Image handling won't work - we could use Vectors instead. Sufficient for creating invoices and reports.
There is currently no dependency-less solution available for creating PDFs in .Net Core ! This one has a great potential.
I also offer help. Glad to hear back from the maintainers if we can count on theirs support.
There already is a CORE flag with a different meaning from a time before .NET Core was announced. The CORE build is not yet fully implemented and still has some dependencies on GDI+.
Has anyone been working on a port that is usable in a UWP application? We have a UWP app for one of our clients that creates PDF documents using Component One that need to be merged before printing and uploading to a server. Component One unfortunately for us does not have the functionality to merge existing PDFs.
I've started on a port https://github.com/groege/PdfSharpCore
Though I have to warn you that it works for me in my case for creating a delivery note pdf, it might not work for you - but you can try anyway ;)
Examples are also not up to date - but if you want to try it out you can always create an issue ;)
Reacted by Sean O'Leary, Birnsen, Landon Rohatensky, zhech2, Bruno Tezine, jsutt88, Vasili Puchko, Bartek, Roman Rylov and Guilherme Britz Videira
Be aware of changes which I didn't include in the examples:
For images you must define the source by (i.e. Android):
ImageSource.ImageSourceImpl = new AndroidImageSource();
(Sadly I don't know how I can set it up to automatically use the right implementation)
Thank you, I have got it working with a UWP app now, so far just simple text to test it. I'm sure I'll be able to figure the rest out on my own. Thank you very much for your help.
Actually i just remembered - if you install the latest nuget package "Microsoft.Net.Compilers" on the projects you should be able to compile it yourself ;)
It is not clear to me from this discussion if the original pdfsharp library is considering supporting .net core or they rely on groege to maintain the net core version? Similar questions were referenced here (empira/PDFsharp#9) but there is no clear answer here to this question.
In my company, we want to use a stable well maintained library and if this library will not support net core we will have to search an alternative which is undesired.
PdfSharpCore has changed PdfSharp to be based on the .NET-Core High-Performance implementations.
It should have a better/higher performance - in theory.
If you have mono installed (libgdiplus.so) then System.Drawing should work on Linux, too (not sure if this is true).
Reacted by Guy Lando, Johann Dirry, amirvenus and Asger Hallas
@guylando: ASP.NET Core will be .NET Framework 5.0.
There will be nothing else anymore afterwards.
Only ASP.NET Core < 3 can be used with FULL .NET Framework < 5.
.NET Framework 4.8 will be the last major version of .NET Framework. If you have existing .NET Framework applications that you are maintaining, there is no need to move these applications to .NET Core. We will continue to both service and support .NET Framework, which includes bug–, reliability– and security fixes. It will continue to ship with Windows (much of Windows depends on .NET Framework) and we will continue to improve the tooling support for .NET in Visual Studio (Visual Studio is written on .NET Framework).
@ststeiger That's not entirely accurate. ASP.NET Core will (eventually) be .NET 5, which is not .NET Framework, it's just the next version of .NET Core that's being re-branded.
When ASP.NET Core uses .NET 5, it will still be able to depend on packages that use .NET Standard <=2.1. So in order to be compatible with the most number of frameworks, this library should be ported to .NET Standard 2.0. Then this library would support existing applications that are already written .NET Framework >=4.6.1 and also support new applications that will be written in .NET Core >=2.0 as well as .NET 5 when it comes out.
Reacted by aggsol, Ace Taylor, James and Paweł Iżycki
usingSystem;usingSystem.Collections.Generic;usingSystem.IO;usingMigraDoc.DocumentObjectModel;usingMigraDoc.Rendering;usingPdfSharp.Drawing;namespacePdfEg{internalclassPdfExample{privatevoidRunPdfExample(){varfonts=newList<string>();if(Environment.OSVersion.Platform==PlatformID.Unix){fonts.AddRange(Directory.EnumerateFiles("/usr/share/fonts/truetype/msttcorefonts"));fonts.AddRange(Directory.EnumerateFiles("/usr/share/fonts/truetype"));}elseif(Environment.OSVersion.Platform==PlatformID.Win32NT){fonts.AddRange(Directory.EnumerateFiles(Path.Combine(System.Environment.GetEnvironmentVariable("windir"),"Fonts")));}foreach(varfontinfonts){try{XPrivateFontCollection.Add(File.ReadAllBytes(font));}catch{// todo: log}}vardocument=newDocument();varsection=document.AddSection();document.Styles.Normal.Font=newFont("Arial",Unit.FromPoint(8));varh1=document.AddStyle("h1","Normal");h1.Font.Bold=true;h1.Font.Size=Unit.FromPoint(15);// add to page here :)varrenderer=newPdfDocumentRenderer(true){Document=document,};renderer.RenderDocument();using(varstream=newMemoryStream()){renderer.PdfDocument.Save(stream);vardata=stream.ToArray();}}}}
Dockerfile which we use. Note the entrypoint.sh file just runs the dotnet command on the main dll. Replace with your use
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
ARG source=.
WORKDIR .
ENV ASPNETCORE_URLS http://*:5000
EXPOSE 5000/tcp
ARG NODEREPO="node_9.x"ARG DISTRO="stretch"RUN apt-get update -q && apt-get install -q -y \
curl \
apt-transport-https \
apt-utils \
dialog \
gnupg
RUN curl -sSO https://deb.nodesource.com/gpgkey/nodesource.gpg.key
RUN apt-key add nodesource.gpg.key
RUN echo "deb https://deb.nodesource.com/${NODEREPO} ${DISTRO} main" > /etc/apt/sources.list.d/nodesource.list
RUN echo "deb-src https://deb.nodesource.com/${NODEREPO} ${DISTRO} main" >> /etc/apt/sources.list.d/nodesource.list
RUN (echo "deb http://http.debian.net/debian/ ${DISTRO} main contrib non-free" > /etc/apt/sources.list) && (echo "deb http://http.debian.net/debian ${DISTRO}-backports main" > /etc/apt/sources.list.d/backports.list) && (echo "deb http://http.debian.net/debian/ ${DISTRO}-updates main contrib non-free" >> /etc/apt/sources.list) && (echo "deb http://security.debian.org/ ${DISTRO}/updates main contrib non-free" >> /etc/apt/sources.list)
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
RUN apt-get update && apt-get -y install \
libgdiplus \
ttf-mscorefonts-installer \
nodejs
RUN cd /usr/lib && ln -s libgdiplus.so gdiplus.dll
RUN ln -s /lib/x86_64-linux-gnu/libdl.so.2 /lib/libdl.so
RUN ln -s /usr/lib/x86_64-linux-gnu/libX11.so.6 /lib/libX11.so
COPY $source .
RUN ["chmod", "+x", "/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
The TFM concepts netstandard and netcoreapp has been merged into the net5.0 and its platform specific TargetFramework net5.0-windows, net5.0-watchos, net5.0-tvos, net5.0-macos, net5.0-ios, net5.0-android
But with a target of net5.0 you can't use that package in classic .Net Framework projects. netstandard2.0 would be the most flexible one. And Pdfsharp doesn't use anything outside of .Net Standard 2.0.
Activity
shontykov commentedon Sep 15, 2016
I havent bumped to .Net.core yet. But, yes it would be an amazing idea to
have pdfsharp.core library.
On Wed, Sep 14, 2016 at 7:09 PM, David Zucker notifications@github.com
wrote:
daniellor commentedon Sep 15, 2016
my fork working for mono
https://github.com/daniellor/PDFsharp
ThomasHoevel commentedon Sep 15, 2016
PDFsharp uses the GUI for image handling. We have plans to handle images in own code, but this is not going to happen soon. Creating PDFs without images is of little use in most cases.
Parsing PDFs is a different story. This should be rather simple with .NET Core.
I don't know if Stefan has any plans to support .NET Core.
charabaruk commentedon Oct 6, 2016
It would definitely be very helpful to remove dependencies on GDI+ and WPF for PDF generation.
andekande commentedon Dec 8, 2016
There is already a conditional build flag #Core spread in the code. I don't assume its specifically for .Net Core but a first step to get what we want. Even if Image handling won't work - we could use Vectors instead. Sufficient for creating invoices and reports.
There is currently no dependency-less solution available for creating PDFs in .Net Core ! This one has a great potential.
I also offer help. Glad to hear back from the maintainers if we can count on theirs support.
ThomasHoevel commentedon Dec 8, 2016
There already is a CORE flag with a different meaning from a time before .NET Core was announced. The CORE build is not yet fully implemented and still has some dependencies on GDI+.
finnsea commentedon Feb 9, 2017
Has anyone been working on a port that is usable in a UWP application? We have a UWP app for one of our clients that creates PDF documents using Component One that need to be merged before printing and uploading to a server. Component One unfortunately for us does not have the functionality to merge existing PDFs.
groege commentedon Mar 13, 2017
I've started on a port
https://github.com/groege/PdfSharpCore
Though I have to warn you that it works for me in my case for creating a delivery note pdf, it might not work for you - but you can try anyway ;)
Examples are also not up to date - but if you want to try it out you can always create an issue ;)
o-leary commentedon Apr 10, 2017
Any chance you could share a built version? I can't get this to compile in VS 2015.
groege commentedon Apr 10, 2017
Ah yes - I'm using VS2017 and new C# features ;)
https://github.com/groege/PdfSharpCore/blob/master/Example/PdfSharpCore.7z
Be aware of changes which I didn't include in the examples:
For images you must define the source by (i.e. Android):
ImageSource.ImageSourceImpl = new AndroidImageSource();
(Sadly I don't know how I can set it up to automatically use the right implementation)
For Fonts look at the example project.
Hope this helps ;)
o-leary commentedon Apr 10, 2017
Thank you, I have got it working with a UWP app now, so far just simple text to test it. I'm sure I'll be able to figure the rest out on my own. Thank you very much for your help.
groege commentedon Apr 10, 2017
No problem - let me know if you run into any issues ;)
groege commentedon Apr 10, 2017
Actually i just remembered - if you install the latest nuget package "Microsoft.Net.Compilers" on the projects you should be able to compile it yourself ;)
guylando commentedon Aug 23, 2017
It is not clear to me from this discussion if the original pdfsharp library is considering supporting .net core or they rely on groege to maintain the net core version? Similar questions were referenced here (empira/PDFsharp#9) but there is no clear answer here to this question.
In my company, we want to use a stable well maintained library and if this library will not support net core we will have to search an alternative which is undesired.
24 remaining items
guylando commentedon Jan 9, 2019
Interesting, I now see that net core developers worked on porting System.Drawing:
https://github.com/dotnet/corefx/issues/20325
https://developers.de/2018/01/22/how-to-use-system-drawing-in-net-core/
Also there is windows compatability pack having System.Drawing inside:
https://blogs.msdn.microsoft.com/dotnet/2017/11/16/announcing-the-windows-compatibility-pack-for-net-core/
And in net core 3.0 it will be FULLY supported: dotnet/corefx#33092
ststeiger commentedon Jan 9, 2019
@guylando:
https://github.com/ststeiger/PdfSharpCore
is a port for .NET Core 1.6+
It doesn't use System.Drawing.dll.
It is based on PdfSharp 1.32 and has some missing and some half-working features.
https://github.com/ststeiger/PdfSharpNetStandard
Is for NetStandard 2.1+, and is based on PdfSharp 1.5.
Very few things are missing (https://github.com/ststeiger/PdfSharpNetStandard/tree/master/PdfSharp_Removed https://github.com/ststeiger/PdfSharpNetStandard/tree/master/MigraDoc_Rendering_Removed).
PdfSharpNetStandard should work work just like PdfSharp.
PdfSharpCore has changed PdfSharp to be based on the .NET-Core High-Performance implementations.
It should have a better/higher performance - in theory.
If you have mono installed (libgdiplus.so) then System.Drawing should work on Linux, too (not sure if this is true).
brentboden1 commentedon Jul 18, 2019
Is there any known date when we can expect an official release of pdfsharp for .net standard ?
ThomasHoevel commentedon Jul 18, 2019
An official version for .NET Core is not in the queue yet. So do not expect official versions for .NET Standard or .NET Core soon.
guylando commentedon Jul 19, 2019
@ThomasHoevel Asp.net core 3 does not compile to .Net framework which would prevent using pdfsharp
ststeiger commentedon Jul 19, 2019
@guylando: ASP.NET Core will be .NET Framework 5.0.
There will be nothing else anymore afterwards.
Only ASP.NET Core < 3 can be used with FULL .NET Framework < 5.
https://devblogs.microsoft.com/dotnet/introducing-net-5/
https://devblogs.microsoft.com/dotnet/net-core-is-the-future-of-net/
Methuselah96 commentedon Jul 19, 2019
@ststeiger That's not entirely accurate. ASP.NET Core will (eventually) be .NET 5, which is not .NET Framework, it's just the next version of .NET Core that's being re-branded.
When ASP.NET Core uses .NET 5, it will still be able to depend on packages that use .NET Standard <=2.1. So in order to be compatible with the most number of frameworks, this library should be ported to .NET Standard 2.0. Then this library would support existing applications that are already written .NET Framework >=4.6.1 and also support new applications that will be written in .NET Core >=2.0 as well as .NET 5 when it comes out.
B2alex commentedon Aug 22, 2019
This is a long chain, just wanted to check in and see if what I am understanding is correct.
PdfSharpCore
https://github.com/ststeiger/PdfSharpCore
Is the only port that supports .net core and got off of System.Drawing, for in favor of ImageSharp?
Also, has anyone been successful in getting a GDI based port to work on a linux container?
flipchart commentedon Aug 22, 2019
@B2alex We use it in production on a docker container running under Ubuntu linux on Azure. We modified to get it working and packaged it on nuget here https://www.nuget.org/packages/Drive.MigraDocPdfSharp
Basic code to get things running
Dockerfile which we use. Note the
entrypoint.shfile just runs thedotnetcommand on the main dll. Replace with your useFeature/merge from jnyrup (empira#6)
jespersh commentedon Sep 18, 2020
The TFM concepts
netstandardandnetcoreapphas been merged into thenet5.0and its platform specific TargetFrameworknet5.0-windows,net5.0-watchos,net5.0-tvos,net5.0-macos,net5.0-ios,net5.0-androidflensrocker commentedon Sep 18, 2020
But with a target of
net5.0you can't use that package in classic .Net Framework projects.netstandard2.0would be the most flexible one. And Pdfsharp doesn't use anything outside of .Net Standard 2.0.ststeiger commentedon Sep 22, 2020
Agree with @flensrocker.
Anything but NETSTANDARD_2_0 is pointless.
ThomasHoevel commentedon Apr 18, 2023
As of PDFsharp 6.0.0, PDFsharp is now using .NET 6.