Google Map Module and JavaScript-only PDF viewer component | GSOC2010

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Charith Madusanka
*Proposal Title:*

Google Map Module and JavaScript-only PDF viewer component


*Student Name:*

Charitha Madusanka Elvitigala

*
*

*Student E-mail:*

[hidden email]

*
*

*Organization*

Apache Tapestry

*
*

*Project Assigned Mentor*:

Thiago H. de Paula Figueiredo

Ulrich Stärk

*
*

*Proposal Abstract:***

Apache Tapestry is an open source java framework. Tapestry component make
easer to developers creating dynamic, robust, highly scalable web
applications in Java.Google Map component provides an interface to the
Google map API with Tapestry5. PDF viewer component provide to Tapestry user
view PDF document through the web browser. Both components are mainly based
on Java Script.

*
*

*Deliverables*


   - Implementation of Google Map component
   - Implementation of JavaScript-only PDF viewer component
   - Documentation to support continuation of the project



*Overview*

*
*

*Google Map component***

            This component provide users to a clickable map for entering
latitude and longitude as well as it can  add content to the map through a
variety of services, allowing you to create robust maps applications on your
T5 web application.

Google Map component can be used to create interactive maps with various map
markers. I’m hoping to implement this module by using Tapestry5 Ajax package
and Java Script (Tapestry5AndJavaScriptExplained) make an interaction with
Google Map API.



*JavaScript-only PDF viewer component*

            These components allow to viewing PDF file directly in web
browser .Now look at my implementation of this component. One of the
effective and powerful way to view PDF in web browser by using Java Script.

            My implementation includes classes, object and method that
enable you to easily manipulate PDF file, provide database connections and
other use full things. To render PDF, I will do render the whole document at
once and cache the pages, then contents shown to the user. Ajax is used to
load the content asynchronously.



*Project Plan*

*I have planned the project under 4 steps as follows*

*Step 1: Initial Planning and Designing*

*I will look at both Tapestry 5 framework Google map API then will create a
basic design for Google map component.** *In* *PDF viewer component I will
design all the Java Script classes, method and workflows. **

Estimated Completion: 23ed May 2010* *

*Step 2: Implementation*

I would start working on the code. Deliverable(s): Prototype and
documentation for mid evaluation

Estimated Completion: 11th July 2010**

*Step 3: Improvements and Testing*

Modifications or improvements suggested at the mid evaluation would be
completed in this step. Write unit tests for finished segments and Test
Component.

Estimated Completion: 9th August 2010**

*Step 4: Final Product and Documents*

With the completion of this step, will finish the Google Map Component and
JavaScript-only PDF viewer component for T5. Necessary documents would also
be present with the final products. Deliverable(s): Final products and
documentation.



*Biography*

I am Charitha Madusaka Elvitigal 2rd year Computer Science undergraduate of
University of Colombo School of Computing (UCSC), Sri Lanka. I have been
involved in Open Source development regarding Web Services based on Apache,
java and Java Script.
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Charith Madusanka
Hi all ,

I need comments about my proposal.........

Charith

On Thu, Apr 8, 2010 at 11:10 PM, Charith Madusanka <[hidden email]>wrote:

> *Proposal Title:*
>
> Google Map Module and JavaScript-only PDF viewer component
>
>
> *Student Name:*
>
> Charitha Madusanka Elvitigala
>
> *
> *
>
> *Student E-mail:*
>
> [hidden email]
>
> *
> *
>
> *Organization*
>
> Apache Tapestry
>
> *
> *
>
> *Project Assigned Mentor*:
>
> Thiago H. de Paula Figueiredo
>
> Ulrich Stärk
>
> *
> *
>
> *Proposal Abstract:***
>
> Apache Tapestry is an open source java framework. Tapestry component make
> easer to developers creating dynamic, robust, highly scalable web
> applications in Java.Google Map component provides an interface to the
> Google map API with Tapestry5. PDF viewer component provide to Tapestry
> user view PDF document through the web browser. Both components are mainly
> based on Java Script.
>
> *
> *
>
> *Deliverables*
>
>
>    - Implementation of Google Map component
>    - Implementation of JavaScript-only PDF viewer component
>    - Documentation to support continuation of the project
>
>
>
> *Overview*
>
> *
> *
>
> *Google Map component***
>
>             This component provide users to a clickable map for entering
> latitude and longitude as well as it can  add content to the map through a
> variety of services, allowing you to create robust maps applications on your
> T5 web application.
>
> Google Map component can be used to create interactive maps with various
> map markers. I’m hoping to implement this module by using Tapestry5 Ajax
> package and Java Script (Tapestry5AndJavaScriptExplained) make an
> interaction with Google Map API.
>
>
>
> *JavaScript-only PDF viewer component*
>
>             These components allow to viewing PDF file directly in web
> browser .Now look at my implementation of this component. One of the
> effective and powerful way to view PDF in web browser by using Java Script.
>
>             My implementation includes classes, object and method that
> enable you to easily manipulate PDF file, provide database connections and
> other use full things. To render PDF, I will do render the whole document at
> once and cache the pages, then contents shown to the user. Ajax is used to
> load the content asynchronously.
>
>
>
> *Project Plan*
>
> *I have planned the project under 4 steps as follows*
>
> *Step 1: Initial Planning and Designing*
>
> *I will look at both Tapestry 5 framework Google map API then will create
> a basic design for Google map component.** *In* *PDF viewer component I
> will design all the Java Script classes, method and workflows. **
>
> Estimated Completion: 23ed May 2010* *
>
> *Step 2: Implementation*
>
> I would start working on the code. Deliverable(s): Prototype and
> documentation for mid evaluation
>
> Estimated Completion: 11th July 2010**
>
> *Step 3: Improvements and Testing*
>
> Modifications or improvements suggested at the mid evaluation would be
> completed in this step. Write unit tests for finished segments and Test
> Component.
>
> Estimated Completion: 9th August 2010**
>
> *Step 4: Final Product and Documents*
>
> With the completion of this step, will finish the Google Map Component and
> JavaScript-only PDF viewer component for T5. Necessary documents would also
> be present with the final products. Deliverable(s): Final products and
> documentation.
>
>
>
> *Biography*
>
> I am Charitha Madusaka Elvitigal 2rd year Computer Science undergraduate of
> University of Colombo School of Computing (UCSC), Sri Lanka. I have been
> involved in Open Source development regarding Web Services based on Apache,
> java and Java Script.
>
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Charith Madusanka
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Charith Madusanka
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

akochnev
Charith,
   it seems to me that with the Javascript PDF viewer you might be biting
more than you can chew. PDF is not a very pleasant format to deal with, and
in order to view it only in Javascript/HTML you'll need to convert the PDF
to images. I few years ago I was doing something similar, and it was neither
pretty nor pleasant. Alternatively, there seem to be a few ways to convert a
PDF file to flash, but then your component is not going to be "javascript
only".

   Anyway, maybe you could shed some light on how you plan to deal with
this. It also seems like you're kinda new to Tapestry and there's a few
things to learn there as well. Considering that you only have a few short
months for this, it might be wise to pick something more realistic that
doesn't require major inventions in just a couple of months.

Regards,

Alex K

On Fri, Apr 9, 2010 at 10:26 PM, Charith Madusanka <[hidden email]>wrote:
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Ben Gidley
Administrator
Do you mean you are planning on using
https://docs.google.com/viewer

This is googles embedable PDF viewer. It should be relatively simple to
write a tapestry control that uses it.
 <https://docs.google.com/viewer>
Ben Gidley

www.gidley.co.uk
[hidden email]


On Sat, Apr 10, 2010 at 3:41 AM, Alex Kotchnev <[hidden email]> wrote:

> Charith,
>   it seems to me that with the Javascript PDF viewer you might be biting
> more than you can chew. PDF is not a very pleasant format to deal with, and
> in order to view it only in Javascript/HTML you'll need to convert the PDF
> to images. I few years ago I was doing something similar, and it was
> neither
> pretty nor pleasant. Alternatively, there seem to be a few ways to convert
> a
> PDF file to flash, but then your component is not going to be "javascript
> only".
>
>   Anyway, maybe you could shed some light on how you plan to deal with
> this. It also seems like you're kinda new to Tapestry and there's a few
> things to learn there as well. Considering that you only have a few short
> months for this, it might be wise to pick something more realistic that
> doesn't require major inventions in just a couple of months.
>
> Regards,
>
> Alex K
>
> On Fri, Apr 9, 2010 at 10:26 PM, Charith Madusanka <[hidden email]
> >wrote:
>
> > Hi all,
> >
> > Project Reference Link.......
> >
> > http://code.google.com/apis/ajax/
> > http://code.google.com/apis/maps/
> > http://wiki.apache.org/tapestry/FrontPage
> > http://en.wikipedia.org/wiki/JavaScript
> >
> > charith
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Ulrich Stärk-4
Yeah, but that's not what Thiago and I had in mind. We'd rather want some kind of Tapestry service
that renders the PDF to images and a JavaScript control that communicates with that service and
shows the pages to the user.

Uli

On 10.04.2010 08:14, Ben Gidley wrote:

