Ypu should initialize PdfItDown by instantiating the Converter class:
Copy
from pdfitdown.pdfconversion import Converterconverter = Converter()
After this, you can use PdfItDown to:
Convert single files using the convert method:
Copy
# adding a title for the PDF metadataconverter.convert(file_path = "business_grow.md", output_path = "business_growth.pdf", title="Business Growth for Q3 in 2024")# without a titleconverter.convert(file_path = "logo.png", output_path = "logo.pdf")
Convert multiple files at once using the multiple_convert method:
Copy
# with custom output pathsconverter.multiple_convert(file_paths = ["business_grow.md", "logo.png"], output_paths = ["business_growth.pdf", "logo.pdf"])# with inferred output pathsconverter.multiple_convert(file_paths = ["business_grow.md", "logo.png"])
Convert an entire directory at once using the convert_directory method: