PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Using pdfSharp in Unity3D without System.Windows.Forms.dll ?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3167
Page 1 of 1

Author:  nvf33 [ Fri Aug 14, 2015 7:42 am ]
Post subject:  Using pdfSharp in Unity3D without System.Windows.Forms.dll ?

Hello,
we would like to generate a pdf-file out of a unity3D game, but there is the well known problem that unity doesn't like the System.Windows.Forms.dll - as far as we can see now.
Is there any way to get pdfSharp running without this dll, i.e. compile it with Mono and the unity specific restrictions?

Actually, it doesn't really matter if such a solution would rely on GDI+ or WPF. We are just wondering, if there's any way at all to do this.

Any hint is appreciated!

Regards
nvf33

Author:  nvf33 [ Tue Sep 01, 2015 7:51 am ]
Post subject:  Re: Using pdfSharp in Unity3D without System.Windows.Forms.d

We managed to solve the issue, essentially in three steps:
1. Recompile the pdfSharp assemblies from source AFTER deleting all sources containing System.Forms references (very simple: they're all in the source folder PdfSharp.Forms)
Now you can try it in the Unity editor, which automatically loads all necessary & compatible dlls. Outside the editor you need to manually add them to the project:

2. Find a compatible System.Drawing.dll, see http://answers.unity3d.com/questions/53170/using-drawing-package-like-systemdrawing.html for details, it should be somewhere here in the editor: %Unity Folder%\Editor\Data\Mono\lib\mono\2.0 . For Mac support you'll need some extra efforts.

3. Add the internationalization dlls from the editor libs (see 2.) as described here (I18N.dll e.g.) : http://answers.unity3d.com/questions/42955/codepage-1252-not-supported-works-in-editor-but-no.html

The only thing which doesn't work is web player support, but there may be an pdfsharp update in near future for that.

Author:  MrShneebli [ Sun May 07, 2017 10:03 am ]
Post subject:  Re: Using pdfSharp in Unity3D without System.Windows.Forms.d

Hi NVF33,
I read your instruction but I then got an error when running the Hello World script using the function Xgraphics.DrawString.
I'm getting an error
error CS0012: The type `System.Drawing.PointF' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Drawing, Version=2.0.0.0, Culture=neutral, '

Any idea what I can do?

Thanks in advance!

Author:  Thomas Hoevel [ Mon May 08, 2017 11:35 am ]
Post subject:  Re: Using pdfSharp in Unity3D without System.Windows.Forms.d

Hi!
MrShneebli wrote:
I'm getting an error
error CS0012: The type `System.Drawing.PointF' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Drawing, Version=2.0.0.0, Culture=neutral, '
Any idea what I can do?
How about adding that reference? Have you tried that?

That is a normal compiler error message. When you add a reference to library A and lib A uses types from library B in public methods then you also have to reference library B. This is not specific to Unity3D.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/