Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by mvm95 · Apr 07, 2017 at 03:04 PM · webgldllpdflimitationsexceptions

How can I make PDF files in a Unity WebGL build?

I've been using PDFSharp, which works in the editor and standalone builds, but in the WebGL build the PDF isn't even being created in memory:

 PdfDocument doc = new PdfDocument(); 

The error is "NotImplementedException: Cannot create value for key: /Info". I've looked through the PDFSharp source code, but I don't know what WebGL build limitation could be causing this exception.

Does anybody know what changes need to be made so that PDFSharp works with WebGL or know of another library for creating/processing PDF files that works with WebGL?

UPDATE: I've found the problem. In the PDFSharp source code, type.GetFields(...); is returning null in the WebGL build when it shouldn't be (and doesn't in the editor or standalone build). Does anybody know why this would be happening?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by FortisVenaliter · Apr 07, 2017 at 04:05 PM

WebGL is sort of streamed to the browser in question. It doesn't have file system access, so that's probably your issue. If PDFSharp uses a temporary file, or any filename to create it's data, it won't be able to access that file handle. Generally, most .NET plugins (other than the most basic, or ones designed for Unity) won't work outside of PC builds.

If you really need to create a PDF for the user, the only way I know how would be as follows:

  1. You need to write a separate process on the server that can accept requests from the WebGL game and generate a PDF on the server in an accessible location via HTTP.

  2. You can then use the WebGL application to point to the newly generated document URL, which will kick off a download of that document (usually after prompting the user).

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mvm95 · Apr 18, 2017 at 06:19 PM 0
Share

I'm not using any of the methods from PDFSharp that involve creating temporary files. Also, I don't have access to the server which the app will be posted on.

avatar image RedRiverStudio · Sep 19, 2017 at 11:23 PM 0
Share

So, just to confirm, there are no restrictions with WebGL creating content (IE images, text, xml, etc) and sending to the server? You would basically have the app create all the important data and it would be the responsibility of the server to cobble it all together and produce a final download?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Compile errors using WebGl plattform 2 Answers

Cannot load native dll in WebGL build 0 Answers

Unity/Mono doesn't support dll's with System.Collections.Generic.List? Using .NET 3.5 1 Answer

Random Unrelated Exceptions thrown in WebGL Build (unity 2018) 1 Answer

Build itextsharp dll Lite 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges