Using a servlet to read a pdf file that is in remote server

Hi,
I read some topics about how to read a pdf file using a servlet...but my issue is that my pdf files are on a remote Sun solaris server (intranet) and my servlet will be in a public network (internet), so my question is, still be possible to use this solution to read my remote file ? how i can access the remote file ??
any idea from where I can start ??
best regards,
carlos.

You may use a FTP client component to connect with your servlet to the Sun server, retrieve the bytes and serve them to the browser. Instead of reading the stream from a local file, you will be reading from a network socket, but the code -if well written and designed- may be very similar.
There are many good ftp client components for java, you may also use other protocols like HTTP or SCP (ssh file transfer).
Regards,
Martin Cordova
http://www.martincordova.com
Dinamica framework for J2EE
- the easiest way to Java webapps...

Similar Messages

  • Sql loader issue(How to specify a file that exists on remote server)

    In sqlldr infile parameter I'd like to give a data file that exists on remote server.How can I specify???Please help me in the syntax.
    Any help would be greatly appreciated.
    Edited by: 792353 on Sep 24, 2010 7:22 AM

    sqlldr can accept any path that is VALID and it can be any type of share as long as the OS supports the share.
    so INFILE can be anything you want as sqlldr will simply attempt to access it via the OS.
    if you are on a linux box going to another linux box with an NSF mount point on the box running sqlldr simply reference:
    INFILE '/mountpoint/fname'
    Now I have never tried a UNC path before but I would guess that if you are on a windows box, going to another winddows box and the box running sqlldr was logged in with the right permissions it would simply be:
    INFILE '\\server\directory\file'
    I doubt that it will accept a URL as in:
    INFILE '//servername.com/directory/file'
    I don't think that sqlldr does anonymous ftp or htp file transfer protocol, but I could be wrong.
    NOTE: I have found that it is best to ALWAYS surround your INFILE parameter with single quotes.

  • Read the pdf file from the Third party server.

    hi all,
    we got the requirement that we have to display the salary statement and form16 in the portal.
    we are not using the sap for the pay roll.
    pay roll will run by the third party....they will keep all salary slips in the one folder under the server.
    so from the third party server we have to get the salary statement in to our application......third party will storing the file with salcode.pdf.
    can you help me to resolve this?
    Thanks in advance
    swapna

    Hi yugedhar,
    thank you for the reply.
    the pdf files will be available in one common folder , with in the server only.
    so i have to implement the code to download the file from the one particular location based on the name of the file
    (means if  file name =Login id that has to open)
    so can you help me implement this logic .
    Thank you
    swapna

  • Reading/writing PDF files using JAVA

    how to read/write a PDF file using java,
    while i read a pdf file using BUfferedReader class it gives a list of char. which is not readable.
    how to convert those files to readable format.?
    is there any special class for doin that.?
    plz explain..?

    is there any special class for doin that.?Yes, I'm sure Google knows a few libraries that ca do that.

  • Problem using images of CMYK colorspace in PDF file

    I am reading a PDF file that contains an image with CMYK colorspace, I am reading the image data correctly but couldn't convert it to RGB color space, as I need to display this image in my own application so please tell me how can I convert it to RGB color space or how can I display it by remaining in the CMYK colors pace. Any help will be highly appreciated.
    Regards,
    Ali

    Adobe Reader will convert for display, there should be no problem if you use Adobe Reader. Adobe Reader will use the CMYK profile from the PDF, or your default profile, and will convert to your default RGB profile for display.

  • Why can't I open/see PDF files that are embedded in an email or sent through the internet?

    I can read/see PDF files that are attached to an email, but I can't see/read them if they are embedded in an email or sent through the internet.

    I have a similar problem. I can open, read, and save PDF files, but I can't view my online bank statement on my Mac. The statement opens automatically if I use a PC, but on my Mac the page says I need Adobe Reader to view my statement. I already have the latest version of Adobe Reader. The problem seems to be that that the plugin only goes to the Libray. It doesn't get installed into Safari or into FireFox either.

  • Using servlets to read from text file and insert data

    Hi,
    Can I use a servlet to read from a space delimited text file on the client computer and use that data to insert into a table in my database? I want to make it easy for my users to upload their data without having to have them use SQL*Loader. If so can someone give me a hint as how to get started? I appreciate it.
    Thanks,
    Colby

    Create a page for the user to upload the file to your webserver and send a message (containing the file location) to a server app that will open the file, parse it, and insert it into your database. Make sure you secure the page.
    or
    Have the user paste the file into a simple web form that submits to a servlet that parses the data and inserts it into your db.

  • Adobe Reader Splash--I have a PDF file that whenever I try to open it suggests using Adobe Reader with a link to download Adobe Reader...

    Adobe Reader Splash--I have a PDF file that whenever I try to open it suggests using Adobe Reader with a link to download Adobe Reader. I can't get beyond this. I have made Preview the default for all PDF's and yet this persists. I have also deleted Adobe Reader. This particular file is a portfolio, btw.

    I have similar issue. Did u find an answer?

  • How read a pdf file and change TableCell height after reading it using itext api

    I have created a pdf form file using itext ( see class CreatingFormClass ) with itext PdfPTable and PdfPCell. It is done successfully .
    Now I  read this pdf file and filling this pdf file(see class FillingFormClass  ) and at this point i want to change  PdfPCell height () according to Items.
    It is possible or Not???
    My code is given below.
    Thanx in advance
    public class FillPdfFormMainClass {
    public static  String RESULT1 = "E:/BlankForm.pdf";
        public static  String RESULT2 = "E:/FilledForm.pdf";
        public static void main(String[] args) throws DocumentException, IOException {
            String empName="Rakesh Kumar Verma";
                    // This part is Dynamic. It can be 1 item Or can be 25 items
            String listOfItem="Item 1 \n Item 2 \n Item 3\n Item 4 \n Item 5 \n Item 6 \n Item 7 \n Item 8 \n Item 9";
            CreatingFormClass example = new CreatingFormClass(0);
            example.createPdf(RESULT1);
            FillingFormClass class1 = new FillingFormClass();
            class1.manipulatePdf(RESULT1, RESULT2,empName,listOfItem);
    public class CreatingFormClass implements PdfPCellEvent {
        protected int tf;
        public CreatingFormClass(int tf) {
            this.tf = tf;
        public void createPdf(String filename) throws DocumentException, IOException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(filename));
            document.open();
            PdfPCell cell;
            PdfPTable table = new PdfPTable(2);
            table.setWidths(new int[]{1, 2});
            table.addCell("Name:");
            cell = new PdfPCell();
            cell.setCellEvent(new CreatingFormClass(1));
            table.addCell(cell);
            table.addCell("Item List:");
            cell = new PdfPCell();
            cell.setCellEvent(new CreatingFormClass(2));
            cell.setFixedHeight(60);
            table.addCell(cell);
            document.add(table);
            document.close();
        public void cellLayout(PdfPCell cell, Rectangle rectangle, PdfContentByte[] canvases) {
            PdfWriter writer = canvases[0].getPdfWriter();
            TextField text = new TextField(writer, rectangle, String.format("text_%s", tf));
            text.setBackgroundColor(new GrayColor(0.95f));
            switch (tf) {
                case 1:
                    text.setText("Enter your name here...");
                    text.setFontSize(8);
                    text.setAlignment(Element.ALIGN_CENTER);
                    break;
                case 2:
                    text.setFontSize(8);
                    text.setText("Enter Your Address");
                    text.setOptions(TextField.MULTILINE);
                    break;
            try {
                PdfFormField field = text.getTextField();
                writer.addAnnotation(field);
            } catch (IOException ioe) {
                throw new ExceptionConverter(ioe);
            } catch (DocumentException de) {
                throw new ExceptionConverter(de);
    public class FillingFormClass {
        public void manipulatePdf(String src, String dest,String empName,String listOfItem) throws IOException, DocumentException {
            PdfReader reader = new PdfReader(src);
            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(String.format(dest, empName)));
            AcroFields form = stamper.getAcroFields();
            form.setField("text_1", empName);
            form.setField("text_2", listOfItem);
            stamper.close();
            reader.close();

    Hi,
    I am facing the same problem. Please help me out. I just want to read a PDF file as bytes from one location and write it as another pdf file in some other location with a diolog box prompting to open or save in the location where we want.
    I executed the following code:
    try{
    File report =new File(location);
    BufferedInputStream in=new BufferedInputStream(new FileInputStream(report));
    response.setContentType("application/x-download");
    response.setHeader("Content-Disposition", "attachment; filename=" + report.getName());
    OutputStream outs = response.getOutputStream();
    int readlen;
    byte buffer[] = new byte[ 256 ];
    while( (readlen = in.read( buffer )) != -1 )
    outs.write( buffer, 0, readlen );
    outs.flush();
    outs.close();
    in.close();
    response.setStatus(HttpServletResponse.SC_OK);
    } catch (FileNotFoundException fileNotFoundException) {
    PrintWriter out= response.getWriter();
    out.print("<center><Font color = 'RED'><b>"+PxDSLUtils.getApplicationProperty("label.error.CTM_E017")+"</b></Font></center>");
    Though it prompts with open, save dialog box when i try to open directly or when i save it some where locally and then open it i am getting the following message " File is repaired ot damaged.Operation failed." Any idea about what can be done??? Its very urgent.Please suggest.
    I am not convetin to string just reading and writng as bytes itself.
    Thanks in advance,
    Mani

  • I have installed Adobe Reader 11.0.07 for Mac OS 10.9.3. Have asked this question numerous time without results. The problems I am having are: I cannot scroll using the side slider on downloaded PDF files, nor can I fill in fillable files. Also, and this

    I have installed Adobe Reader 11.0.07 for Mac OS 10.9.3. Have asked this question numerous time without results. The problems I am having are: I cannot scroll using the side slider on downloaded PDF files, nor can I fill in fillable files. Also, and this is extremely irritating, I cannot re-initialize the same file or initialize and another PDF file after I have initialized the first file. If you cannot help please let me know if should use an earlier  version of Reader or find anther company that has the appropriate software.

    Perhaps you missed that you started a discussion at I have OS 10.9.2 and have downloaded latest version of Reader 11. I can no longer fill in form or scroll using the side bar. and you did not respond to the last post there.

  • Can not read my pdf files can i use adobe ?

    I can not read my pdf files and need to download adobe ,can you help please .

    In order to read the pdf either you need Acrobat or Adobe Reader,
    Acrobat is a paid software and used to read and edit the pdf files.
    Reader is the free software used to just read the pdf files.
    To download reader use this link:- http://get.adobe.com/reader/

  • How to read from pdf file using VB

    I have a PDF file which contains three columns, emp no, designation, contact_info. I have 10 rows in that pdf file. I want to read row by row from the pdf file and write into another text file(tab delimited) using VB.
    Could you please help me reading the pdf file?
    Thanks,
    Arindam

    Without reading it in detail, this seems to be automating a save as text function in Acrobat. This will not give you any position information.
    If you want position information without writing a plug-in, you need to use the getPageNthWord and getPageNthWordQuads methods in JavaScript.
    If you have not already done so, you will need to download the Acrobat SDK which has the documentation you need.
    Writing in C# makes even very simple things complicated; if you have a choice, consider VB.

  • Using Adobe Reader for PDF Files

    I am having a heck of a problem using Adobe Reader to open PDF files.
    Work very well until last week when I downloaded the upgrade for the program. I had been using Adobe5 (6), upgraded to Adobe Reader 9. Now, I can not open a pdf file that is sent to me. Nor, can I save a file into the PDF format.
    I have done the pass word, permission thing, have removed the Adobe 9 from the hard drive and than reloaded it.
    Still have the same problems.
    Does anyone have any suggestions that they would be willing to provide that might get me back into business?

    Well up front I would like to thank all of you that responded, and tell you that I am sorry that I have not posted back. But, I have been trying to incorporate and to ensure that I have been following the suggestions that you have provided.
    Let me provide a bit more of information:
    I am trying to safe a chart from the Reunion Family program, which I have been using for a few years.
    I did save one Descendant chart and was able to send it to a group of the family as a PDF file. This was using adobe 5. After I sent that chart, I upgraded the adobe 5 software to adobe reader 9. Since the upgrade I have not been able to save a chart in the Graphic File.pdf. The file saves but when I open the file it is a one page blank document. However, I can go into preferences and by changing the view size, it will show the entire document (sometimes). I tried to save that document and send it, but the people who receive it stated that it comes as a blank page. I also, saved the file as a JPEG and sent it, but the people stated that it comes as a very narrow column, unreadable, and can not be open.
    I have went back and removed the installed upgrade and started from scratch, I am using the correct software package, and after uploading it, I do run the permissions program.
    So, once again I am trying to obtain some knowledge on how to safe the descendant file as a PDF file and send it by e mail.
    It is driving me crazy-and once again proves that the machine is much smarter than I.
    Any help would be appreciated.

  • Reading a pdf file from URL into Byte array/ByteBuffer in an applet.

    I'm trying to figure out why this particular snippet of code isn't working for me. I've got an applet which is supposed to read a .pdf and display it with a pdf-renderer library, but for some reason when I read in the .pdf files which sit on my server, they end up as being corrupt. I've tested it by writing the files back out again.
    I've tried viewing the applet in both IE and Firefox and the corrupt files occur. Funny thing is, when I trying viewing the applet in Safari (for Windows), the file is actually fine! I understand the JVM might be different, but I am still lost. I've compiled in Java 1.5. JVMs are 1.6. The snippet which reads the file is below.
    public static ByteBuffer getAsByteArray(URL url) throws IOException {
            ByteArrayOutputStream tmpOut = new ByteArrayOutputStream();
            URLConnection connection = url.openConnection();
            int contentLength = connection.getContentLength();
            InputStream in = url.openStream();
            byte[] buf = new byte[512];
            int len;
            while (true) {
                len = in.read(buf);
                if (len == -1) {
                    break;
                tmpOut.write(buf, 0, len);
            tmpOut.close();
            ByteBuffer bb = ByteBuffer.wrap(tmpOut.toByteArray(), 0,
                                            tmpOut.size());
            //Lines below used to test if file is corrupt
            //FileOutputStream fos = new FileOutputStream("C:\\abc.pdf");
            //fos.write(tmpOut.toByteArray());
            return bb;
    }I must be missing something, and I've been banging my head trying to figure it out. Any help is greatly appreciated. Thanks.

    Keshav.. wrote:
    I too was going through the same problem but I found for some pdfs it worked fine.I didnt get ur solution.Please explain bcoz it may work for every pdfThis thread is over 3 years old and dead. Please open a new thread which provides details of the problem you are having. Link to this thread if you think it is necessary.
    I shall lock this thread.

  • Recently my adobe is taking much longer to load PDF files that used to open immediately

    recently my adobe is taking much longer to load PDF files that used to load almost instantly

    Look at this comprehensive trouble shooting document;
    https://discussions.apple.com/docs/DOC-3353
    I suggest that you start with SMC and PRAM resets.
    Then  a Safe Boot.
    Ciao.

Maybe you are looking for

  • Start the Oracle 9i R2 in Mandrake 8.2

    Hi All, I'd intalled a 9 R2 on Mandrake 8.2 and the databes was created. But I can't start the database. How could do this? When I run oemapp dbastudio the databes doesn't starts automaticaly? As in Win? Are some srcipt or something else to automate

  • Windows xp local printers offline

    Hi, We are currently in a queue-based-printing environment and are rolling out Windows XPSP2 to our users. The problem we are having is that when we add a local printer and configure that printer's port to use the Novell Print queue, the local printe

  • Contribute 4 - Need to create new Admin / do not have old Admin password

    Hi - I have all of my connections set to the site in which I am working, but cannot edit any additional pages that I am adding to the site. I am able to add the page, add the image or whatever, but cannot edit. An error shows up and tells me to conta

  • Item category not defined

    Hi gurus, My client need help to ship some parts. He creates the delivery (VL01N) And when we enter the batch we have an error message appearing : Item category is not defiened. I check in the sales order and everything is ok (item category ZXXX for

  • Image Resizer and Uploader

    I am new to Flex, and I have (so far) only developed two other applications using Flex. I am having a really difficult time with this issue. I've tried everything (except for creating a class) that I can think of to resolve this issue, and I'm runnin