Saravanan666/pypi-org huggingface dataset:
Package: pdffile
pdfA modern pure-Python library for reading PDF files.The goal is to have a modern interface to handle PDF files which is consistent
with itself and typical Python syntax.The library should be Python-only (hence no C-extensions), but allow to change
the backend. Similar in concept tomatplotlib backendsandKeras backends.The default backend could be PyPDF2.Possible other backends could bePyMuPDF(usingMuPDF)
andPikePDF(usingQPDF).WARNING: This library is UNSTABLE at the moment! Expect many changes!InstallationpipinstallpdffileUsageRetrieve Metadata>>>importpdf>>>doc=pdf.PdfFile("001-trivial/minimal-document.pdf")>>>len(doc)1>>>doc.metadataMetadata(title=None,producer='pdfTeX-1.40.23',creator='TeX',creation_date=datetime.datetime(2022, 4, 3, 18, 5, 42),modification_date=datetime.datetime(2022, 4, 3, 18, 5, 42)other={'/CreationDate': "D:20220403180542+02'00'",'/ModDate': "D:20220403180542+02'00'",'/Trapped': '/False','/PTEX.Fullbanner': 'This is pdfTeX, V...'})Encrypted PDFsIf you have an encrypted PDF, just provide the key:doc=pdf.PdfFile(pdf_path,password=password)All following operations work just as described.Get Outline>>>importpdf>>>doc=pdf.PdfFile(pdf_path,password=password)>>>doc.outline[Links(page=5, text='1 Header'),Links(page=5, text='1.1 A section'),Links(page=9, text='2 Foobar'),Links(page=108, text='References')]Extract Text>>>importpdf>>>doc=pdf.PdfFile("001-trivial/minimal-document.pdf")>>>doc[0]<pdf.PdfPage object at 0x7f72d2b04100>>>>doc[0].text'Loremipsumdolorsitamet,consetetursadipscingelitr,seddiamnonumyeirmod\ntemporinviduntutlaboreetdoloremagnaaliquyamerat,seddiamvoluptua.Atvero\neosetaccusametjustoduodoloresetearebum.Stetclitakasdgubergren,noseataki-\nmatasanctusestLoremipsumdolorsitamet.Loremipsumdolorsitamet,consetetur\nsadipscingelitr,seddiamnonumyeirmodtemporinviduntutlaboreetdoloremagna\naliquyamerat,seddiamvoluptua.Atveroeosetaccusametjustoduodoloresetea\nrebum.Stetclitakasdgubergren,noseatakimatasanctusestLoremipsumdolorsit\namet.\n1\n'Alternatively, you can usedoc.textto get the text of all pages.
Package: pdffit
PDF_FitA code to fit the LN+PL or LN+2PL form to the density PDF of star forming regions.
To use this:pipinstallpdffitOnce you have installed, you can use the following sample script -fromfitterimport*importnumpyasnpsample_data=np.load('./sample_data.npz')#xdata and ydata are just two arrays.xdata=sample_data['arr_0']ydata=sample_data['arr_1']sink=float(sample_data['arr_2'])params=Params(s_cut_off=sink)p0=[1.7,1.6,0.8,7.1]PLPLresult=PLPLFit(xdata,ydata,p0,params,use_K21=True)p0=[1.85,1.57]PLresult=PLFit(xdata,ydata,p0,params)print(PLresult.sigma_err,PLresult.alpha_err,PLPLresult.sigma_err,PLPLresult.sb)#To know more about how to access the result: help(Result)In case you want to dig deeper or just use the function for plotting:fromLNPLPL_functionsimport*fromLNPL_functionsimport*or whichever way you wish to import the modules and the functions within them.To get help on any function:help(function_name)If you're on the pypi page, please checkout the github version to get the sample data if you need.
Package: pdfflow
PDFFlowPDFFlow is parton distribution function interpolation library written in Python and based on theTensorFlowframework. It is developed with a focus on speed and efficiency, enabling researchers to perform very expensive calculation as quick and easy as possible.The key features of PDFFlow is the possibility to query PDF sets on GPU accelerators.DocumentationThe documentation for PDFFlow can be consulted in the readthedocs page:pdfflow.readthedocs.io.InstallationThe package can be installed with pip:python3-mpipinstallpdfflow[MODE]If you prefer a manual installation justcdin the cloned folder and use:pipinstall.[MODE]or if you are planning to extend or develop code just install the package in
editable mode:pipinstall-e.[MODE]PDFFlowassumes that the user has already installed the most optimized version
of TensorFlow for his platform. As such, by default,pipwill not check it as
a requirement.However, the user can also install it specifying aMODEoption in thepipcommand. The list below summarizes the valid choices for theMODEflag:tf: installs thetensorflowpackagetf-cpu: installs thetensorflow-cpupackagetf-gpu: installs thetensorflow-gpupackagetf-amd: installs thetensorflow-rocmpackage⚠ Note: Use the latest version of TensorFlow!TensorFlow is updated frequently and a later version of TensorFlow will often
offer better performance in both GPUs and CPUs.
Although it can be made to work with earlier versions,PDFFlowis only
supported for TensorFlow>2.1.PDF set managementPDFFlow does not do management of PDF sets, which is left to LHAPDF and so a lhapdf installation is needed.
A full lhapdf installation can be obtained by utilizing thelhapdf_managementlibrary.python3-mpipinstalllhapdf_managementlhapdf_managementinstallNNPDF31_nnlo_as_0118Minimal Working ExampleBelow a minimalistic example wherePDFFlowis used to generate a 10 values of the PDF
for 2 members for three different flavours.frompdfflowimportmkPDFsimporttensorflowastfpdf=mkPDFs("NNPDF31_nnlo_as_0118",[0,2])x=tf.random.uniform([10],dtype=tf.float64)q2=tf.random.uniform([10],dtype=tf.float64)*20+10pid=tf.cast([-1,21,1],dtype=tf.int32)result=pdf.xfxQ2(pid,x,q2)Note the usage of thedtypekeyword inm the TensorFlow calls.
This is used to ensure thatfloat64is being used all across the program.
For convenience, we ship two functions,int_meandfloat_mewhich are simply
wrappers totf.castwith the right types.These wrappers can be used over TensorFlow types but also numpy values:frompdfflowimportmkPDFs,int_me,float_meimporttensorflowastfimportnumpyasnppdf=mkPDFs("NNPDF31_nnlo_as_0118",[0,2])x=float_me(np.random.rand(10))q2=float_me(tf.random.uniform([10])*20+10)pid=int_me([-1,21,1])result=pdf.xfxQ2(pid,x,q2)Citation policyIf you use the package pelase cite the following paper and zenodo references:https://doi.org/10.5281/zenodo.3964190https://arxiv.org/abs/2009.06635
Package: pdfformfields
pdfformfieldspdfformfields is a Python wrapper aroundpdftkthat lets the user fill in forms
from a Python dictionary.PrerequisitesYou need to havepdftk serveron your computer installed.InstallingTo install, simply runpipinstallpdfformfieldsUsagefrompdfformfieldsimportfill_form_fields,generate_dictionary# Example pdf containing two fields with ids: first_name, last_nameexample_input_pdf="example_input.pdf"# Use generate_dictionary() with verbose=True to understand the structure# generate_dictionary(example_input_pdf, verbose=True)# Use generate_dictionary() without verbose=True to generate a copiable code for the field dictionary onto the consolegenerate_dictionary(example_input_pdf)""" The output should be:rename_me = {"first_name": ,"last_name": ,}"""# Paste code, rename dictionary, and fill in the values however you likeform_field_dictionary={"first_name":"John","last_name":"Doe",}# Output filled in dictionary with the fill_form_fields() functionexample_output_pdf=r"example_output.pdf"fill_form_fields(example_input_pdf,form_field_dictionary,example_output_pdf)# If you don't want the output to be editable set flatten=Trueexample_output_pdf_flattened=r"example_output_pdf_flattened.pdf"fill_form_fields(example_input_pdf,form_field_dictionary,example_output_pdf_flattened,flatten=True)See completeexample.Bash errorThe package did not manage to locate your pdftk command.Make sure that pdftk server is installed on your system.
If it is, try setting the pdftk argument of fill_form_fields to ...... on Linux:fill_form_fields(..., pdftk_command="pdftk")... on Windows:pdftk_path = os.path.join("path_to_pdftk_server_folder", "bin", "pdftk.exe")
fill_form_fields(..., pdftk_command=pdftk_path)Built WithpdftkAuthorNguyen Ba LongLicenseThis project is licensed under the GNU General Public License v3.0 - see theLICENSEfile for detailsAcknowledgmentspypdftkInspiration: another wrapper around pdftk that does not work under
Windows and Python 3.7, which is why this package was created.
Package: pdfformread
Copyright (c) 2016 Bart MasseyThis Python 2 library and command-line app facilitate
getting form data from PDF forms, using the PDFMiner
(http://www.unixuser.org/~euske/python/pdfminer) library for
extraction.  The code is originally fromhttp://stackoverflow.com/q/3984003/364875but with minor
changes for 2016 and for app.There are a lot of things that need to be improved here:Unicode and other character encoding handling is kludgy at best.Only text and selection elements of forms are supported.Subforms aren’t supported.This code is available under the “MIT License”.
Please see the file COPYING in this distribution
for license terms.
Package: pdfformulas
usage: pdfformulas.py [-h] [–dxmin DXMIN] [–frompage FROMPAGE][–topage TOPAGE] [–page PAGE] [–formulaid FORMULAID]
[–stats]
pdffileDump the formulas of a PDF as PNG files in theformulassubfolder. The
subfolderformulasis created, if not there yet. The PDF content must be
accessible as text.positional arguments:pdffile               PDF file to parse and dump formulas ofoptional arguments:-h,--helpshow this help message and exit--dxminDXMINAdditional left margin, which defines what is normal
text. If the text before a formula is the beginning of
a paragraph it might start a little indented. In this
case it helps to move dxmin to the right. Units are
those used in the PDF. Try 10.--frompageFROMPAGEPDF page number to start with.--topageTOPAGEPDF page number to stop at.--pagePAGEPDF page number--formulaidFORMULAIDThe regular expression by which a formula is found.
Formulas are recognized by their ID on the right. The
regular expression used is:: r’^s*(d*.d*)s* ‘
e.g.:: (2.13) To find the rectangle comprising the
formula the text before and after is located, which
begins on the left of the page (dxmin). The formula is
assumed to be indented with regard to normal text.--statsOnly print (formula,page)-refs statistics. This tells
which formulas are most often referenced in normal
text and are thus likely the most important ones.Requires: Pillow, PyMuPDF (needs compatible MuPDF installed), PdfMiner
Installation: LibMuPDF and PyMuPDF will need to be installed beforehand.
Package: pdf-fp
A brief description of the package:The package consists oftwo parts:First: Gaussian Probability Distribution Function:Gaussian Classis dealing with probability for periodsAll it need as attributesthe MeanandStandard Deviationrespictivelyand it will show all the information you want to know about the probability distribution function for more information you can usehelpfunction for Gaussian classSecond: Binomial Probability:All it needsthe probabilityandthe number of succeed trialsand it will also show all the other information likethe mean and Standard Deviation and etc..That was a quick and brief description for the package content, more information is provided in the dosstring of the classes.
Package: pdfgen
PDFGen-Python: HTML to PDF wrapperPython 3.6.1+ async wrapper forPyppeteerto convert HTML to PDF.NOTE:All the public API functions are adapted to async coroutines, so use them with await!This is adapted version ofpython-PDFKitlibrary, so big thanks to
them!InstallationInstall pdfgen:$pipinstallpdfgenTo download Chromium beforehand, run$ pdfgen-setup. Otherwise, it'll be downloaded on the first run of library.UsageFor simple async tasks:importpdfgenasyncdeff():awaitpdfgen.from_url('http://google.com','out.pdf')awaitpdfgen.from_file('test.html','out.pdf')awaitpdfgen.from_string('Hello!','out.pdf')Sync API is also provided atpdfgen.syncfor all the above-mentioned functions:importpdfgenpdfgen.sync.from_url('http://google.com','out.pdf')pdfgen.sync.from_file('test.html','out.pdf')pdfgen.sync.from_string('Hello!','out.pdf')You can pass a list with multiple URLs or files:pdfgen.sync.from_url(['google.com','yandex.ru','engadget.com'],'out.pdf')pdfgen.sync.from_file(['file1.html','file2.html'],'out.pdf')Also you can pass an opened file:withopen('file.html')asf:pdfgen.sync.pdfgen(f,'out.pdf')If you wish to further process generated PDF, you can read it to a
variable:# Ignore output_path parameter to save pdf to a variablepdf=pdfgen.sync.from_url('http://google.com')You can specify allPyppeteer
optionsused for saving PDF as shown below:options={'scale':2.0,'format':'Letter','margin':{'top':'0.75in','right':'0.75in','bottom':'0.75in','left':'0.75in',},'pageRanges':'1-5,8',}pdfgen.sync.from_url('http://google.com','out.pdf',options=options)You can also pass any options through meta tags in your HTML:body="""<html><head><meta name="pdfgen-format" content="Legal"/><meta name="pdfgen-landscape" content="False"/></head>Hello World!</html>"""pdfgen.sync.from_string(body,'out.pdf')ConfigurationEach API call takes an optional options parameter to configure print PDF behavior. However, to reduce redundancy, one can certainly set default configuration to be used for all API calls. It takes the
configuration options as initial paramaters. The available options are:options- the dict used by default for pyppeteerpage.pdf(options)call.optionspassed as argument to API call will take precedence over the default options.meta_tag_prefix- the prefix forpdfgenspecific meta tags - by
default this ispdfgen-.environ- the dict used to provide env variables to pyppeteer headless browser.importpdfgenpdfgen.configuration(options={'format':'A4'})asyncdeff():# The resultant PDF at 'output_file' will be in A4 size and 2.0 scale.awaitpdfgen.from_string(html_string,output_file,options={'scale':2.0})TroubleshootingInvalidSourceError:
Provided HTML source is invalid (maybe wrong URL or non-existing file)
Package: pdf-gen
Pdf_gen guideInstallingpip3 install pdf_genHow to usefrompdf_gen.pdf_genimportpdfmy_file=pdf(path,name)# path - path to your file, name - name of filemy_file.random_drawing(count)# count - count of drawingsmy_file.next_page()# turns the pagemy_file.set_font(size)# size - size of fontdata={'title':'Table title','columns':[{'name':'X_name','value':'x'},{'name':'Y_name','value':'y'}],'rows':[{'x':10,'y':20},{'x':5,'y':10}]}my_file.draw_table(data,x,y)# data - dict with data#  x and y - coordinates of left-bottom corner of tablemy_file.write_text(text,position,x,y)# text - string of text to writing, position - left/mid/right position#  of string of text, x and y - coordinates of stringmy_file.insert_image(path,x,y,width,height)# path - path to image,#  x and y - coordinates of left-bottom corner of image# width and height - sizes of imagemy_file.save(author,title)# author - author of file, title - title of fileExamplefrompdf_gen.pdf_genimportpdffile=pdf('c:/projects/pdf_generator/tests','compare')file.write_text('Testing file','right',350,800)file.next_page()data={'title':'Table title','columns':[{'name':'Name','value':'name'},{'name':'Age','value':'age'}],'rows':[{'name':'string1','age':23},{'name':'string2','age':43}]}file.draw_table(data)file.next_page()file.random_drawing(10)file.save()You can create some pdf and merge it into onefrompdf_gen.pdf_genimportpdf,merge_pdffile_names=['first','second','third','fourth']paths=[]forfile_nameinfile_names:page=pdf('/files/',f'{file_name}.pdf')paths.append(f'/files/{file_name}.pdf')page.write_text(file_name)page.random_drawing(10)page.save()merge_pdf(paths,'/files/res.pdf',True)
Package: pdfgetx3gui
pdfgetx3_guiA gui for running PDFgetX3. I think it's a little easier to use than the interactive mode in PDFgetX3. Requires PDFgetX3https://www.diffpy.org/products/pdfgetx.html, Scipy and PyQt(5) (pip or conda). Other common or standard packages required: numpy, matplotlib. The pdfgetx3_gui.py and pdffunctions.py scripts in the repository are required to run it.On cloning or downloading the repository, try running 'pip install -e .' in the directory. This should make an executable in the python Scripts folder which can be run from the command line as 'pdfgetx3gui' from any directory. If this doesn't work do "python pdfgetx3_gui.py" in the terminal. Plots update on changing parameter values. Log files are made to store the current configuration so the settings are the same on rerunning the script.Selected measurement files and background files are put into lists so they can be easily accessed again later. Press 'Plot' to run the calculation and display the selected plots (can choose any from I(Q), S(Q), F(Q), and G(r)). Pressing 'Save' will save text files containing the data of the selected plots. If the input format is '2theta', 'Save' will also return the background subtracted data as a function of 2theta with the name of <base file name>_bkgsub.xy.There's a rebinning option to reduce high Q noise. It's not so efficient, so could probably be faster.
Package: pdfgpt
pdfgptpdfgpt is a Python package that provides users with the ability to engage in natural language conversations with their PDF documents.Free software: MIT licenseDocumentation:https://pdfgpt.readthedocs.io.Source:Openai -https://github.com/openai/openai-cookbookHow to installEnvironments -> base (root) -> open terminal -> pip install pdfgptpip install pdfgptExamplefrompdfgptimport*d=PDFBot(openai_key='OPENAI_KEY')print('Example')extracted_text,num_pages=d.generateText(file_path='tests/epanet_matlab_toolkit.pdf')df=d.generateEmbeddings(extracted_text)print('USER: What is EPANET?')prompt=d.generatePrompt(df,num_pages,'What is EPANET?')response=d.sendPrompt(prompt,model="gpt-3.5-turbo")print('AI')print(response,'\n')What is EPANET?EPANET is a software for modeling water distribution systems’ hydraulic and quality dynamics, initially developed by the US Environmental Protection Agency in the C programming language in 1994. It uses a geometric representation of the pipe network, along with a set of initial conditions, rules of operation, and uses this information to compute flows, pressures, and water quality throughout the network, for a certain period of time.print('USER: Give me the command to load a network?')prompt=d.generatePrompt(df,num_pages,'Give me the command to load a network?')response=d.sendPrompt(prompt,model="gpt-3.5-turbo",temperature=0.9)print('AI')print(response)What is the command to load a network?The command to load a network is:G = epanet( â€™BWSN_Network_1 .inpâ€™);%Load EPANET Input fileG.loadMSXFile( â€™Arsenite .msxâ€™);%Load MSX fileFeaturesTODOCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2023-05-11)First release on PyPI.
Package: pdfgrid
Pdfgridis a Python command-line tool and module for adding a regular
grid on top of all pages of an existing PDF document. It will mostly be
used for measuring individual parts of PDF pages like graphics or paragraph
widths. For the time being, only a rectangular grid with major and minor
lines is supported, and their colour and line widths can be set individually.NOTE: This is an initial release. The API is likely to change and for the
time being the grid size is limited to A4, but this will change in future
releases.Pdfgriddepends on two Open Source libraries, namelypyPdf, a package written by
Mathieu Fenniak andreportlabby ReportLab, Ltd.This version fixes an issue with the manual installation.Featuresadd regular rectangular grid over all pages of a PDF documentdefine grid origin on all PDF pagesdefine grid styles containing grid step, line width and colouruse multiple grids at once with different stylinginstall a Python module namedpdfgrid.pyinstall a Python command-line script namedpdfgridprovide a Unittest test suiteExamplesYou can usepdfgridas a Python module e.g. like in the following
interactive Python session:>>> from reportlab.lib.colors import red
>>> from reportlab.lib.units import cm
>>> from pdfgrid import grid
>>> grid("foo.pdf", origin=(0, 0), styles=[(1*cm, 0.1, red)])
written: foo-grid.pdfIn addition there is a script namedpdfscript, which can be used
from the system command-line e.g. like this:$ pdfgrid -h
$ pdfgrid -v
$ pdfgrid --origin "0,0" --styles "1*cm,0.1,colors.red" foo.pdf
written: foo-grid.pdf
Package: pdfhandoutcrop
PdfHandoutCropA tool to crop pdf handout with multiple pages per sheetPdfHandoutCrop is a tool to crop pdf handout with multiple pages per sheet. Sometimes the teacher give us handout in pdf format with multiple pages per sheet. If I print it directly, the font size and pictures are too small to read. So I created PdfHandoutCrop to help me crop the handout.IssuesIf the PDF file is not cropped correctly or content in  output file is different from original file, there is a bug in PdfHandoutCrop. Pleasereport an issue.HomepageThe home page for PdfHandoutCrop is athttps://cges30901.github.io/pdfhandoutcrop/DownloadTo download PdfHandoutCrop, please go to thedownload page
Package: pdfharvester
PDFHarvesterPDFHarvester is a Python package for extracting tables, images, and keywords from PDF documents.InstallationYou can install PDFHarvester using pip:pipinstallPDFHarvesterUsageTo extract tables, images, and keywords from a PDF document using PDFHarvester, you can use the following functions:import pdfharvest as ph

tables = ph.extract_table('path/to/pdf')
images = ph.extract_images('path/to/pdf')
keywords = ph.extract_keywords('path/to/pdf')extract_tablereturns a list of pandas dataframes, one for each table in the PDF.extract_imagesreturns a list of images as numpy arrays, andextract_keywordsreturns a list of keywords as strings.#Contributing
Bug reports and pull requests are welcome on GitHub athttps://github.com/yourusername/PDFHarvester. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to theContributor Covenantcode of conduct.#License
The package is available as open source under the terms of theMIT License, © 2023 Hashim Puthiyakath.Please let me know if you have any further questions or concerns.
Package: pdf-hunter
pdf_hunterSearch for and download PDF file links from a webpage.InstallationThis has been tested using Python 3 and Python 2.7.pipinstallpdf_hunterUsageimportpdf_hunterurl="https://github.com/EbookFoundation/free-programming-books/blob/master/free-programming-books.md"pdf_urls=pdf_hunter.get_pdf_urls(url)pdf_urls[:10]['https://people.gnome.org/~swilmet/glib-gtk-dev-platform.pdf',
'https://www.math.upenn.edu/~wilf/AlgoComp.pdf',
'http://cslibrary.stanford.edu/110/BinaryTrees.pdf',
'http://www-inst.eecs.berkeley.edu/~cs61b/fa14/book2/data-structures.pdf',
'http://lib.mdp.ac.id/ebook/Karya%20Umum/Dsa.pdf',
'http://cslibrary.stanford.edu/103/LinkedListBasics.pdf',
'http://cslibrary.stanford.edu/105/LinkedListProblems.pdf',
'http://www.jjj.de/fxt/fxtbook.pdf',
'http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf',
'http://igm.univ-mlv.fr/~mac/REC/text-algorithms.pdf']We can download a single PDF file from a given urlpdf_url=pdf_urls[0]pdf_url'https://people.gnome.org/~swilmet/glib-gtk-dev-platform.pdf'file_name=pdf_hunter.get_pdf_name(pdf_url)file_name'glib-gtk-dev-platform.pdf'importosos.path.isfile(file_name)Falsepdf_hunter.download_file(pdf_url,folder_path=os.getcwd())os.path.isfile(file_name)TrueOr download all PDF files from the pagepdf_hunter.download_pdf_files(url,folder_path=os.getcwd())
Package: pdf-image-cropper
pdfcropperpdf-image-cropperis a tool to crop pdf files and converting them into png files.InstallationYou can installpdf-image-cropperby cloning this repository or by usingPip:$pipinstallpdf-image-cropperIf you want to use the development version, you can install directly from github:$pipinstall-egit+git://gitlab.com/ali7line/awesome-scripts/-/tree/master/pdf-image-cropperIf using, the development version, you might want to install dependencies as well:$ pip install -r requirements.txtNOTE: Only tested in Python3.7.9UsageJust runpdfcropper --helpto see the commands available options.The list of options available are:--config=<FILE>to specify your yaml config file to use--sample-config=<FILE>writres sample yaml config file with default options