Package: expdf
ExPDFOverviewExPDF is a tool that can generate citation relationship between PDFs, and create beautiful, interactive SVG figure inside Jupyter Notebook.QuickstartWithJupyter Notebook, it is easy to visuzlize citation relationship between PDFs.Firstly, download and install by:gitclonehttps://github.com/bupt-ipcr/expdfcdexpdf
pipinstall./Secondly, useexpdfto generate json file like:expdf-dpdfs/ASV-odata.jsonFinally, openjupyter notebookand try:importjsonfromexpdf.visualizeimportcreate_figwithopen('data.json','r')asf:data=json.load(f)fig=create_fig(data)figInstallationdownload expdf with github and install it with pipgitclonehttps://github.com/bupt-ipcr/expdfcdexpdf
pipinstall./runexpdf -hto see the help output:usage:expdf[-h][-aAPPEND_PDF][-r][-oOUTPUT_DIR]PDF_PATH

GeneratereferencerelationofallPDFs(givenorinsidePDF)positionalarguments:PDF_PATHPDFpath,ordirectoryofPDFsif-risused

optionalarguments:-h,--helpshowthishelpmessageandexit-aAPPEND_PDF,--appendAPPEND_PDFappendaPDFfile-d,--dir,--directorytreatPDF_PATHasadirectory-eEXCLUDE_PDF,--excludeEXCLUDE_PDFexcludeaPDFfile-oOUTPUT_DIR,-OOUTPUT_DIR,--outputOUTPUT_DIRoutputdirectory,defaultiscurrentdirectory-v,--vis,--visualizecreateahtmlfileforvisualize--vis-htmlHTML_FILENAMEoutputfilenameofhtmlvisualizeExamplessimply use epdf like:expdfpdfs/test.pdfTreat as a directorywith-dand it will scan all PDFs in specify directory:expdf-dpdfsAppend PDFswith-a, since there may be sporadic papers not in the same folder:expdf-dpdfs-a1.pdf-a2.pdfExclude PDFswith-e, to exclude some PDFs. Note that even if exclude pdf not exists,
there will be no error.expdf-dpdfs-etest.pdfTospecify output directory, use-o,-Oor--outputlike:expdfpdfs/test.pdf-O./urdirTogenerate visualize html file, use-vand--vis-htmllike:expdf-rpdfs/ASV-v--vis-html='vis.html'Usage as Python libraryHere we have three main parts of expdfs:ExPDFParser,Graphandrender.ExPDFParsera parser built top on pdfminer, look for metadata, links and references of a PDF file.# ensure you have ./tests/test.pdffromexpdfimportExPDFParserpdf=ExPDFParser("tests/test.pdf")print('title: ',pdf.title)print('info: ',pdf.info)print('metadata: ',pdf.metadata)print('Links: ')forlinkinpdf.links:print(f'-{link}')print('Refs: ')forrefinpdf.refs:print(f'-{ref}')PDFNodePDFNodeis a class that maintain a dict of all its instances. Two PDF that have same title(or just have difference in punctuations) will point to same node.LocalPDFNodeis a subclass ofPDFNode, which enables you to modify references of a PDF.usually it is used with parser like:fromexpdfimportExPDFParser,LocalPDFNodeexpdf_parser=ExPDFParser("tests/test.pdf")localPDFNode=LocalPDFNode(expdf_parser.title,expdf_parser.refs)pdf_info=PDFNode.get_json()print(pdf_info)otherwise, you can also assign title and refs without parser(maybe human is more precise than parser and regex expressions), just like:fromexpdf.graphimportPDFNode,LocalPDFNode# just a example, we wwill never see title like thisLocalPDFNode('title0',refs=['title1','title2'])LocalPDFNode('title1',refs=['title3'])LocalPDFNode('title2',refs=['title3'])pdf_info=PDFNode.get_json()print(pdf_info)visualizePDFNode give you infos of PDFs, such as citation relationship(show as parents and children). But why not visualize it?visuzlizeprovides a top-level functioncreate_figbuilt onnetworkx,plotly.networkxprovedes methods to  allocate positions
of all nodes andplotlyis a powerful visualization tool.renderinvokescreate_figand write it into html file.Visualize is recommended to be use insidejupyter notebook, since plotly only support events(click, hover, etc) with it.  You can use like:expdf-dpdfs/ASV-odata.json# in your jupyter notebookimportjsonfromexpdf.visualizeimportcreate_figwithopen('data.json','r')asf:data=json.load(f)fig=create_fig(data)figYou can also save it as html, just like:expdf-dpdfs/ASV-odata.json-v--vis-html=vis.htmlVariousAuthor: Jiawei Wu13260322877@163.comLicense: MIT