> Do you mean you are planning on using
> https://docs.google.com/viewer
>
> This is googles embedable PDF viewer. It should be relatively simple to
> write a tapestry control that uses it.
>   <https://docs.google.com/viewer>
> Ben Gidley
>
> www.gidley.co.uk
> [hidden email]
>
>
> On Sat, Apr 10, 2010 at 3:41 AM, Alex Kotchnev<[hidden email]>  wrote:
>
>> Charith,
>>    it seems to me that with the Javascript PDF viewer you might be biting
>> more than you can chew. PDF is not a very pleasant format to deal with, and
>> in order to view it only in Javascript/HTML you'll need to convert the PDF
>> to images. I few years ago I was doing something similar, and it was
>> neither
>> pretty nor pleasant. Alternatively, there seem to be a few ways to convert
>> a
>> PDF file to flash, but then your component is not going to be "javascript
>> only".
>>
>>    Anyway, maybe you could shed some light on how you plan to deal with
>> this. It also seems like you're kinda new to Tapestry and there's a few
>> things to learn there as well. Considering that you only have a few short
>> months for this, it might be wise to pick something more realistic that
>> doesn't require major inventions in just a couple of months.
>>
>> Regards,
>>
>> Alex K
>>
>> On Fri, Apr 9, 2010 at 10:26 PM, Charith Madusanka<[hidden email]
>>> wrote:
>>
>>> Hi all,
>>>
>>> Project Reference Link.......
>>>
>>> http://code.google.com/apis/ajax/
>>> http://code.google.com/apis/maps/
>>> http://wiki.apache.org/tapestry/FrontPage
>>> http://en.wikipedia.org/wiki/JavaScript
>>>
>>> charith
>>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Charith Madusanka
Hi Uli,

Now looking Interface RenderSupport  package , I think it can be use full
to enders the PDF to images and  shown to the user. This package support to
all T5 component that render and also help to JavaScript generation.

Interface RenderSupport(
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/RenderSupport.html
),

cheers

charith
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Thiago H. de Paula Figueiredo
On Sun, Apr 11, 2010 at 12:32 AM, Charith Madusanka
<[hidden email]> wrote:
> Hi Uli,

Hi!

> Now looking Interface RenderSupport  package , I think it can be use full
> to enders the PDF to images and  shown to the user.

I'm not following you. I can't see anything in RenderSupport that
would help render or stream images to be shown to the user. Rendering
should be done by Java code, using code you'll write or some open
source package that does it. Streaming content to the user should be
done by a StreamResponse or a Dispatcher.

--
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Charith Madusanka
Hi ,

 I can't see anything in RenderSupport that
> would help render or stream images to be shown to the user.



Yes, It is true that it is unable to render the PDF into image and show ti
the user by using RenderSupport. I tried to render the PDF into image by
using JavaScript with the support of RenderSupport to built my
component "JavaScript-only
PDF viewer".I have given my fully capacity to do it in my way,but ultimately
my total attempt became a waste. But finally I studied something which is
very advantage.

Now I am on the right path to render PDF into image by using Java2D. Java
swinglabs provide PDF rendering library called Java PDF render (
https://pdf-renderer.dev.java.net/). This library has a class called
PDFRenderer (
https://pdf-renderer.dev.java.net/nonav/demos/latest/javadoc/index.html) and
it turns a set of PDF Commands from a PDF page into an image.

I am not pretty sure that above class can be used directly for my
implementations. I think I have to do some customization class or rebuilding
class towards compatible T5. Show the pages to the user easily done by
 using StreamResponse.

thanx,

charith
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Charith Madusanka

Hi ,

I'm writing simple Java program render PDF file to Images by using  Java PDF render  library. Code is given below and attach to the mail,


import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import javax.imageio.ImageIO;
import com.sun.pdfview.PDFFile;
import com.sun.pdfview.PDFPage;

public class RenderPDF2Image {

    public static void main(String[] args) {

        File file = new File("file.pdf");
        RandomAccessFile randomFile;

        try {

            randomFile = new RandomAccessFile(file, "r");
            FileChannel channel = randomFile.getChannel();
            ByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
            PDFFile pdffile = new PDFFile(buffer);
            int numberOfPages = pdffile.getNumPages();

            for (int i = 0; i < numberOfPages; i++) {

                PDFPage page = pdffile.getPage(i);
                int pageWidth = (int) page.getBBox().getWidth();
                int pageHeight = (int) page.getBBox().getHeight();
                Rectangle rectangle = new Rectangle(0, 0, pageWidth, pageHeight);
                Rectangle rectangle2DClip = rectangle;

                BufferedImage image;
                image = (BufferedImage) page.getImage(rectangle.width, rectangle.height, rectangle2DClip, null, true, true);

                // Output PDF to png
                ImageIO.write(image, "png", new File("image" + i + ".png"));
                // Output PDF to gif
                ImageIO.write(image, "gif", new File("image" + i + ".gif"));
                // Output PDF to jpg 
                ImageIO.write(image, "jpg", new File("image" + i + ".jpg"));
            }

        } catch (FileNotFoundException e1) {

            System.out.println(e1.getLocalizedMessage());

        } catch (IOException e) {

            System.out.println(e.getLocalizedMessage());

        }
    }
}




charith



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Charith Madusanka
Hi ,

If any one can tell me , this method is ok for render PDF file to Images ?

charith
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

akochnev
Charith,
   seems like as long as it works, it should be OK. One issue to investigate
is whether you actually need a java.io.File to do this or not. I for one
can't do much w/ java.io.File when my app is running in Google App Engine,
so I ideally I'd like to be able to do the same from a regular input stream
or a byte array (or something similar). Of course, my needs might not be
what the majority of the users would need.

Regards,

Alex K

On Tue, Apr 13, 2010 at 5:17 AM, Charith Madusanka <[hidden email]>wrote:

> Hi ,
>
> If any one can tell me , this method is ok for render PDF file to Images ?
>
> charith
>
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Charith Madusanka
Hi Alex,

One issue to investigate is whether you actually need a java.io.File to do
> this or not.


 I think is not, You can generate pdf using another method.

charith.
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Charith Madusanka
hi Uli ,

What do you think my method. This method is ok for render PDF file to Images
?
if you have any suggestion please send me.

charith
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Dmitry Gusev
In reply to this post by akochnev
Alex,

In Google App Engine you may get another problem, the one associated with
Java 2D.

Check this issue as a reference:
http://code.google.com/p/googleappengine/issues/detail?id=1423

On Tue, Apr 13, 2010 at 21:11, Alex Kotchnev <[hidden email]> wrote:

> Charith,
>   seems like as long as it works, it should be OK. One issue to investigate
> is whether you actually need a java.io.File to do this or not. I for one
> can't do much w/ java.io.File when my app is running in Google App Engine,
> so I ideally I'd like to be able to do the same from a regular input stream
> or a byte array (or something similar). Of course, my needs might not be
> what the majority of the users would need.
>
> Regards,
>
> Alex K
>
> On Tue, Apr 13, 2010 at 5:17 AM, Charith Madusanka <[hidden email]
> >wrote:
>
> > Hi ,
> >
> > If any one can tell me , this method is ok for render PDF file to Images
> ?
> >
> > charith
> >
>



--
Dmitry Gusev

AnjLab Team
http://anjlab.com
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

akochnev
Dmitry,
   good tip !

Thanks,

Alex K

On Wed, Apr 14, 2010 at 3:28 AM, Dmitry Gusev <[hidden email]>wrote:

> Alex,
>
> In Google App Engine you may get another problem, the one associated with
> Java 2D.
>
> Check this issue as a reference:
> http://code.google.com/p/googleappengine/issues/detail?id=1423
>
> On Tue, Apr 13, 2010 at 21:11, Alex Kotchnev <[hidden email]> wrote:
>
> > Charith,
> >   seems like as long as it works, it should be OK. One issue to
> investigate
> > is whether you actually need a java.io.File to do this or not. I for one
> > can't do much w/ java.io.File when my app is running in Google App
> Engine,
> > so I ideally I'd like to be able to do the same from a regular input
> stream
> > or a byte array (or something similar). Of course, my needs might not be
> > what the majority of the users would need.
> >
> > Regards,
> >
> > Alex K
> >
> > On Tue, Apr 13, 2010 at 5:17 AM, Charith Madusanka <
> [hidden email]
> > >wrote:
> >
> > > Hi ,
> > >
> > > If any one can tell me , this method is ok for render PDF file to
> Images
> > ?
> > >
> > > charith
> > >
> >
>
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Charith Madusanka
hi Uli and Thiago ,

What do you think about this method. Is this method is ok for render PDF
file to Images ?
if you have any suggestion please send me.It's great help to me.

Thank you,

charith
Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Thiago H. de Paula Figueiredo
On Thu, 15 Apr 2010 00:56:00 -0300, Charith Madusanka  
<[hidden email]> wrote:

> hi Uli and Thiago ,

Hi!

> What do you think about this method. Is this method is ok for render PDF
> file to Images ?

I think that's the only viable way of doing it without delegating the  
rendering to Google.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Google Map Module and JavaScript-only PDF viewer component | GSOC2010

Piero Sartini-3
maybe PDFBox could be used?

-> http://pdfbox.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

12