Closed LiangYuHai closed 1 year ago
@LiangYuHai Could you please attach your input and output documents here for testing? We will check the issue and provide you more information. Also, let us know in what environment you perform the conversion.
In addition as I can see you should like to convert the first page of the document to Jpeg. You do not need to use Document.extract_pages
method for this. Document.extract_pages
should be used if you need to extract page as a flow document (DOCX, DOC, RTF etc) in case of Fixed Page Formats (Images, PDF, XPS etc) you can simply specify page set in Fixed Page Save options:
doc = aw.Document(docs_base.my_dir + "in.docx")
options = aw.saving.ImageSaveOptions(aw.SaveFormat.JPEG)
# Set the "PageSet" to "0" to convert only the first page of a document.
options.page_set = aw.saving.PageSet(0)
doc.save(docs_base.artifacts_dir + "FirstPage.jpeg", options)
Please see the documentation for more information: https://docs.aspose.com/words/python-net/convert-a-document-to-an-image/
import aspose.words as aw
doc = aw.Document("2782884.doc")
for page in range(0, doc.page_count):
extractedPage = doc.extract_pages(page, 1)
extractedPage.save(f"Output_{page + 1}.jpg")
The words in .jpg are missing, no matter pdf or doc. Is the version broken?