-1

I am looking to save multiple excel worksheets as a PDF and then merge them all into one.

I need to do this without win32.client - is this possible?

flaws49
  • 29
  • 6

1 Answers1

1

If you want to save an excel file as a pdf, you can use asposecells and jpype:

import jpype
import asposecells
jpype.startJVM()
from asposecells.api import Workbook, FileFormatType, PdfSaveOptions

workbook = Workbook("example.xlsx")
saveOptions = PdfSaveOptions()
saveOptions.setOnePagePerSheet(True)
workbook.save("example.pdf", saveOptions)

jpype.shutdownJVM()

You can find more information here: https://pypi.org/project/aspose-cells/

In order to merge pdf's with python you can use PyPdf2's PdfMerger:

from PyPDF2 import PdfFileMerger
pdfs = ['file1.pdf', 'file2.pdf', 'file3.pdf', 'file4.pdf']

merger = PdfFileMerger()

for pdf in pdfs:
    merger.append(pdf)

merger.write("result.pdf")
merger.close()

You can read more about this in this post: Merge PDF files

tuurtje11
  • 189
  • 1
  • 8
  • Thank you! Do you know if there is a way to remove the "Evaluation Only. Created with Aspose.Cells for Python via Java.Copyright 2003 - 2022 Aspose Pty Ltd." from the PDF files that this creates? – flaws49 Mar 17 '22 at 08:36
  • Hi, I hope this will help you: https://forum.aspose.com/t/evaluation-only-does-not-go-away/135652 – tuurtje11 Mar 17 '22 at 16:29
  • If you want to use Aspose.Cells without evaluation warning and version limitations, you need to have license to use it with full capacity. Please refer to document (https://docs.aspose.com/cells/java/licensing/) for your reference. PS. I am working as Support developer/ Evangelist at Aspose – Amjad Sahi Mar 17 '22 at 19:04