0.0.171
This commit is contained in:
		| @@ -521,6 +521,9 @@ guan.change_directory_by_replacement(current_key_word='code', new_key_word='data | |||||||
|  |  | ||||||
| # Module 14: others | # Module 14: others | ||||||
|  |  | ||||||
|  | # 拼接两个PDF文件 | ||||||
|  | guan.combine_two_pdf_files(input_file1='a.pdf', input_file2='b.pdf', output_file='combined_file.pdf') | ||||||
|  |  | ||||||
| # 通过Sci-Hub网站下载文献 | # 通过Sci-Hub网站下载文献 | ||||||
| guan.download_with_scihub(address=None, num=1) | guan.download_with_scihub(address=None, num=1) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| [metadata] | [metadata] | ||||||
| # replace with your username: | # replace with your username: | ||||||
| name = guan | name = guan | ||||||
| version = 0.0.170 | version = 0.0.171 | ||||||
| author = guanjihuan | author = guanjihuan | ||||||
| author_email = guanjihuan@163.com | author_email = guanjihuan@163.com | ||||||
| description = An open source python package | description = An open source python package | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| Metadata-Version: 2.1 | Metadata-Version: 2.1 | ||||||
| Name: guan | Name: guan | ||||||
| Version: 0.0.170 | Version: 0.0.171 | ||||||
| Summary: An open source python package | Summary: An open source python package | ||||||
| Home-page: https://py.guanjihuan.com | Home-page: https://py.guanjihuan.com | ||||||
| Author: guanjihuan | Author: guanjihuan | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| # With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing. | # With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing. | ||||||
|  |  | ||||||
| # The current version is guan-0.0.170, updated on June 19, 2023. | # The current version is guan-0.0.171, updated on June 28, 2023. | ||||||
|  |  | ||||||
| # Installation: pip install --upgrade guan | # Installation: pip install --upgrade guan | ||||||
|  |  | ||||||
| @@ -3135,6 +3135,22 @@ def download_with_scihub(address=None, num=1): | |||||||
|  |  | ||||||
| ## PDF | ## PDF | ||||||
|  |  | ||||||
|  | # 拼接两个PDF文件 | ||||||
|  | def combine_two_pdf_files(input_file1='a.pdf', input_file2='b.pdf', output_file='combined_file.pdf'): | ||||||
|  |     import PyPDF2 | ||||||
|  |     output_pdf = PyPDF2.PdfWriter() | ||||||
|  |     with open(input_file1, 'rb') as file1: | ||||||
|  |         pdf1 = PyPDF2.PdfReader(file1) | ||||||
|  |         for page in range(len(pdf1.pages)): | ||||||
|  |             output_pdf.add_page(pdf1.pages[page]) | ||||||
|  |     with open(input_file2, 'rb') as file2: | ||||||
|  |         pdf2 = PyPDF2.PdfReader(file2) | ||||||
|  |         for page in range(len(pdf2.pages)): | ||||||
|  |             output_pdf.add_page(pdf2.pages[page]) | ||||||
|  |     with open(output_file, 'wb') as merged_file: | ||||||
|  |         output_pdf.write(merged_file) | ||||||
|  |  | ||||||
|  |  | ||||||
| # 获取PDF文献中的链接。例如: link_starting_form='https://doi.org' | # 获取PDF文献中的链接。例如: link_starting_form='https://doi.org' | ||||||
| def get_links_from_pdf(pdf_path, link_starting_form=''): | def get_links_from_pdf(pdf_path, link_starting_form=''): | ||||||
|     import PyPDF2 |     import PyPDF2 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user