You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pdfnet-w...@googlegroups.com
$(function() { var viewerElement = document.getElementById('viewer'); var myWebViewer = new PDFTron.WebViewer({ type: "html5,Silverlight,flash", initialDoc: "api/recurso" }, viewerElement); });
I need a call to my API, which will return the XOD file
Matt Parizeau
unread,
Aug 19, 2014, 12:59:06 PM8/19/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pdfnet-w...@googlegroups.com
WebViewer will make GET requests to the URL specified in the initialDoc option. So you should be able to set the initialDoc to the URL of your API.
One thing to take note of though is that by default WebViewer will make requests with a Range header to request only certain bytes of the file. So for best performance of the WebViewer you would want to have your API handle these byte range requests.
If you aren't handling them and just want to return the entire file then you would have to set the option streaming: true. This refers to the streaming of the XOD conversion which this option is usually used for. In this case the entire document will be downloaded up front and this can take quite a while for medium to large documents which is why we recommend using the range request approach.
Matt Parizeau
Software Developer
PDFTron Systems Inc.
RFDeveloper
unread,
Aug 20, 2014, 11:04:02 AM8/20/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pdfnet-w...@googlegroups.com
How can I do this?
Can anyone help me?
How can I make a range request using my API?
Matt Parizeau
unread,
Aug 21, 2014, 2:27:23 PM8/21/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pdfnet-w...@googlegroups.com
Assuming you have access to the HTTP request then you can look at the Range header and return the requested bytes. You can find the spec for byte ranges at this link: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1. The examples they have are good at showing the possible values of the header. From the examples the headers that WebViewer will send will be of the form bytes=500-999 (for bytes 500-999 inclusive) or bytes=-500 (for the last 500 bytes). It won't send requests in other forms so you don't technically have to handle the other cases.
You can find the spec for the Content-Range header in the response here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16. Again the examples they provide do a good job of showing the possible values and WebViewer will expect a 206 response code.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pdfnet-w...@googlegroups.com
I tried that, but the webviewer is not sending in the range header, the range is null.
Em segunda-feira, 18 de agosto de 2014 20h07min03s UTC-3, RFDeveloper escreveu:
Matt Parizeau
unread,
Aug 22, 2014, 12:49:27 PM8/22/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pdfnet-w...@googlegroups.com
It's possible that WebViewer is detecting that range requests aren't supported and so is falling back to non-range mode where it requests the entire file. The simplest way to force range requests to be used would be to find the ControlUtils.js file and look for the byteRangeCheck function. Inside that function just replace all of the code with the line: onSuccess(206);. This will make it so that the viewer passes the test for range support and always uses range headers.
Matt Parizeau
Software Developer
PDFTron Systems Inc.
RFDeveloper
unread,
Aug 22, 2014, 1:44:04 PM8/22/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message