Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

Open PDF from url with headers and custom location

More
IP: 194.28.116.213 5 years 10 months ago #15029 by robaba
Hi,
i use the PDFViewAct.class for rendering a pdf file.
I saw from the knowledge base www.radaeepdf.com/support/knowledge-base?view=kb&kbartid=100 , you can open a pdf directly from a url stream.

Does the SDK begin rendering the pdf before it's fully downloaded?
On the doc, in order to open a pdf from a stream, it seems to require a password. Can i pass null whenever it's required?
How can i pass additional HTTP headers to the HTTP request? Can you post a simple snippets of this?

How can i specify the download location for the incoming stream?

How can i be notified when the download is finished?
More
IP: 111.196.242.165 5 years 10 months ago #15030 by radaee
--Does the SDK begin rendering the pdf before it's fully downloaded?
Yes. and, there is backing thread in PDFHttpStream to download whole PDF file.
Document object has higher priority to read data that rendering needed.
these 2 tasks do not download same data repeated.
the downloaded data is written to a temp file.

--open a PDF file from a stream, require password.
it depends on PDF file.
if the PDF file is not encrypted, any password can open the PDF file.
if the PDF file is encrypted, and password is invalid, PDFHttpStream not need to reset(download data again).
More
IP: 194.28.116.213 5 years 10 months ago #15031 by robaba
Thank you for the quick response.
Is there a way to specify the location of this download's temporary folder? Or is there a way to retrieve this location and save a copy inside another location?
Am i notified of the completed download anywhere in the code?

How can i pass additional HTTP headers to the HTTP request? Can you post a simple snippets of this, please?

I'm using the PDFViewAct class to display the pdf
More
IP: 111.196.242.165 5 years 10 months ago #15032 by radaee
the most simple way is to extract whole PDF file from special location from server side.
we read special byte range from codes:
Code:
conn.setRequestProperty("Range", String.format(Locale.ENGLISH, "bytes=%d-%d", start, start + len - 1));

we better checked the codes, the whole PDF file downloading is in class HttpDownloadThread.
and seems HttpDownloadThread rewrite whole PDF file.

further more about PDFHttpStream:
if you are using PDFLayoutView or PDFGLLayoutView, java class will get all page size to measure layout.
so, all page description data(like page size) will download in opening time.
other data will download in rendering time.
More
IP: 194.28.116.213 5 years 10 months ago #15033 by robaba
Thank you for the quick response.

Ok, so from what I understand, i can add headers in that way, inside the http request.

For the other topic questions, i need to save a pdf in another filesystem position, after the pdf is fully downloaded.
Is there a way to specify the location of this download's temporary folder inside the filesystem? Or is there a way to retrieve this location and save a copy inside another location?
Am i notified of the completed download anywhere in the code?
More
IP: 93.36.222.154 5 years 10 months ago #15034 by nermeen
The pdf is saved temporarily in a folder (RDTMP), you can check PDFHttpStream.open (where the temp file is created).
There is no callback when the download is finished, but the download is handled in HttpDownloadThread.run (which calls write_cache to write to the temp file).

On closing the pdf the temp file is deleted (check PDFHttpStream.close)
Time to create page: 0.412 seconds
Powered by Kunena Forum