JavaCode able to Read 1 PDF but not another PDF.

Hi,
I am using itext-1.3.jar for reading PDF values through Java Program.Following is the code I used:
package A;
import java.io.ByteArrayOutputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import java.util.*;
import com.lowagie.text.pdf.*;
import com.lowagie.text.pdf.AcroFields;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
public class ReadPDF
     static ByteArrayOutputStream bytArray = new ByteArrayOutputStream();
     public static void main(String[] args)
          int pagestotal,i=1,j=1;
          HashMap fields = new HashMap();
          try {
               System.out.println("Entered try block");
               PdfReader reader = new PdfReader("C:/ReadPDF/anthem.pdf");
               System.out.println( "Tracking reader :- " + reader ) ;
               PdfStamper stamp = new PdfStamper(reader, bytArray);
               AcroFields form = stamp.getAcroFields();
               System.out.println( "Tracking form :- " + form ) ;
               fields=form.getFields();
               System.out.println("Map is "+fields);
               Set keys = fields.keySet();
               Iterator iter = keys.iterator();
               while (iter.hasNext())
                    String key = (String) iter.next();
                    System.out.println(i + " - "+ key + " - " + form.getField(key));
                    i++;
               pagestotal=reader.getNumberOfPages();
               System.out.println("total pages = "+pagestotal);
               System.out.println("size "+fields.size());
          } catch (Exception e)
               System.out.println("Exception caught");
With this Code,I am SUCCESSFULLY able to read 1 PDF ,BUT IT FAILS TO READ DATA FROM 2nd PDF.I am really not getting where is the exact problem .Please help.

Hi,
I am using itext-1.3.jar for reading PDF values through Java Program.Following is the code I used:
package A;
import java.io.ByteArrayOutputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import java.util.*;
import com.lowagie.text.pdf.*;
import com.lowagie.text.pdf.AcroFields;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
public class ReadPDF
     static ByteArrayOutputStream bytArray = new ByteArrayOutputStream();
     public static void main(String[] args)
          int pagestotal,i=1,j=1;
          HashMap fields = new HashMap();
          try {
               System.out.println("Entered try block");
               PdfReader reader = new PdfReader("C:/ReadPDF/anthem.pdf");
               System.out.println( "Tracking reader :- " + reader ) ;
               PdfStamper stamp = new PdfStamper(reader, bytArray);
               AcroFields form = stamp.getAcroFields();
               System.out.println( "Tracking form :- " + form ) ;
               fields=form.getFields();
               System.out.println("Map is "+fields);
               Set keys = fields.keySet();
               Iterator iter = keys.iterator();
               while (iter.hasNext())
                    String key = (String) iter.next();
                    System.out.println(i + " - "+ key + " - " + form.getField(key));
                    i++;
               pagestotal=reader.getNumberOfPages();
               System.out.println("total pages = "+pagestotal);
               System.out.println("size "+fields.size());
          } catch (Exception e)
               System.out.println("Exception caught");
With this Code,I am SUCCESSFULLY able to read 1 PDF ,BUT IT FAILS TO READ DATA FROM 2nd PDF.I am really not getting where is the exact problem .Please help.

