- Home /
Displaying PDF
Hi, i'm trying to display a PDF file on my Mac standalone application and i have no idea how to do it. Any ideas, maybe somebody could help me?
Thanks, best regards.
Excuse me,I'm new in unity, someone can found the solution to this issue? (Sorry for my poor english)
Excuse me,I'm new in unity, someone can found the solution to this issue? (Sorry for my poor english)
Answer by Rod-Green · Nov 16, 2011 at 07:49 AM
You need to look up the PDF file format and create you're own custom PDF renderer.
Try looking through this stackoverflow thread:
http://stackoverflow.com/questions/518878/how-to-render-pdfs-using-c-sharp
I tried PDFSharp and sharpPDF and they both require gdiplus.dll.
Answer by fherbst · Nov 16, 2011 at 09:14 AM
Instead of using a custom PDF renderer (which could be overkill, depending on your needs), you could either
Preprocess the pdf to an image format, put it in a folder with the PDFs original name, and write some code to represent it like a single document with many pages. This is by far the simplest way.
Do the preprocessing on the fly (you select a PDF to show in Unity on runtime -> Unity starts e.g. a PDFTK process (I don't know if there is a nice PDF command line toolkit for Mac, tough) to let that render the PDF into PNG in the background -> see first solution). This would allow you to use any PDF you want.
Edit: From Rod Green's answer, I came to this link with two clicks: Using Ghostscript for PDF > JPG conversion Ghostscript (which is a pdf renderer) should even be available for Mac.
Answer by yoyo · Nov 16, 2011 at 06:54 PM
This may not provide the user experience you want, but worth mentioning that the Application.OpenURL method will open a browser to the provided URL, which you could use to display PDF files from the web (http:// URL) or local storage (file:// URL).
Answer by Paulius-Liekis · Aug 21, 2013 at 08:30 PM
This seems to do a good job: http://www.francescogallorini.com/2011/02/unity-sharp-pdf/. It doesn't require extra libraries.
OH, you're right. The answer doesn't answer the question.
Answer by MadhurSalvi · Sep 17, 2019 at 05:49 AM
I know I am posting offtopic question here , since i was unable to find any post regarding the sharp pdf with unity3d I am using the sharp pdf package with unity3d and i am facing difficulties for windows platform like: 1. How to dynamically increase the column height according to the text size at runtime. 2. How do i insert an image without using the co-routine function. 3. How to dynamically write the data on the new page if current page is filled and data is still pending. For example, there are 50 rows in my table at runtime and one first page 30rows occupy the space, then how do i dynamically write the remaining 20 rows on second page. 4. Instead of storing the file in root folder, in assets folder , how can i store the pdf at different location by selecting the folder from the system.
Can anyone please help me out, it would be great help....Thank you in advance.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Writing Files and Reading them in iTunes (or other pc app) 1 Answer
How to make unity contents with pdf? 0 Answers
DirectoryInfo().GetFiles works incorrectly in Standalone 2 Answers
How to hide Unity files 1 Answer