Saravanan666/pypi-org huggingface dataset:
Package: pdfminer.six
pdfminer.sixWe fathom PDFPdfminer.six is a community maintained fork of the original PDFMiner. It is a tool for extracting information from PDF
documents. It focuses on getting and analyzing text data. Pdfminer.six extracts the text from a page directly from the
sourcecode of the PDF. It can also be used to get the exact location, font or color of the text.It is built in a modular way such that each component of pdfminer.six can be replaced easily. You can implement your own
interpreter or rendering device that uses the power of pdfminer.six for other purposes than text analysis.Check out the full documentation onRead the Docs.FeaturesWritten entirely in Python.Parse, analyze, and convert PDF documents.Extract content as text, images, html orhOCR.PDF-1.7 specification support. (well, almost).CJK languages and vertical writing scripts support.Various font types (Type1, TrueType, Type3, and CID) support.Support for extracting images (JPG, JBIG2, Bitmaps).Support for various compressions (ASCIIHexDecode, ASCII85Decode, LZWDecode, FlateDecode, RunLengthDecode,
CCITTFaxDecode)Support for RC4 and AES encryption.Support for AcroForm interactive form extraction.Table of contents extraction.Tagged contents extraction.Automatic layout analysis.How to useInstall Python 3.8 or newer.Install pdfminer.six.pip install pdfminer.six(Optionally) install extra dependencies for extracting images.pip install 'pdfminer.six[image]'Use the command-line interface to extract text from pdf.pdf2txt.py example.pdfOr use it with Python.frompdfminer.high_levelimportextract_texttext=extract_text("example.pdf")print(text)ContributingBe sure to read thecontribution guidelines.AcknowledgementThis repository includes code frompyHanko; the original license has been includedhere.
Package: pdfminer.six-i
Fork of PDFMiner using six for Python 2+3 compatibilityPDFMiner is a tool for extracting information from PDF documents.
Unlike other PDF-related tools, it focuses entirely on getting and analyzing
text data. PDFMiner allows to obtain the exact location of texts in a page,
as well as other information such as fonts or lines.
It includes a PDF converter that can transform PDF files into other text
formats (such as HTML). It has an extensible PDF parser that can be used for
other purposes instead of text analysis.
Package: pdfner
pdfnerInformation extraction and named entity recognition for indexing PDFsInstall NLP toolsDownload language-specific model data in spaCy$ python -m spacy download enDownload Stanford CoreNLP fromhttps://stanfordnlp.github.io/CoreNLP/download.htmland extract to {project root}/pdfner/tests/toolsInstall OCRmyPDFhttps://ocrmypdf.readthedocs.io/en/latest/installation.htmlInstallationpip install pdfnerUsageProcessing a PDFfromtypingimportListfrompdfnerimport*# Each page of the PDF is processed to an NerDocument.processed_pdf:List[NerDocument]=process_pdf('scanned.pdf',entities_detector=SpacyDetectEntities())print(f"Extracted text:{processed_pdf[0].text}")print(f"Detected entities:{processed_pdf[0].entities}")Indexing with ElasticsearchimportsimplejsonasjsonfromelasticsearchimportElasticsearches=Elasticsearch()# NerDocument implements for_json function for easy serialization with simplejson.doc:NerDocumentfordocinprocessed_pdf:res=es.index(index='pdfner',id=doc.id,body=json.dumps(doc,for_json=True))print(res['result'])Indexing with Solrimportpysolr# Collection "gettingstarted" auto created by: solr -c -e schemalesssolr=pysolr.Solr('http://localhost:8983/solr/gettingstarted',always_commit=True)# encode returns NerDocument object as dict which is required by pysolrsolr.add([doc.encode()fordocinprocessed_pdf])APIprocess_pdfA function that converts a scanned PDF to a text-based PDF and applies the NER detector object to the text to extract entities. Returns a list of NerDocument objects.filepath: str- path to PDF filemake_thumbnail: Optional[bool]=False- whether to create a thumbnail PNG for the first pagecache_entities: Optional[bool]=False- whether to cache entities to the local filesystemparallelize_pages: Optional[bool]=True- whether to process multiple pages in parallelout_filepath: Optional[str]=None- optional location of resulting processed PDFentities_detector: AbstractDetectEntities- named argument for NER detector object (SpacyDetectEntities, CoreNlpDetectEntities)**kwargs- additional named arguments to attach to the returned NerDocument objectsAbstractDetectEntitiesRoll your own NER detector by subclassing AbstractDetectEntities and overriding detect_entities.detect_entities(text: str, **kwargs)- extract entities from input text and returns a list of NamedEntity objectsNerDocumentA class representing a single page of a processed PDF.Attributesid: str- auto-generated random UUIDtext: str- text extracted from PDF pagepage_number: int- PDF page numberentities: List[str]- entities extracted from PDF textprocessed_location: str- location of processed PDForiginal_location: str- location of original PDFredacted_location: str- location of redacted PDFthumbnail_location: str- location of thumbnail PNG for first page of processed PDF**kwargs- additional named arguments to store with objectInstance methodsencode()- returns dict representation of objectfor_json()- for simplejson to serialize object to JSONClass methodsdecode(d: Dict)- object_hook function for simplejson's loads function to deserialize JSON to a proper NerDocument object
Package: pdfnumbering
Add page numbers to a PDF documentpdfnumbering builds onpypdfandfpdf2to make it easy to stamp page numbers
to a PDF document, and provides a convenient CLI tool to do so.InstallationInstall the published version fromPyPI:python-mpipinstallpdfnumberingOr the development version fromGitHub:python-mpipinstallgit+https://github.com/mikmart/pdfnumbering.gitUsagePackageimportsysfrompdfnumberingimportPdfNumbererfrompypdfimportPdfWriterINPUT_FILE=sys.argv[1]OUTPUT_FILE=sys.argv[2]numberer=PdfNumberer()document=PdfWriter(clone_from=INPUT_FILE)numberer.add_page_numbering(document.pages)document.write(OUTPUT_FILE)Command line interface$ pdfnumbering --help
usage: pdfnumbering [-h] [-v] [--first-number N] [--ignore-pages [PAGE ...]]
                    [--skip-pages [PAGE ...]] [--stamp-format STRING] [--font-size PT]
                    [--font-family NAME] [--text-color HEX] [--text-align {left,center,right}]
                    [--text-position X Y] [--page-margin X Y] [-o OUTPUT]
                    FILE

Stamp pages in a PDF document with page numbers.

positional arguments:
  FILE                  the input PDF file to stamp

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -o OUTPUT, --output OUTPUT
                        destination to write output to

numbering options:
  --first-number N      number to start counting from (default: 1)
  --ignore-pages [PAGE ...]
                        pages that should not be counted
  --skip-pages [PAGE ...]
                        pages that should not be stamped
  --stamp-format STRING
                        format string for stamp text, formatted with page number and page
                        count (default: "{}")

styling options:
  --font-size PT        font size in points (default: 32)
  --font-family NAME    font family name (default: Helvetica)
  --text-color HEX      hexadecimal color code (default: #ff0000)

placement options:
  --text-align {left,center,right}
                        horizontal alignment of page numbers (default: left)
  --text-position X Y   position of page numbers, in points (default: 0 0)
  --page-margin X Y     margin at the page edges, in points (default: adapts to font size)
Package: pdfnup
Pdfnupis a Python module and command-line tool for layouting multiple
pages per sheet of a PDF document. Using it you can take a PDF document
and create a new PDF document from it where each page contains a number
of minimized pages from the original PDF file.Right nowpdfnupshould be used on documents with all pages the same
size, and half square page numbers per sheet work best on paper sizes
of the ISO A series.Basically,pdfnupwrappspyPdf,
a package written by Mathieu Fenniak, which does not provide tools like
this for using the core functionality easily from the command-line or
from a Python module.Pdfnupitself was much inspired from some code
written by Henning von Bargen - thanks, Henning!This release provides full support for file objects and StringIO objects
for input as well as output documents and fixes a nasty buglet in the
command-line invocation script.Featuressave minimized pages of a given PDF document in a new PDF documentplace n pages per sheet, with n being square or half squarecustomize layout order, both horizontally and verticallyturn rotated pages to make them all have the same formatallow patterns for output filessupports file-like objects for input and output documentsinstall a Python module namedpdfnup.pyinstall a Python command-line script namedpdfnupprovide a Unittest test suiteHistory2012-06-19 (0.4.2): Fixed a bug afterImmutableSetwas removed in pyPdf 1.13.ExamplesYou can usepdfnupas a Python module e.g. like in the following
interactive Python session:>>> from pdfnup import generateNup
>>>
>>> generateNup("file.pdf", 8, verbose=True)
written: file-8up.pdf
>>>
>>> generateNup("file.pdf", 8, dirs="LD", verbose=True)
written: file-8up.pdf
>>>
>>> f = open("file.pdf")
>>> generateNup(f, 8, outPathPatternOrFile="out-%(n)dup.pdf", verbose=True)
written: out-8up.pdfIn addition there is a script namedpdfnup, which can be used
more easily from the system command-line like this (you can see many
more examples when typingpdfnup-hon the command-line):$ pdfnup -V file.pdf
written: file-4up.pdf
$ pdfnup -V -n 8 file.pdf
written: file-8up.pdf
$ pdfnup -V -n 8 -l LD file.pdf
written: file-8up.pdf
$ pdfnup -V -n 9 /path/file[12].pdf
written: /path/file1-9up.pdf
written: /path/file2-9up.pdf
$ pdfnup -V -n 8 -o "%(dirname)s/foo.pdf" /path/file.pdf
written: /path/foo.pdf
Package: pdfnup3
Pdfnupis a Python module and command-line tool for layouting multiple
pages per sheet of a PDF document. Using it you can take a PDF document
and create a new PDF document from it where each page contains a number
of minimized pages from the original PDF file.Right nowpdfnupshould be used on documents with all pages the same
size, and half square page numbers per sheet work best on paper sizes
of the ISO A series.Basically,pdfnupwrappspyPdf,
a package written by Mathieu Fenniak, which does not provide tools like
this for using the core functionality easily from the command-line or
from a Python module.Pdfnupitself was much inspired from some code
written by Henning von Bargen - thanks, Henning!This release provides full support for file objects and StringIO objects
for input as well as output documents and fixes a nasty buglet in the
command-line invocation script.Featuressave minimized pages of a given PDF document in a new PDF documentplace n pages per sheet, with n being square or half squarecustomize layout order, both horizontally and verticallyturn rotated pages to make them all have the same formatallow patterns for output filessupports file-like objects for input and output documentsinstall a Python module namedpdfnup.pyinstall a Python command-line script namedpdfnupprovide a Unittest test suiteExamplesYou can usepdfnupas a Python module e.g. like in the following
interactive Python session:>>> from pdfnup import generateNup
>>>
>>> generateNup("file.pdf", 8, verbose=True)
written: file-8up.pdf
>>>
>>> generateNup("file.pdf", 8, dirs="LD", verbose=True)
written: file-8up.pdf
>>>
>>> f = open("file.pdf")
>>> generateNup(f, 8, outPathPatternOrFile="out-%(n)dup.pdf", verbose=True)
written: out-8up.pdfIn addition there is a script namedpdfnup, which can be used
more easily from the system command-line like this (you can see many
more examples when typingpdfnup-hon the command-line):$ pdfnup -V file.pdf
written: file-4up.pdf
$ pdfnup -V -n 8 file.pdf
written: file-8up.pdf
$ pdfnup -V -n 8 -l LD file.pdf
written: file-8up.pdf
$ pdfnup -V -n 9 /path/file[12].pdf
written: /path/file1-9up.pdf
written: /path/file2-9up.pdf
$ pdfnup -V -n 8 -o "%(dirname)s/foo.pdf" /path/file.pdf
written: /path/foo.pdf
Package: pdf-orientation-corrector
PDF Orientation CorrectorOverviewThe PDF Orientation Corrector is a Python module designed for automatic detection and correction of the orientation of pages in PDF documents.Key FeaturesAutomated Page Orientation Correction: Detects and corrects the orientation of text on each page of a PDF.Batch Processing: Enhances performance when dealing with large documents by processing pages in batches.Image Preprocessing: Uses PIL to enhance the accuracy of OCR results.PrerequisitesBefore you begin, ensure you have met the following requirements:Python 3.x
Libraries: PyPDF2, pytesseract, pdf2image, PIL (Pillow), concurrent.futures (part of the standard library)InstallationClone the repository or download the source code. Install the required dependencies via pip:pipinstallPyPDF2pytesseractpdf2imagePillow## UsageThe module can be used in two ways:As a ScriptRun the script from the command line, providing the necessary arguments:pythonpdf_orientation_corrector.pyinput.pdfoutput.pdf--batch_size20--dpi300--verboseAs a LibraryImport the module in your Python script:importpdf_orientation_corrector# Use the module functions as neededAuthorJames Standbridge
Email:james.standbridge.git@gmail.com
Package: pdfoutline
pdfoutlineA command line tool for adding an outline (a bookmark, or table of contents) to pdf files.PrerequisitesMake sure you haveghostscriptinstalled.# Macbrewinstallghostscript# Debian, Ubuntusudoaptinstallghostscriptghostscriptfor windows can be installed fromthe official websiteUsage$ pip install pdfoutline
...

$ pdfoutline sample.pdf sample.toc sample-out.pdf
 |██████████████████████----------------------------| 118/263optionally, the ghost script executable can be specified as wellpdfoutlinesample.pdfsample.tocsample-out.pdf--gs_path'C:\Program Files\gs\gs9.55.0\bin\gswin64.exe'DemoSample output:Sample Table of contents file:sample.toc# this is a comment
First Chapter 1
    first section 1
        first subsection 1
    second section 4
    third section 5

# a command to fix a gap between pdf pages and content pages
+10

Second Chapter 10
    some entry 10
    some entry 11
Package: pdf-outline-edit
Mini PDF Outline Editorpipx run pdf-outline-edit     # tk GUI
pipx run pdf-outline-edit[qt] # qt GUI, does not work yetA GUI program to import, edit and modify PDF outlines/Table-of-Content through a simple textual format.The textual format is almost the same as printed books' ToC which has been "rediscovered" multiple times.Indent level -> Nesting levelNumber at the end -> Page numberText in between -> TitleYou can copy and paste existing outline from PDF books and tidy it up a bit to fuse it into the PDF file in 3 easy steps:Set a target PDF fileWrite the outlinePress "Write to PDF" buttonExtraAuto tidy-upRemove excessive spacesRemove ending punctuations (,.) in titles?Auto indent by headsTry convertindex 1
1 Chapter one 2
1.1 nice 3
1.2 world 4
2 Chapter two 5
2.1 hello 6
2.2 noice 7
references 8intoindex 1
1 Chapter one
    1.1 nice
    1.2 world
2 Chapter two
    2.1 hello
    2.2 noice
    references 8  <--- this needs to adjust final entries that has no chaptersExtra OptionsOffset: Starting page of the page numbers. The pages before it will be roman numerals and the offset page's page label will be 1.AlternativesHandyOutlinerAlmost identical program but written in .NET & iText and uses XMLpdf.tocgenOver-engineered by following the disgusting "unix philo-dogshit-sophy".DevOops# Install in virtualenvpython3-mpipinstall-e.
python3-mpipinstall-e.[qt]# Run in dev environment./src/run-gui.pyLicenseAGPL-3.0-or-laterFYIPython packaging is HOLY HELL.
Package: pdfpad
pdfpadInstallationIn order to install the package execute the following commands:gitclonehttps://github.com/arseniybelkov/pdfpad.gitcdpdfpadpipinstall-e.ORIf you haveGitHub CLIinstalledghrepoclonearseniybelkov/pdfpadcdpdfpadpipinstall-e.Usagepdfpad-p[PATHTOPDF]-hg[numberOFPICSINACOLUMN]-w[numberOFPICSINAROW]-N[AMOUNTOFPADDINGPIXELS]
Package: pdf-page-count
The pdf-page-counter module is used to determine the number of pages in a pdf document. The result is the total number of pages in a docuemnt, even if it is a compound document (like a printer stream file) that contains several PDF.Getting startedSee theInstalling Packagesinstructions in the Python Packaging User Guide on installing, upgrading and uninstalling pdf-page-counter.Make sure you uns an up-to-date version of pip.Questions, comments and big reports as well as vulnerability reports can be directly submitted to teh maintainer:thomas.grasse@exercim.com.UsageThe package can be used in 2 ways. When executed as the main package with:python3 -m pdf-page-count <filename>. The process ends with the page count returned as the process exit code.The package can also be imported, by using:import pdfpagenumber. The functionextractPdfPageCountis used with the path to the PDF file as argument, to determine the page count.LicensingThe package is distributed under MIT license (link).Copyright 2021 exercim OyPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Package: pdfpages
Extract specific pages from PDF documents.What is it?How do I install it?How do I run it on the command line?How do I call it from python code?What license is it released under?What is it?A python package
that extracts pages from PDF documents
and writes them to a fresh PDF.How do I install it?Via pip:pip install pdfpagesOr if you just want the git repo:git clone git@github.com:philbooth/pdfpages.gitHow do I run it on the command line?pdfpages -o out.pdf in.pdfThe-ooption
is used to specify
the output path
and the final argument
is the path to the input document.
You can specify
multiple input documents
by listing further paths
at the end of the command:pdfpages -o out.pdf in1.pdf in2.pdf
pdfpages -o out.pdf in/*.pdfWithout other arguments,
the default behaviour is
to extract the first page
from each input document
and write the result
to the output PDF.If you want to extract specific pages,
you can use the-poption.
For instance,
to extract just the second page
from each input document
you woud run:pdfpages -p 2 -o out.pdf in/*.pdfOr to extract the second and third pages
from each document:pdfpages -p 2 3 -o out.pdf in/*.pdfYou can also use
the-fand-coptions
to specify ranges of page numbers.
For instance,
to extract the first hundred pages
from each document:pdfpages -f 1 -c 100 -o out.pdf in/*.pdfOr to extract
the second hundred pages:pdfpages -f 101 -c 100 -o out.pdf in/*.pdfYou can exclude specific pages
from these ranges
with the-eoption.
For example,
to exclude the third page
from the first five pages
of each input document:pdfpages -f 1 -c 5 -e 3 -o out.pdf in/*.pdfFinally,
you can see the usage information
at any time
using the-hoption:python pdfpages.py -hHow do I call it from python code?import pdfpages

pdfpages.extract(in_files, out_file, pages, exclude_pages)in_files:
A tuple containing files
opened for binary reading
(mode"rb").out_file:
A file
opened for binary writing
(mode"wb").pages:
A tuple containing page numbers
to extract
(integers).exclude_pages:
An optional tuple containing page numbers
to exclude from extraction
(integers).
Defaults to an empty tuple.What license is it released under?MIT
Package: pdfparanoia
# pdfparanoiapdfparanoia is a PDF watermark removal library for academic papers. Somepublishers include private information like institution names, personal names,ip addresses, timestamps and other identifying information in watermarks oneach page.pdfparanoia это библиотека для удаления водяных знаков из PDF файлов научныхстатей. Некоторые издатели включают личную информацию, такую как названияинститутов, имена, IP-адреса, время и дату и другую информацию в водяные знакисодержащиеся на каждой странице.## InstallingSimple.``` bashsudo pip install pdfparanoia```or,``` bashsudo python setup.py install```pdfparanoia is written for python2.7+ or python 3.You will also need to manually install "pdfminer" if you do not use pip to install pdfparanoia.For python versions prior to Python 3, use "pdfminer" from the Python Package Index (http://pypi.python.org). For recent versions of Python, use pdfminer3k instead.## Usage``` pythonimport pdfparanoiapdf = pdfparanoia.scrub(open("nmat91417.pdf", "rb"))with open("output.pdf", "wb") as file_handler:file_handler.write(pdf)```or from the shell,``` bashpdfparanoia --verbose input.pdf -o output.pdf```and,``` bashcat input.pdf | pdfparanoia > output.pdf```## Supported* AIP* IEEE* JSTOR* RSC* SPIE (sort of)## Changelog* 0.0.13 - RSC* 0.0.12 - SPIE* 0.0.11 - pdfparanoia command-line interface. Use it by either piping in pdf data, or specifying a path to a pdf in the first argv slot.* 0.0.10 - JSTOR* 0.0.9 - AIP: better checks for false-positives; IEEE: remove stdout garbage.* 0.0.8 - IEEE## LicenseBSD.
Package: pdfpipe
A command-line tool in Python. Pass it one or more text files, or pipe something from stdin, and it will
produce a text-only PDF file.Handy for quickly printing plain text content in a clean and predictable format. Specify font, font size,
orientation and paper size from the command line.InstallationGrab the file pdfpipe.py and execute it, or:pip install pdfpipeOr, you can download the source andpython setup.py installorsudo python setup.py installif required.Command-Line UsageIn your command-line:echo "Hello from a PDF file named output.pdf" | pdfpipe.pyOrpdfpipe.py -p -b -o printable.pdf -s 14 -g Letter --title "Reports for today" report*.txtTypepdfpipe.py --helpfor more information on the available options.Fonts and UnicodeThe FPDF library knows about the following font families:Courier, Arial, Times, Symbol, ZapfDingbatsWhich can all be chosen as the font with the -f option. By default,
Courier will be used for the monospace font, Arial (helvetica) for
proportional (-p).If you need to print non-latin text, or want a different font for any
other reason, instead specify the full path to a TTF font file. E.g.:./pdfpipe.py unicode_text.txt -f "/Library/Fonts/Arial Unicode.ttf"