GithubHelp home page GithubHelp logo

zkweb-framework / zkweb.system.drawing Goto Github PK

View Code? Open in Web Editor NEW
106.0 106.0 23.0 1.05 MB

.Net Core compatible System.Drawing implementation modified from mono project.

License: Other

C# 99.91% Shell 0.09%

zkweb.system.drawing's Issues

KnownColors TypeInitializationException on Ubuntu

Unhandled Exception: System.TypeInitializationException: The type initializer for 'System.Drawing.KnownColors' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'gdiplus.dll': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
at System.Drawing.GDIPlus.GdiplusStartup(UInt64& token, GdiplusStartupInput& input, GdiplusStartupOutput& output)
at System.Drawing.GDIPlus..cctor()
--- End of inner exception stack trace ---
at System.Drawing.GDIPlus.RunningOnWindows()
at System.Drawing.KnownColors..cctor()
--- End of inner exception stack trace ---
at System.Drawing.KnownColors.FromKnownColor(KnownColor kc)
at QRCoder.QRCode.GetGraphic(Int32 pixelsPerModule)
at QrNetCore.Program.WriteQRImage(String data, Int32 ppm) in /home/raffael/MonoProjects/QrCoderNetcore/QrNetCore/Program.cs:line 23
at QrNetCore.Program.Main(String[] args) in /home/raffael/MonoProjects/QrCoderNetcore/QrNetCore/Program.cs:line 10

Failed

I has except install package ZKWeb.System.Drawing from nuget and install libgdiplus flow the Step CentOS 7 and above , but it's also fail on CentOS7.(it's work on windows)

System.OutOfMemoryException throws when i tried to run the code on ubuntu

Hello.
The project itself is an ASP.NET Core Application, and I wish to draw some images with more code.
On Windows it runs normally when I start the program with "dotnet xxxx.dll" but on Ubuntu it was crash while the systemis available for about 1316000KB memory.
I tried to reduce the code a little and it runs normally.
But how to solve it if i want to keep the code length?

System.OutOfMemoryException: Not enough memory to complete operation [GDI+ status: OutOfMemory]
   at System.DrawingCore.GDIPlus.CheckStatus(Status status)
   at System.DrawingCore.Graphics.DrawLine(Pen pen, PointF pt1, PointF pt2)
   at Daylily.Plugin.Command.PpPlus.Draw(String user, Dictionary`2 d_pfmance)
   at Daylily.Plugin.Command.PpPlus.Execute(String params, String user, String group, Boolean isRoot)

PrintDocument in .net core

I want to use PrintDocument in .net core. Is there any way through which I can achieve that?
I want the following implementation:

        public void Print()
        {
            PrintDocument pdPrint = null;

            using (pdPrint = new PrintDocument())
            {
                pdPrint.PrinterSettings.PrinterName = printerName;
                pdPrint.DefaultPageSettings.PaperSize = paperSize;
                pdPrint.PrintPage += new PrintPageEventHandler((sender, e) => PrintPage(sender, e);
                pdPrint.Print();
            }
        }
        private void PrintPage(object sender, PrintPageEventArgs e)
        {
            float x, y, lineOffset;
            Font printFontA = new Font("Microsoft Sans Serif", Convert.ToSingle(11), FontStyle.Bold, GraphicsUnit.Point); // Substituted to FontA Font

            StringFormat drawFormat = new StringFormat();
            drawFormat.Alignment = StringAlignment.Far;

            e.Graphics.PageUnit = GraphicsUnit.Point;

            //Specify the line spacing between lines
            lineOffset = printFontA.GetHeight(e.Graphics);

            //Specify the starting position for printing
            x = 50;
            y = 50;

            e.Graphics.DrawString("****Test****", printFontA, Brushes.Black, x, y);
        }

My aim is to do printing in Linux using 'PrintPageEventArgs', can you please suggest me a way.

libgdiplus DllNotFoundException on Xamarin Android project

I am using Windows 10 and installed ZKWeb.System Drawing 4.0.1. I added a simple Bitmap initialization line to the code. While debugging the my sample application on Android emulator, libgdiplus.dll not found exception is thrown. How can I fix it, could you help on this?

{System.TypeInitializationException: The type initializer for 'System.DrawingCore.GDIPlus' threw an exception. --->
System.DllNotFoundException: gdiplus
at (wrapper managed-to-native) System.DrawingCore.GDIPlus:GdiplusStartup (ulong&,System.DrawingCore.GdiplusStartupInput&,System.DrawingCore.GdiplusStartupOutput&)

at System.DrawingCore.GDIPlus..cctor () [0x000ab] in :0

--- End of inner exception stack trace ---

at System.DrawingCore.Bitmap..ctor (System.Int32 width, System.Int32 height, System.DrawingCore.Imaging.PixelFormat format) [0x00006] in :0

at System.DrawingCore.Bitmap..ctor (System.Int32 width, System.Int32 height) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.DrawingCore.Bitmap:.ctor (int,int)

at XamarinWebSample.SampleService+d__7.MoveNext () [0x00008] in C:\VS_TFS\DivaPos\Mobile\XamarinWebSample\XamarinWebSample\SampleService.cs:72
--- End of stack trace from previous location where exception was thrown ---

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <657aa8fea4454dc898a9e5f379c58734>:0

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0

at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0
at (wrapper dynamic-method) System.Object:CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object)
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet] (System.Runtime.CompilerServices.CallSite site, T0 arg0) [0x00104] in <65f4a23934a3468fae9abe3139b55169>:0
at XamarinWebSample.WebCallbackRepository+<>c__DisplayClass13_1+<b__1>d.MoveNext () [0x00148] in ..\XamarinWebSample\WebCallbackRepository.cs:125 }

DotNet Core Debian gdiplus.dll

Unhandled Exception: System.TypeInitializationException: The type initializer for 'DiscordLucarioBotnAPI.Program' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'gdiplus.dll': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)

DrawString not dislpay in image

            var img = new Bitmap(500, 500);
            var g = Graphics.FromImage(img);
            g.Clear(Color.Gray);
            g.DrawString("AABB", new Font("Arial", 140), new SolidBrush(Color.Red), new RectangleF(10, 10, 400, 400));
            var sf = g.MeasureString("AABB", new Font("Arial", 140), 500, StringFormat.GenericTypographic);
            Console.WriteLine(sf.Width);
            //windows output 498
            //centos 7 output 0

sf.Width
//windows output 498
//centos 7 output 0
and output image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.