I am writing a webapp and as part of it, I use libreoffice in headless mode to convert docx and pptx files to pdfs (for future processing). How can I set the page size of the output pdf to be the same as the size of the input docx/pptx? At the moment the output pdf is sometimes a different size, leading to the output pdf having some images cropped and a differing number of pages from the original image.
For reference, this is the command I am currently using:
libreoffice --headless --convert-to pdf:writer_pdf_Export --outdir output_dir input_path
Could I maybe run a command to get the page size of the input pdf and then set the output pdf to have this same page size?
Any help is much appreciated. Thanks!