PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

PDfSharp and Unity
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4001
Page 1 of 1

Author:  AlexisDev [ Mon Aug 12, 2019 2:28 pm ]
Post subject:  PDfSharp and Unity

Hello everybody,

I have an issue on a specific usage and I hope someone will help me. :)
I try to fill AcroForm on iOS app create with Unity (I know, it's weird, but I need Unity for AR development).

In Unity Editor, everything work!
The compilation on iOS work fine and no error with PDFSharp library.
But in the app, when I try to read my original PDF I have this issue:
Code:
System.InvalidCastException: Unable to cast object of type 'PDFDictionary' to type 'PdfDocumentInformation'.
at PDFSharp.Pdf.Advanced.PdfTrailer.get_info () ...
at PdfSharp.Pdf.PdfDocument.get_info () ..
at PdfSharp.Pdf.IO.PdfReader.Open(System.IO.Stream stream, System.String password, PDFSharp.Pdf.IO.PdfDocumentOpenMode openmode, PdfSharp.Pdf.IO.PdfPasswordProvider passwordProvider) ...
at PdfSharp.Pdf.IO.PdfReader.Open(System.String path, System.String password, PDFSharp.Pdf.IO.PdfDocumentOpenMode openmode, PdfSharp.Pdf.IO.PdfPasswordProvider Provider) ...


I try to read the pdf with PdfDocumentOpenMode.Modify.

Someone have an idea? Thanks!

Best regards,
Alexis

Author:  Thomas Hoevel [ Wed Aug 14, 2019 8:37 am ]
Post subject:  Re: PDfSharp and Unity

Hi!
AlexisDev wrote:
Someone have an idea?
Use the issue submission template to replicate the issue under Windows with the latest stable version.

See also:
http://forum.pdfsharp.net/viewtopic.php?f=2&t=832

Author:  AlexisDev [ Wed Aug 14, 2019 3:04 pm ]
Post subject:  Re: PDfSharp and Unity

Hello,

I'm using: PDFSharp 1.50.5147 (Nuget package here)

Me code:
Code:
string path = "Devis_Client_Vierge.pdf";
string dest = "Devis-Test.pdf";

PdfDocument document = PdfReader.Open(path, PdfDocumentOpenMode.Modify);

document.Save(dest);
document.Close();


I found the problem come from IL2CPP scripting backend (not from PDFSharp library directely).
If I use Mono scripting backend when I build me project, everything work. But when I use IL2CPP (And I need it for iOS app...), the issue appear.

I will investigate in that direction!

Sorry for your time.

Best regards,
Alexis

Author:  NiklasDanzHDS [ Thu Oct 29, 2020 12:59 pm ]
Post subject:  Re: PDfSharp and Unity

Same here. Also happens when importing a PDF file and compiling with IL2CPP in Unity (Mono works fine).

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