Similar Messages

  • Able to read  dvd's but not cd's

    dvd's play but not cd's

    Post this question on the MacPro hardware forum since it likely has nothing to do with iTunes.
    If it truly doesn't play any CDs at all then probably it's the optical drive. I believe it uses different components to play CDs vs. DVDs and part of it could be broken.

  • Function module - HR_TIME_RESULTS_GET :Able to read cluster ZES but not ZL

    Hi,
    We have an employee record where previously is successfully evaluated
    until 22 Aug 2007.
    The user made a change that is dated effective from Jul 2001.
    Thus the record is re-evaluated starting from Jul 2001 again.
    An evaluation error is hit on 14 Jun 2005.
    The cluster result for the months after Jun 2005 still remains.
    When we use the function HR_TIME_RESULTS_GET, we can retrieve the
    cluster table ZES for the month Aug 2007.
    However, we are not able to do so for cluster ZL using the same
    function.
    Any idea ?
    Thanks.

    Solved it another way by using a local variable and changing the flag when it goes in the loop and when it doesn't
    FLAG = 0.
    CALL FUNCTION 'HR_TIME_RESULTS_GET'
       EXPORTING
         get_pernr = PERNR-PERNR
         get_pabrj = it_t549q-pabrj
         get_pabrp = it_t549q-pabrp
       TABLES
         GET_TBUFF     = TGETBUFF
         get_zl = it_zl
         get_pt = it_PT
         get_alp = it_ALP
         get_c1 = it_C1
       EXCEPTIONS
         no_period_specified = 1
         wrong_cluster_version = 2
         no_read_authority = 3
         cluster_archived = 4
         technical_error = 5.
      LOOP AT it_pt.
             FLAG = 1.
             DO stuff with the data...
      ENDLOOP.
      If Flag =0.
        DO STuff with Empty Table...
      End if
    Message was edited by:
            Anwarul Kabir

  • Can I be able to read a pdf format on my blackberry?

    Can I be able to read a pdf format on my blackberry? Is there a program that will be able to do that?
    Please give me Kudos if you feel like I helped you
    Thank you
    cuse165

    Hello,
    Just to add to the good information above, the native PDF reader that is included with the BB is part of the email attachment service. For as long as the PDF remains an email attachment, it can be rendered on the device. Once detached from the email (e.g., saved to the BB somewhere), the attachment service will no longer be in play...and there is no other native method to render a PDF. Hence, add-on apps are required for that circumstance. The standard ToGo apps that come with many BBs do not include the PDF reader component -- their premium version (paid) does. There are other add-on apps as well. But, if the only method of receiving a PDF is via email, then the attachment service will render it just fine.
    Cheers!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • I can't connect to my school's free wifi. i was able to do it before but not anymore i get the self assign ip agrees message .it has no password only a pop up window before you connect to agree to school terms for wifi use. i don't get that window anymore

    I can't connect to my school's free wifi. i was able to do it before but not anymore i get the self assign ip addrees message .it has no password only a pop up window before you connect to agree to school terms for wifi use. i don't get that window anymore. i tried everything I can think of. It is a 2010 macbook pro but i recentrly updated to osx lion and even with lion it was working fine so I nkow it is not the update. also Im able to connect to other internets at home it works great. starbucks too.  but i became so frustated that i reset my computer to manufactuter setting and reinstall snow leopard on it. still I cant connect. I need help please i have been searching all over the web for help and i see people has been having this same problem for years now.. oh yeah and i know it is not the internet cuz there are other macs connecting to it without a single problem so i think it is an isolated problem plase help....i have follow many advises such as delete the internet from your prefered netwoks. restar your commputer etc etc.

    Be sure Safari does not have the Block Pop-Up Windows preference set.
    Where I work now there are several unencrypted VLANs that require authentication, and Safari promptly pops up a window for me to register every time.

  • Implicit read with assembly module instance working on one computer, but not another

    Hi,
    I'm trying to set up an on-site computer to run a VI which uses assembly instances for data communication, but for some reason I'm unable to establish a connection to the PLC.
    I'm running the example vi "CreateAssemblyInstance.vi" to try and get the communication set up before I start using my actual program.
    When I run this code on my development machine, I'm able to establish a connection to the PLC and read data. I then go into RSLogix 5000 and change the IP address to the on-site machine and try to run the test VI there, but I'm unable to make a connection. LabVIEW-side, the program thinks that it's established a connection and is reading/writing data, but PLC-side I'm getting a "Connection Failed" message in RSLogix.
    I find it weird that LabVIEW thinks the connection was established just fine, which the RSLogix says it can't connect to the VI.
    Just wondering if anyone else has had this happen. We aren't sure why the same VI runs on one machine but not another. We used RSLogix to change the IP address of the target machine, so we don't think that's the issue. And both computers are on the same network, so we don't think it's a firewall issue either.
    LabVIEW-side, things should be identical. I'm running the same example VI that came with the Ethernet/IP module. PLC-side, we're changing the target IP of the module within RSLogix 5000 (and we're sending the updated information to the PLC) to match the machine we're trying to make a connection with. Are we missing any steps? This is the first time we've tried using an assembly module, so we're having a hard time troubleshooting.
    Any ideas on why this is happening?

    I'm pretty sure we're using a generic ethernet module:
    I can communicate explicitly with the problem computer, it's able to use 'Tag Read' and 'Tag Write' to communicate with the PLC.
    We started having another problem just recently too. The Tag Read and Write commands are almost always timing out. I keep getting the error message -251723752:
    Detailed error info: Error -251723752 occurred at EthernetIP Tag Read REAL.vi;Details: The request response was not received in the requested timeout period    Possible reason(s):  Ethernet/IP Industrial Protocol: (Hex 0xF0FF0018) The request response was not received in the requested timeout period
    I can't figure out what's causing this all of a sudden, could these issues be related?

  • My Mac mini won't recognize photo library in itunes so I can download pics from library and free up space in memory, I was able to download camera role but not photo library that takes up more space.

    My Mac mini won't recognize iphone 4 photo library in itunes so I can download pics from library and free up space in memory, I was able to download camera role but not photo library that takes up more space. Help thanks

    The photo sync is one-way: Computer to phone. Photos synced to your phone will have to be extracted from your phone using third-party software, if you want them on your computer, as Apple makes no provision to do so. Since you're using a Mac, you can use this:
    http://www.ecamm.com/mac/phoneview/

  • HT4367 Whenever I try to rent a movie, Apple TV buffers and does not come back.  I am able to see other programs, but not able to rent movies.   And the movie charge still goes on my bill.

    Whenever I try to rent a movie, Apple TV buffers and does not come back.  I am able to see other programs, but not able to rent movies.   And the movie charge still goes on my bill.

    Apple TV uses iTunes. The reason you can't rent through your ATV is because you can't rent movies through iTunes Canada. Sadly, as this is a user-to-user forum, no one here would know when or if rentals will come to Canada.

  • HT3702 Why can I not purchase lollipop?  I am able to purchase other boosters but not this anyone know why?

    Why can I not purchase lollipop?  I am able to purchase other boosters but not this one.  Any suggestions??

    What happens when you try to buy it, does the 'buy' button not work, do you get any error messages ... ?
    If you are getting a message to contact iTunes Support then you can do so via this link and ask them for help (we are fellow users, we won't know why the message is appearing) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption
    If it's a different problem ... ?

  • I have a MBP running 10.6.8 and after the recent iOS update I have not been able to sync my devices. I was able to sync an ipod, but not iphone or ipad. iTunes recognizes my devices, but sync button stays grayed.

    I have a older MBP running 10.6.8 and after the recent iOS update I have not been able to sync my devices. I was able to sync an ipod, but not iphone or ipad. iTunes recognizes my devices, but sync button stays grayed. I've changed my USB hub, reinstalled iTunes and run disc cleanup. No luck.

    You said that your computer will sync other iPods? Are they iPod touches? Other iPod use different drivers the the touch And iPhone and iPad).
    You can try:
    iOS: Device not recognized in iTunes for Windows
    Does it charge? Does the iPod work?
    I would try on another computer.
    Last, make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar
    If defective and not abused you will walk out with a replacement

  • Pages load too small to read in firefiox but not in other browsers. Always have to zoom in 5 times.

    Pages load too small to read in Firefox but not in other browsers. Always have to zoom in 5 times.
    == This happened ==
    Every time Firefox opened
    == A long time, months, I think since I bought the computer..

    I forgot to add the extensions installed:
    auto hide Ip 1.0
    Better privacy 1.48.3
    download helper 4.8
    java console 6.0.2
    Norton IPS 2.0
    Norton toolbar 4.6
    quickProxy 2009.07.19
    realplayer browser record plugin 1.1.4
    stumbleupon 3.64

  • PDX index works in adobe reader 9.4 but not in adobe X !!

    Hello I have some commercial genealogy DVD's, bought a few years ago, with PDX files on them that work fine with adobe reader  9.4  but not in  adobe reader X.   Adobe reader X says they are invalid PDX index files. Ofcourse adobe says that version X is Backward compatible and I must contact the vendor of my dvd's !!!.
    Does anybody else has this problem ?
    I do not have the pro version so I cannot rebuild the indexes myself.
    Hans
    PS for now I have removed version 10 and re-installed version 9.4
    Windows XP SP3

    Reply found here:
    http://forums.adobe.com/message/3522477#3522477
    "Adobe Reader X doesn't support search catalogs created with Acrobat 5 or earlier.
        You may try Adobe Reader 9 or create new catalogs with Acrobat X Pro."
    I actually contacted my vendor and he is sending me a new disk free of charge . He told me he had to destroy his whole stock of cd's that contains old pdx files.

  • I use firefox to show jpg's from newsgroups via Agent. It now cannot find the file in Agent's temp file if it is not a single word. It will read itemone.jpg but not item one.jpg. I'm using Firefox 3.6.8. I've had this problem since I stated using firefox

    I use firefox to show jpg's from newsgroups via Agent. It now cannot find the file in Agent's temp file if it is not a single word. It will read "itemone.jpg" but not "item one.jpg". I'm using Firefox 3.6.8. I've had this problem since I stated using firefox 3. How can I correct it? in English
    == This happened ==
    Every time Firefox opened
    == I upgraded to Firefox 3

    I use firefox to show jpg's from newsgroups via Agent. It now cannot find the file in Agent's temp file if it is not a single word. It will read "itemone.jpg" but not "item one.jpg". I'm using Firefox 3.6.8. I've had this problem since I stated using firefox 3. How can I correct it? in English
    == This happened ==
    Every time Firefox opened
    == I upgraded to Firefox 3

  • After installing Mountain Lion, why is there Yahoo access for one user but not another?--both are administrators.

    After installing Mountain Lion, why is there Yahoo access for one user but not another?--both are administrators.

    We've had several instances where we have had to run chkdsk on arrays with over 1m files. Average completion time is approximately 72 hours. The maximum downtime window they have available is the 64 hour weekend window. File sizes and number of files were
    much smaller then than they are now.
    The idea, in theory, was to use VHDs to compartmentalize the data into smaller volumes which could be more easily managed. It would also improve performance when transferring these compartments of data as they would use sequential read/write rather than
    fragmented/random. This idea was never fleshed out in entirety, they don't split data up into little containers, but simply into big ones per project. Hence the 11m files in one container that I am currently trying to diagnose.
    Some other important facts: The VHD in question is mounted in B:/project/ as this server also allows remote workers to log in, but they are restricted to see only data in E:. Disks A-D are hidden via group policy.
    Update: icacls is failing on a large number of files within this dataset. I counted the path characters to ensure it wasn't the 255 character limit I was encountering and verified that the paths being blocked are only about 150 characters long. Once it finishes,
    I'll have to try taking ownership and then re-running it. At this point I still have no idea how long to expect. I'm running out of time as the environment will be in use again at 9AM tomorrow morning.

  • Bubble Event firing in one company but not another

    Having spent the past 2 days trying to get the installer working (which it finally does thanks to people on this forum!), I've finally pushed my add-in out to people this morning.
    Unfortunately, the bubbleevent seems to be being ignored in all companies bar the test company.
    The code is below. The nominal codes do not begin with "720", so that section is not being fired in either company.
    So, my question is, why would a bubble event work in one company but not another?
    Private Sub oApp_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles oApp.ItemEvent
            Dim NumberRows As Long
            Dim oMatrix As SAPbouiCOM.Matrix
            Dim oRowCount As Integer
            Dim oCheck As SAPbouiCOM.EditText
            Dim oCheck2 As SAPbouiCOM.EditText
            REM Check for Profit Centre and Project Code on each line of Purchase Transactions
            If pVal.FormTypeEx = "142" Or pVal.FormTypeEx = "141" Or pVal.FormTypeEx = "181" Or _
            pVal.FormTypeEx = "139" Or pVal.FormTypeEx = "133" Or pVal.FormTypeEx = "179" Then
                REM Set to active form and Sales/Purchase transaction matrix
                oForm = oApp.Forms.ActiveForm
                oItem = oApp.Forms.Item(FormUID).Items.Item("38")
                oMatrix = oItem.Specific
                If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And _
                  pVal.Before_Action Then
                    If pVal.ItemUID = "1" Then
                        NumberRows = oMatrix.RowCount
                        For oRowCount = 1 To NumberRows - 1
                            oCheck = oMatrix.Columns.Item("30").Cells.Item(oRowCount).Specific
                            If oCheck.Value = "" Then
                                oApp.MessageBox("Please enter a Profit Centre on row " & oRowCount)
                                BubbleEvent = False
                            End If
                            oCheck = oMatrix.Columns.Item("31").Cells.Item(oRowCount).Specific
                            If oCheck.Value = "" Then
                                oApp.MessageBox("Please enter a Project on row " & oRowCount)
                                BubbleEvent = False
                            End If
                            oCheck = oMatrix.Columns.Item("U_CarReg").Cells.Item(oRowCount).Specific
                            oCheck2 = oMatrix.Columns.Item("1").Cells.Item(oRowCount).Specific
                            If oApp.Company.DatabaseName = "FOLLIS_LIVE" Or oApp.Company.DatabaseName = "FOLLUK_TEST" Then
                                If oCheck.Value = "" And Left(oCheck2.Value, 3) = "720" Then
                                    oApp.MessageBox("Please enter a Car Registration on row " & oRowCount)
                                    BubbleEvent = False
                                    Exit For
                                End If
                            End If
                        Next oRowCount
                    End If
                End If
            End If
            REM Check for Profit Centre and Project Code on each line of Nominal Transactions
            If pVal.FormTypeEx = "392" Or pVal.FormTypeEx = "393" Then
                REM Set to active form, journal matrix
                oItem = oApp.Forms.Item(FormUID).Items.Item("76")
                oMatrix = oItem.Specific
                If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And _
                  pVal.Before_Action Then
                    If pVal.ItemUID = "1" Then
                        NumberRows = oMatrix.RowCount
                        For oRowCount = 1 To NumberRows - 1
                            oCheck = oMatrix.Columns.Item("23").Cells.Item(oRowCount).Specific
                            If oCheck.Value = "" Then
                                oApp.MessageBox("Please enter a Profit Centre on row " & oRowCount)
                                BubbleEvent = False
                            End If
                            oCheck = oMatrix.Columns.Item("16").Cells.Item(oRowCount).Specific
                            If oCheck.Value = "" Then
                                oApp.MessageBox("Please enter a Project on row " & oRowCount)
                                BubbleEvent = False
                            End If
                        Next oRowCount
                    End If
                End If
            End If
        End Sub

    Hi Daniel,
    Then the only option I see is that the If statement is true in one database, and false on the others.
    If oApp.Company.DatabaseName = "FOLLIS_LIVE" Or oApp.Company.DatabaseName = "FOLLUK_TEST" Then
    If oCheck.Value = "" And Left(oCheck2.Value, 3) = "720" Then
    oApp.MessageBox("Please enter a Car Registration on row " & oRowCount)
    BubbleEvent = False
    Exit For
    End If
    End If
    If oCheck.Value = "" Then
    oApp.MessageBox("Please enter a Project on row " & oRowCount)
    BubbleEvent = False
    End If
    One of this is should be different on the companies.
    Nothing else comes to my mind.
    Regards,
    Ibai Peñ

Maybe you are looking for