Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

Open PDF from url with headers and custom location 3 years 11 months ago #15029

  • robaba
  • robaba's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 7
  • Thank you received: 0
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?

Please Log in or Create an account to join the conversation.

Open PDF from url with headers and custom location 3 years 11 months ago #15030

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
--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).

Please Log in or Create an account to join the conversation.

Open PDF from url with headers and custom location 3 years 11 months ago #15031

  • robaba
  • robaba's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 7
  • Thank you received: 0
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

Please Log in or Create an account to join the conversation.

Open PDF from url with headers and custom location 3 years 11 months ago #15032

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
the most simple way is to extract whole PDF file from special location from server side.
we read special byte range from codes:
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.

Please Log in or Create an account to join the conversation.

Open PDF from url with headers and custom location 3 years 11 months ago #15033

  • robaba
  • robaba's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 7
  • Thank you received: 0
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?

Please Log in or Create an account to join the conversation.

Open PDF from url with headers and custom location 3 years 11 months ago #15034

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
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)

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum