PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Hello World freezing https://forum.pdfsharp.net/viewtopic.php?f=2&t=3417 |
Page 1 of 1 |
Author: | haf [ Tue Aug 09, 2016 7:40 am ] |
Post subject: | Hello World freezing |
I'm having some trouble getting started with the Hello World sample. I have this code (from HelloWorld): Code: #I "../../packages/PDFSharp-MigraDoc/lib/net20/" #r "PdfSharp.dll" #r "MigraDoc.Rendering.dll" #r "MigraDoc.DocumentObjectModel.dll" open PdfSharp open PdfSharp.Pdf open PdfSharp.Drawing open System.IO let generate () = let d = new PdfDocument() let p = d.AddPage() let gfx = XGraphics.FromPdfPage p let font = XFont("Arial", 15., XFontStyle.Regular) let topLeft = XPoint (0., 0.) gfx.DrawString("Hello, World!", font, XBrushes.Black, XRect(topLeft, XSize(100., 20.)), XStringFormats.Center) use fs = File.OpenWrite("./HelloWorld.pdf") d.Save(fs) Generation.generate () But it just hangs on DrawString with one core pegged at 100%. Packages in use: Code: NUGET remote: https://www.nuget.org/api/v2 FSharp.Core (4.0.0.1) PDFsharp-MigraDoc (1.50.4000-beta3b) Runtime version: Code: $ mono --version Mono JIT compiler version 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45 Wed Jul 27 16:20:13 EDT 2016) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: normal SIGSEGV: altstack Notification: kqueue Architecture: x86 Disabled: none Misc: softdebug LLVM: yes(3.6.0svn-mono-master/a173357) GC: sgen Same for nuget PdfSharp (1.32.3057) |
Author: | () => true [ Tue Aug 09, 2016 11:51 am ] |
Post subject: | Re: Hello World freezing |
Hi! Things you can try:
|
Author: | haf [ Wed Aug 10, 2016 5:54 pm ] |
Post subject: | Re: Hello World freezing |
Hi there, Sure I can try that; but to "implement your own font resolver" is a high threshold to cross as a beginning user of a library. How about I send a PR to integration-test on Travis CI, if you point me to the github repository I can do it for? That way, perhaps you could have a look at testing your project and I'll can focus on what I'm good at? |
Author: | () => true [ Wed Aug 10, 2016 9:28 pm ] |
Post subject: | Re: Hello World freezing |
haf wrote: Sure I can try that; but to "implement your own font resolver" is a high threshold to cross as a beginning user of a library. Using a font resolver is rather simple IMHO.You can use this implementation: viewtopic.php?p=9576#p9576 haf wrote: How about I send a PR to integration-test on Travis CI, if you point me to the github repository I can do it for? Which GitHub repository?PDFsharp can be found here: https://github.com/empira/PDFsharp |
Author: | haf [ Thu Aug 11, 2016 8:48 pm ] |
Post subject: | Re: Hello World freezing |
It would seem this is the culprit: Quote: System.DllNotFoundException: user32.dll
at (wrapper managed-to-native) PdfSharp.Internal.NativeMethods:GetDC (intptr) at PdfSharp.Drawing.XFontSource.ReadFontBytesFromGdi (System.Drawing.Font gdiFont) <0x7d2e210 + 0x00037> in <filename unknown>:0 at PdfSharp.Drawing.XFontSource.GetOrCreateFromGdi (System.String typefaceKey, System.Drawing.Font gdiFont) <0x7d2e1d0 + 0x00013> in <filename unknown>:0 at PdfSharp.Fonts.PlatformFontResolver.CreateFontSource (System.String familyName, PdfSharp.Fonts.FontResolvingOptions fontResolvingOptions, System.Drawing.Font& font, System.String typefaceKey) <0x6ac3310 + 0x0011b> in <filename unknown>:0 at PdfSharp.Fonts.PlatformFontResolver.ResolveTypeface (System.String familyName, PdfSharp.Fonts.FontResolvingOptions fontResolvingOptions, System.String typefaceKey) <0x6ac3038 + 0x0009b> in <filename unknown>:0 at PdfSharp.Fonts.FontFactory.ResolveTypeface (System.String familyName, PdfSharp.Fonts.FontResolvingOptions fontResolvingOptions, System.String typefaceKey) <0x6ac2c00 + 0x0039f> in <filename unknown>:0 at PdfSharp.Drawing.XGlyphTypeface.GetOrCreateFrom (System.String familyName, PdfSharp.Fonts.FontResolvingOptions fontResolvingOptions) <0x6ac24a0 + 0x0005f> in <filename unknown>:0 at PdfSharp.Drawing.XFont.Initialize () <0x6ac2330 + 0x00113> in <filename unknown>:0 at PdfSharp.Drawing.XFont..ctor (System.String familyName, Double emSize, XFontStyle style, PdfSharp.Drawing.XPdfFontOptions pdfOptions) <0x6ac22b0 + 0x00067> in <filename unknown>:0 at PdfSharp.Drawing.XFont..ctor (System.String familyName, Double emSize, XFontStyle style) <0x6ac2048 + 0x00057> in <filename unknown>:0 at FSI_0001+Generation.generate () <0x72d24b0 + 0x000af> in <filename unknown>:0 at <StartupCode$FSI_0001>.$FSI_0001.main@ () <0x6abe540 + 0x00013> in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x1a7ea40 + 0x000a1> in <filename unknown>:0 |
Author: | () => true [ Fri Aug 12, 2016 6:08 am ] |
Post subject: | Re: Hello World freezing |
So the problem is with "ReadFontBytesFromGdi" - it seems the functions called by this method are not supported on your system. Try IFontResolver or EZFontResolver and this method should no longer be called. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |