Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Create PDF from multiple Images

Discussion in 'iOS and tvOS' started by MerkSim, Sep 20, 2018.

  1. MerkSim

    MerkSim

    Joined:
    Mar 1, 2018
    Posts:
    12
    Hello,

    I have been struggling with creating a pdf file from a set of images I generate during runtime (that I afterwards send as an email).

    -I initially tried SharpPDF and even though it manages to create the pdf file, there must be a problem in how it encodes it, because it ONLY opens with Edge. On chrome its blank and on acrobat reader it says "error reading stream"

    -I compiled,imported and got PDFSharp (yes that's another one) to work on the editor and windows, but since the whole project is intended for iOS, I found out that it doesn't work.
    -error: https://answers.unity.com/questions/1336834/how-can-i-make-pdf-file-in-a-unity-webgl-build.html
    Then I tried using this repo:
    -https://github.com/roceh/PdfSharp.Xamarin
    -which gives me this error: "Unloading broken assembly .dll, this assembly assembly can cause crashes in the runtime" .

    I am out of time and ideas, any suggestions there? I wouldn't mind paying a small price for something from the asset store, but the only thing I found is an 80$ VIEWER (i.e. doesn't even generate pdfs).

    Thanks !
     
  2. zainSwinton

    zainSwinton

    Joined:
    Sep 20, 2018
    Posts:
    1
    No offence, but yet I guess you didn't search very observative. Especially that part about $80 PDF viewer - Adobe Reader is free t use, as well as Foxit reader and else. If you need to create a pdf file from several images or create a form, there's no free solution for that. There is Adobe Acrobat, costs about $15 a month of usage, as well as this tool, for creating and editing pdf's like ds11 form (you may guess from its name) yet it's in general - to merge several images into new PDF file fits too. It costs about $6 per month, but has a free trial month as well
     
  3. MerkSim

    MerkSim

    Joined:
    Mar 1, 2018
    Posts:
    12
    None taken, but you do realize I 'm talking about a way to generate a pdf:
    -through code
    -at runtime
    -in Unity
    right?
     
    RogDolos likes this.
  4. AMWeb

    AMWeb

    Joined:
    Sep 11, 2018
    Posts:
    2
    I am encountering the same issue with SharpPDF.

    Everything works perfectly fine, except when I try to add an image: the PDF still loads, but when opening the file, Acrobat says "Error reading stream" and the text parts are displayed correctly but no image appears (also when I open it in Chrome or Edge the image is missing, even if I get no error).

    @MerkSim Did you manage to find a solution to this issue?
     
  5. MerkSim

    MerkSim

    Joined:
    Mar 1, 2018
    Posts:
    12
    Hey, I can only assume its some problem with requirements of PDF versions, and maybe edge has some better backwards compatibility than the others (or better error handling). Unfortunately we couldn't fix it ( there was not enough time to invest on doing that) and ended up going with another format of PDF being just text + tables and the images being simply attached in the email as extra files.
     
  6. AMWeb

    AMWeb

    Joined:
    Sep 11, 2018
    Posts:
    2
    I'm sorry to hear that you had to go with a workaround, but anyway thank you for your feedback.
     
  7. AdamSt

    AdamSt

    Joined:
    Jun 2, 2013
    Posts:
    18
    Hey, I encounteret exactly same problem. My generated PDF opens properly only in Microsoft Edge, in Acrobat it gives popup with error, does not display images and only text. In google chrome it only displays text without images, no error popup appears. Same in Foxit Reader.

    Did anyone managed to solve this issue?
     
    Last edited: Jul 9, 2020