Print Page | Close Window

problem QuickPDF convert to text need help !

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1905
Printed Date: 04 Apr 26 at 8:03PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: problem QuickPDF convert to text need help !
Posted By: huynhvansen
Subject: problem QuickPDF convert to text need help !
Date Posted: 01 Aug 11 at 4:14AM

Hello,

 

The lib QuickPDF convert to text  program still has some error as following:

- break line

- skip space chars

- upset the position some fields

- does not distinguish the column of table.

 

Please look at the attachment for details the error.
please download same pdf with url:     
http://www.mediafire.com/?3jnj9ob7psn093d
http://www.mediafire.com/?qqso76v9pd63eco

segment code convert pdf to text

foreach (FileInfo fi in diSource.GetFiles("*.pdf"))
                {
                    pagecount = 0;
                    string textfile = txt_Output.Text + @"\" + Path.GetFileNameWithoutExtension(fi.FullName) + ".txt";
                    PDFLib.LoadFromFile(fi.FullName);
                    pagecount = PDFLib.PageCount();
                    if (pagecount > 0)
                    {
                        try
                        {
                            string[] text = new string[pagecount];
                         
                            for (int i = 1; i <= pagecount; i++)
                            {
                                PDFLib.SelectPage(i);
                                text[i - 1] = PDFLib.GetPageText(1);                              
                            }
                          
                            FileStream newfile = new FileStream(textfile, FileMode.Append, FileAccess.Write);
                            StreamWriter sw = new StreamWriter(newfile);
                            try
                            {
                                for (int i = 1; i <= pagecount; i++)
                                {
                                    sw.Write(text[i - 1]);
                                    sw.WriteLine();
                                }                               
                                sw.Close();
                                newfile.Close();
                            }
                            catch (Exception err)
                            {
                            }                       
                           
                        }
                        catch (Exception err)
                        {                           
                        }
                    }                 
                }

Please Help me solution for this  problem !



Replies:
Posted By: AndrewC
Date Posted: 01 Aug 11 at 3:58PM
Quick PDF Library and GetPageText(1) is not really designed for TXT extraction in the way that you are expecting it.  We have made major changes to the TXT extraction in 7.24 and 7.25 versions.  We plan to add a full TXT file extraction to one of the early releases of QPL version 8.

Here is some sample output from your sample1.pdf.  Let me know if this is what you are expecting.

Andrew.



                                      Michigan State University Pulmonary Diagnostics                                                                                 



                                                                   Pulmonary Function Report                                                                          

              Name :    Mitchellroland, Keshawn          ID:      4680083             D.O.B.:     11/16/1999          Date:   6/24/2009                               
              Doctor:   Saah, MD, Elna N                 Height:  131.30 cm             Age:      9                  Time:    12:05:34 PM                             
              Tech:     LeLaidier RRT RPFT AE-C, L.      Weight: 32.00 kg               Sex:      Male                Race:    Black                                  


              Diagnosis:     Asthma,all                                                                                                                               
              Dyspnea:       No Dyspnea                                                                                                                               
               Cough:        No Cough                                                Wheeze:    No Wheeze                                                             
              Yrs Quit                           Pks/Day:                   Yrs Smk                          Tbco Prod: Never Smoked                                  
              Pre Test Comments                                                                                                                                       
              Test started at 12:21                                                                                                                                   
              Medications:                                                                                                                                            
              Flovent 44 mcg 2 puffs BID last taken 1 week ago; Albuterol inhaler hasn't used for awhile; Singulair is suppose to take                                
              but is out of it.                                                                                                                                       
              PRE-BRONCH                                      POST-BRONCH                                                                                             
                                                   Actual         Pred.        %Pred.                 Actual        %Pred.        %Chng.                              

              SPIROMETRY                                                                                                                                              
              FVC (L)                                1.54           2.02           76                    1.36           67            -12                             
              FEV1 (L)                               1.28           1.76           73                    1.13           64            -12                             
              FEV1/FVC (%)                            83             87            95                    83             95             0                              
              FEF 25% (L/sec)                        2.37                                                1.24                         -48                             
              FEF 50% (L/sec)                        1.55           2.42           64                    1.17           48            -24                             
              FEF 75% (L/sec)                        0.54           1.23           44                    0.59           48             11                             
              FEF 25-75% (L/sec)                     1.20           2.12           57                    1.08           51            -11                             
              FEF Max (L/sec)                        2.51           4.38           57                    1.88           43            -25                             
              FIVC (L)                               1.42                                                1.25                         -12                             
              FIF 50% (L/sec)                        1.82                                                1.95                          7                              
              FIF Max (L/sec)                        1.97                                                2.00                          2                              
              Expiratory Time (sec)                  4.14                                                8.77                         112                             

              LUNG VOLUMES                                                                                                                                            
              SVC (L)                                1.60           2.02           79                    1.60           79             0                              
              IC (L)                                 1.20           1.37           87                    1.17           85             -2                             
              ERV (L)                                0.39           0.65           61                    0.30           47            -23                             
              TGV (L)                                1.21           1.15          105                    1.12           98             -7                             
              RV (Pleth) (L)                         0.80           0.52          154                    0.69          133            -13                             
              TLC (Pleth) (L)                        2.40           2.52           95                    2.29           91             -5                             
              RV/TLC (Pleth) (%)                      33             21           158                    30            144             -9                             

              DIFFUSION                                                                                                                                               
              DLCOunc (ml/min/mmHg)                  13.61         14.77           92                                                                                 
              DLCOcor (ml/min/mmHg)                  13.53         14.77           92                                                                                 
              DL/VA (ml/min/mmHg/L)                  6.42           5.86          110                                                                                 
              VA (L)                                 2.11           2.52           84                                                                                 

              AIRWAYS RESISTANCE                                                                                                                                      
              Raw (cmH2O/L/s)                        3.92           2.00          196                    1.67           83            -57                             
              Gaw (L/s/cmH2O)                        0.26           0.50           51                    0.60          120            134                             
              sGaw (1/cmH2O*s)                       0.21           0.21          101                    0.50          237            135                             
              Vpant (L)                              1.22                                                1.21                          -1                             
              Frequency                               82                                                 75                            -7                             

              BLOOD GASES                                                                                                                                             



Posted By: AndrewC
Date Posted: 01 Aug 11 at 4:00PM
You will need to copy and paste the text above into something like notepad that uses a fixed width font.  The font used in the message above is proportional which makes it look like the text alignment is not correct.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk