Show
Ignore:
Timestamp:
10/06/08 00:22:07 (16 years ago)
Author:
jerome
Message:

Removed spaces at EOL.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pkpgpdls/pdf.py

    r3410 r3436  
    88# the Free Software Foundation, either version 3 of the License, or 
    99# (at your option) any later version. 
    10 #  
     10# 
    1111# This program is distributed in the hope that it will be useful, 
    1212# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414# GNU General Public License for more details. 
    15 #  
     15# 
    1616# You should have received a copy of the GNU General Public License 
    1717# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    3737PDFDELIMITERS = r"()<>[]{}/%" 
    3838PDFMEDIASIZE = "/MediaBox [xmin ymin xmax ymax]" # an example. MUST be present in Page objects 
    39          
     39 
    4040class Parser(pdlparser.PDLParser) : 
    4141    """A parser for PDF documents.""" 
     
    4444    openmode = "rU" 
    4545    format = "PDF" 
    46     def isValid(self) :     
     46    def isValid(self) : 
    4747        """Returns True if data is PDF, else False.""" 
    4848        if self.firstblock.startswith("%PDF-") or \ 
     
    5151           (self.firstblock.find("%PDF-") != -1) : 
    5252            return True 
    53         else :     
     53        else : 
    5454            return False 
    55          
    56     def veryFastAndNotAlwaysCorrectgetJobSize(self) :     
     55 
     56    def veryFastAndNotAlwaysCorrectgetJobSize(self) : 
    5757        """Counts pages in a PDF document. 
    58          
     58 
    5959           This method works great in the general case, 
    6060           and is around 30 times faster than the active 
     
    7070    def getJobSize(self) : 
    7171        """Counts pages in a PDF document. 
    72          
     72 
    7373           A faster way seems to be possible by extracting the 
    7474           "/Type/Pages/Count xxxx" value where there's no /Parent 
    7575           (i.e. the root of the page tree) 
    7676           Unfortunately I can't make a regexp work for this currently. 
    77             
     77 
    7878           At least the actual method below is accurate, even if 25% 
    7979           slower than the old one. But we will be able to extract 
     
    8484        oregexp = re.compile(r"\s+(\d+)\s+(\d+)\s+(obj\s*.+?\s*?endobj)", \ 
    8585                             re.DOTALL) 
    86                               
     86 
    8787        # Regular expression indicating a new page 
    8888        npregexp = re.compile(r"/Type\s*/Page[/>\s]") 
    89          
    90         # Regular expression indicating an empty page  
     89 
     90        # Regular expression indicating an empty page 
    9191        # (usually to delete an existing one with a lower minor number) 
    92         epregexp = re.compile(r"obj\s*<<\s*/Type\s*/Page\s*>>\s*endobj")  
    93          
     92        epregexp = re.compile(r"obj\s*<<\s*/Type\s*/Page\s*>>\s*endobj") 
     93 
    9494        # First we build a mapping of objects to keep because 
    9595        # if two objects with the same major number are found, 
     
    109109                #else : 
    110110                #    self.logdebug("Object %i.%i OK" % (major, minor)) 
    111                  
    112         # Now that we have deleted all unneeded objects, we         
     111 
     112        # Now that we have deleted all unneeded objects, we 
    113113        # can count the ones which are new pages, minus the ones 
    114114        # which are empty and not displayed pages (in fact pages