• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Saving as pdf

 
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Using this we are not able to connect to another system which provides service. This is working properly when both client system and server on the LAN.
Thank You in advance.
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an extraction.jsp which generates an image file.This page has a 'download' button and 'close' buttons.when I click download it has to save it as pdf file(for which a function is written-shown below) when the system is on internet/intranet/LAN etc

The function is ...



-------
pdfurl is not being assigned to window.extPane.location.href and therefore it unable to call savepdf function...


Needed urgent inputs...thanks
 
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the HTML/JavaScript forum.
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the correction but i need inputs big time...

The problem is that it is working when it is in offline mode (locally,no internet)
but when online, "window.extPane.location.href =pdfURL " is not working...
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like permissions issues. Why don't you just have the server generate a pdrf file and send it down to the client and not rely on unreliable browser features.

Eric
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eric! I was desperate for someone to respond.

Why don't you just have the server generate a pdrf file

My problem is how do I do that?
Is there nothing wrong with "window.extPane.location.href =url " ?? or should i use "window.location.href" or something else...
I would take you suggestion (quickest possible one) A liitle briefing would be of great help...Thanks!
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sounds like permissions issues


Little more briefing...
I have two jsp's extract.jsp and download.jsp
In extract.jsp which has java code to call the webservice which will reutrn a ".png" image file (no permission problems even on internet) .Next step is to download this as pdf.
but in download.jsp I have written JS code but when download button is clicked , the internet connection goes off from that point...

I hope I am able to explain my issue !!!
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If extract.jsp can return a png, set it up so it can return a pdf.

 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's somehow not happening and the point I am trying to make.
While returning .pdf the internet connection goes off ... I think somehow the request doesn't go to the webserver and hence it doesn't return .pdf
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
not able to understand the issue? I would like to know how to save as pdf...i should atleast save my image file as pdf when i click download link. Any code snippets or inputs for this??
 
Sheriff
Posts: 28385
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to agree with Eric... If you can write code which downloads a PNG, then the same code with very minor changes can download a PDF. You don't need any special Javascript, either, just an ordinary link to the server URL which generates the PDF.
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok...this is the java class ..




I am just not finding that minor change here... can someone go through this a help me make a move? thanks!
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok,I tried the above way but it disturbed my whole application.So i revert back to the old code.




This works fine on LAN and intranet
but for a independent user on the internet this is causing problems.
So this same line which is showing pdf when system is on LAN and intranet is failing with system connected to internet.Where is the flaw??Urgent... thanks!

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're relying on the user's browser to be able to show PDFs. That's simply not a valid assumption to make. The browser may be set to save PDFs automatically, or display them internally with the help of a plugin, or start an external process. That's something the web app has no control over.
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that's the best practise,I wish I had time to do that but right now I think I have to stick to this...

small snippet to bring more clarity...



output...
-------------


The imgFile is /maps/4772.pdf
the udpath is : D:\workspace_final\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\GoaGis\maps\4772.pdf
in forPrint option


---------------

I have to get this file location (in web server) and put it in client/end user system...
How do I take it from this and display it on end user system who is on his own internet? When he uses his internet and accesses the site he is requesting the web server on the LAN but the pdf which is available on the LAN is not being passed on to the enduser...

Issue with tomcat?
//// instead of // for url?
breaking my head with this...
I hope I made it clear
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add on :

In the struts.xml side I am directing it to a page...It is not going to that page even after success....
 
reply
    Bookmark Topic Watch Topic
  • New Topic