pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yogesh <yogesh...@gmail.com>
Subject Re: Save URLs to PDFs?
Date Fri, 05 Nov 2010 22:35:30 GMT
Following is the code and the URL.


URL url = new URL ("
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2947364/pdf/msb201055.pdf?tool=pmcentrez
");


            con = url.openConnection();


            InputStream in = con.getInputStream();



            FileWriter out = new FileWriter("C:/My.pdf");

            int next = 0;

            while ( ( next = in.read() ) != -1  ) {

             out.write(next);
            }


Thanks,


- Yogesh



On 5 November 2010 18:31, Grant Overby <grant@floorsoft.com> wrote:

> Hrm, That's odd.
>
> Can you post the code you tried? An perhaps the url?
>
>
> --
> Grant Overby
> Senior Developer
> FloorSoft, Inc.
>
> Often people, especially computer engineers, focus on the machines. They
> think, "By doing this, the machine will run faster. By doing this, the
> machine will run more effectively. By doing this, the machine will something
> something something." They are focusing on machines. But in fact we need to
> focus on humans, on how humans care about doing programming or operating the
> application of the machines. We are the masters. They are the slaves. --
> Yukihiro Matsumoto
>
>
>
>
> On Fri, Nov 5, 2010 at 6:27 PM, Yogesh <yogeshp08@gmail.com> wrote:
>
>> Yes. I can download the file through the browser. It works perfectly fine.
>>
>> - Yogesh
>>
>>
>>
>> On 5 November 2010 18:25, Grant Overby <grant@floorsoft.com> wrote:
>>
>>> If you download the file through a browser? Does it work then?
>>>
>>>
>>> --
>>> Grant Overby
>>> Senior Developer
>>> FloorSoft, Inc.
>>>
>>> Often people, especially computer engineers, focus on the machines. They
>>> think, "By doing this, the machine will run faster. By doing this, the
>>> machine will run more effectively. By doing this, the machine will something
>>> something something." They are focusing on machines. But in fact we need to
>>> focus on humans, on how humans care about doing programming or operating the
>>> application of the machines. We are the masters. They are the slaves. --
>>> Yukihiro Matsumoto
>>>
>>>
>>>
>>>
>>> On Fri, Nov 5, 2010 at 6:18 PM, Yogesh <yogeshp08@gmail.com> wrote:
>>>
>>>> I tried with that, it writes a blank PDF. Though, the file size and the
>>>> number of pages is correct (for the new written file)
>>>>
>>>> - Yogesh
>>>>
>>>>
>>>>
>>>>
>>>> On 5 November 2010 18:09, Grant Overby <grant@floorsoft.com> wrote:
>>>>
>>>>> You don't need pdfBox to do this. Below is some rough code that allows
>>>>> you
>>>>> to download a file and save it.
>>>>>
>>>>> URLConnection urlConnection = new URL("http://...");
>>>>> InputStream   in      = urlConnection.getInputStream();
>>>>> FileWriter out = new FileWriter("my.pdf");
>>>>> int next = 0;
>>>>> while ( ( next = in.read() ) != -1  ) out.write(next);
>>>>> //close everything
>>>>>
>>>>> --
>>>>> Grant Overby
>>>>> Senior Developer
>>>>> FloorSoft, Inc.
>>>>>
>>>>> Often people, especially computer engineers, focus on the machines.
>>>>> They
>>>>> think, "By doing this, the machine will run faster. By doing this, the
>>>>> machine will run more effectively. By doing this, the machine will
>>>>> something
>>>>> something something." They are focusing on machines. But in fact we
>>>>> need to
>>>>> focus on humans, on how humans care about doing programming or
>>>>> operating the
>>>>> application of the machines. We are the masters. They are the slaves.
>>>>> --
>>>>> Yukihiro Matsumoto
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Nov 5, 2010 at 5:56 PM, Yogesh <yogeshp08@gmail.com> wrote:
>>>>>
>>>>> > Hi,
>>>>> >
>>>>> > I have PDFs which I can access through URLs. I want to download
and
>>>>> save it
>>>>> > to files. How can I go about it?
>>>>> >
>>>>> > Thanks
>>>>> >
>>>>> > -Yogesh
>>>>> >
>>>>>
>>>>
>>>>
>>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message