-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically assign PDF file paths to the viewer #2496
Comments
pass it as the '?file=' param, e.g. http://mozilla.github.com/pdf.js/web/viewer.html?file=http%3A%2F%2Fasync5.org%2Fmoz%2Fpdfjs.pdf |
thanks again, you're a lifesaver. |
Hi, Can anyone of you be more descriptive about the solution. Will this method work with local storage url too? |
I guess it should. |
yurydelendik how can i change moodle default pdf viewer with pdf.js viewer and how can i integrate it with moodle and delete print or save buttons and right click . |
How would you pass a base64 data instead of the url within javascript? |
Thanks yurydelendik, I saw that link earlier. However, it only produces one page similar to the helloworld example. I want to be able to use all the features and functionality such as zoom,print,pages, of the http://mozilla.github.io/pdf.js/web/viewer.html. |
btw, http://mozilla.github.io/pdf.js/web/viewer.html?file=data:application/pdf;base64,JVBERi0xLjcKCjEgMCBvY...U9G works for me in Firefox. Also, I know that some browsers (e.g. Internet Explorer) truncate long URLs so you will be able to send only small PDFs. |
This is great, I see it works in firefox now too. But it doesn't work in chrome which I do most of my development in because I have "-args --allow-file-access-from-files --disable-xss-auditor --disable-web-security". Also, I hope this will work on the ipad. Thanks for your help yurydelendik. |
Hi , /ViewerJS/index.html#../../Generate_Report-7.pdf" this link is working. but i need like this, /ViewerJS/index.html#http://differentserver/Generate_Report-7.pdf" Please guide me. Thanks , |
This is PDF.js, not ViewerJS. For ViewerJS support go to https://github.com/kogmbh/ViewerJS. |
Please don't post unrelated questions on issues. |
Hello guys I've been searching around for a solution to my issue but I can't find anything I can use.The tool works great when I point to an existing pdf file. However, I'm having issues when I call a .net MVC controller to return a dynamically generated File of type "pdf". For Example: /web/viewer.html?file=URL (to my asp.net controller) Any suggestions would be greatly appreciated. |
Tim thanks for pointing us to ViewerJS. I found my solution here: webodf/ViewerJS#27 "ViewerJS 0.5.5 got released today, and it improves situation around content type detection. It both tries to query to server for the mimetype initially and also can be passed the type as argument in the passed url, e.g. /ViewerJS/index.html?type=pdf#http://mypage.com/service/createpdf Hopefully this will help anyone that's facing the same issue. |
Somebody please help me to fix my issue:- http://www.farukhzama.com/fileupload/index.php |
Hi |
Good:: pass it as the '?file=' param, e.g. http://mozilla.github.com/pdf.js/web/viewer.html?file=http%3A%2F%2Fasync5.org%2Fmoz%2Fpdfjs.pdf nice code ... |
pass it as the '?file=' param, e.g. http://mozilla.github.com/pdf.js/web/viewer.html?file=http%3A%2F%2Fasync5.org%2Fmoz%2Fpdfjs.pdf |
i want to know about that when i choose file and the file is preview in pdfjs viewer but i cant accept local path so for this firstly i save file in my project after i want to preview it how can i give path of this please solve my problem sir thanks in advance |
Hi <%@ Register Assembly="Spire.PdfViewer.Asp" Namespace="Spire.PdfViewer.Asp" TagPrefix="cc1" %>
50%
75%
100%
150%
200%
400%
C# Code ..
|
i need java code
…On Mon, 7 Oct 2019, 11:30 am Sanjeev Kumar, ***@***.***> wrote:
Hi
Enjoying using Asp.net Code..
<%@ Register Assembly="Spire.PdfViewer.Asp"
Namespace="Spire.PdfViewer.Asp" TagPrefix="cc1" %>
50% 75% 100% 150% 200% 400%
<input type="button" id="btnFirst" value="First" onclick="pdfdocumentviewer1.FirstPage()" />
<input type="button" id="btnPrevious" value="Previous" onclick="pdfdocumentviewer1.PreviousPage()" />
<input type="text" id="PdfDocumentViewer1_PdfViewerCurrentPage" value="1" style="width: 100px;" />
Pages:<span id="PdfDocumentViewer1_PdfViwerCountPage"></span>
<input type="button" id="btnNext" value="Next" onclick="pdfdocumentviewer1.NextPage()" />
<input type="button" id="btnLast" value="Last" onclick="pdfdocumentviewer1.LastPage()" />
C# Code ..
string pdflink = ds.Tables[0].Rows[0]["PDFFile"].ToString();
byte[] pdfData = System.IO.File.ReadAllBytes(Server.MapPath(pdflink));
//Load PDF byte array into RAD PDF
//The interval time of emptying caching, specified in seconds.
this.PdfDocumentViewer1.CacheInterval = 1200;
//caching time of an image, specified in seconds.
this.PdfDocumentViewer1.CacheTime = 1000;
//Cache the number of Image, default is 1000.
this.PdfDocumentViewer1.CacheNumberImage = 1000;
//The time of responding to event after stop scrolling, specified in milliseconds.default is 500.
this.PdfDocumentViewer1.ScrollInterval = 300;
//Zoom value of page, default is 1.
this.PdfDocumentViewer1.ZoomFactor = 1;
this.PdfDocumentViewer1.CustomErrorMessages = "Error information";
this.PdfDocumentViewer1.LoadFromFile(ds.Tables[0].Rows[0]["PDFFile"].ToString());
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2496?email_source=notifications&email_token=AMHI4HXZRHTGRUXTOI6KL23QNLGALA5CNFSM4ACTQOI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAPDOEA#issuecomment-538851088>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMHI4HQEOIWCDVMNLA6I4ITQNLGALANCNFSM4ACTQOIQ>
.
|
I was wondering of there is any way for me to dynamically change the path of the PDF file referenced inside viewer.js? Inside my viewer.js right now I have:
var DEFAULT_URL = './MyPDFs/test1.pdf';
Obviously this is the link to the PDF I'm displaying. My question is: can I dynamically change that link (DEFAULT_URL) server side? I'm trying to implement a functionality whereby the user clicks on an entry in a table, I then retrieve the PDF related to that entry from the database, make a copy of it server side and assign the URL of that newly created PDF to the viewer.
Is this possible? If so how would I go about doing it? Thanks for any help, this project is so awesome.
The text was updated successfully, but these errors were encountered: