Skip to content

Instantly share code, notes, and snippets.

View groupdocs-com-kb's full-sized avatar

groupdocs-com-kb

View GitHub Profile
@groupdocs-com-kb
groupdocs-com-kb / Render DOCX as JPG using Python.py
Last active August 27, 2025 05:37
Render DOCX as JPG using Python. For more information, please follow link: https://kb.groupdocs.com/
import groupdocs.viewer as gv
import groupdocs.viewer.options as gvo
# Load the DOCX from the file path.
with gv.Viewer("./input.docx") as viewer:
# Create JPG view options
viewOptions = gvo.JpgViewOptions("output_{0}.jpg")
# Render the document's pages to JPG images
viewer.view(viewOptions)
@groupdocs-com-kb
groupdocs-com-kb / Render DOCX as PNG using Python.py
Created August 27, 2025 05:34
Render DOCX as PNG using Python. For more information, please follow link: https://kb.groupdocs.com/
import groupdocs.viewer as gv
import groupdocs.viewer.options as gvo
# Load the DOCX from the file path.
with gv.Viewer("./SampleFiles/sample.docx") as viewer:
# Create PNG view options
viewOptions = gvo.PngViewOptions("output_{0}.png")
# Render the document's pages to PNG images
viewer.view(viewOptions)
@groupdocs-com-kb
groupdocs-com-kb / Render DOCX as Image using Python.py
Created August 27, 2025 05:10
Render DOCX as Image using Python. For more information, please follow link: https://kb.groupdocs.com/
import groupdocs.viewer as gv
import groupdocs.viewer.options as gvo
# Load the DOCX from the file path.
with gv.Viewer("./input.docx") as viewer:
# Create Image view options
viewOptions = gvo.PngViewOptions("output_{0}.png")
# Render the document into a set of PNG images
viewer.view(viewOptions)
@groupdocs-com-kb
groupdocs-com-kb / Render DOCX as HTML using Python.py
Created August 26, 2025 13:27
Render DOCX as HTML using Python. For more information, please follow link: https://kb.groupdocs.com/
import groupdocs.viewer as gv
import groupdocs.viewer.options as gvo
# Load the document from the file path.
with gv.Viewer("./input.docx") as viewer:
# Create HTML view options
viewOptions = gvo.HtmlViewOptions.for_embedded_resources("./page_{0}.html")
# Render the document to HTML
viewer.view(viewOptions)
@groupdocs-com-kb
groupdocs-com-kb / Render DOCX as PDF using Python.py
Created August 25, 2025 16:14
Render DOCX as PDF using Python. For more information, please follow link: https://kb.groupdocs.com/
import groupdocs.viewer as gv
import groupdocs.viewer.options as gvo
# Load the document from the file path.
with gv.Viewer("./input.docx") as viewer:
# Create PDF view options
viewOptions = gvo.PdfViewOptions("./output.pdf")
# Render the document to PDF
viewer.view(viewOptions)
@groupdocs-com-kb
groupdocs-com-kb / Convert RTF to PDF using Python.py
Last active August 23, 2025 10:12
Convert RTF to PDF using Python. For more information, please follow link: https://kb.groupdocs.com/conversion/python/convert-rtf-to-pdf-using-python/
import os
from groupdocs.conversion import Converter
from groupdocs.conversion.options.convert import PdfConvertOptions
# This code converts an RTF file to PDF format using GroupDocs.Conversion for Python.
# Load the source RTF file
converter = Converter("input.rtf")
# Set conversion options for PDF format
convert_options = PdfConvertOptions()
@groupdocs-com-kb
groupdocs-com-kb / Convert RTF to TXT using Python.py
Last active August 23, 2025 10:12
Convert RTF to TXT using Python. For more information, please follow link: https://kb.groupdocs.com/conversion/python/convert-rtf-to-txt-using-python/
import os
from groupdocs.conversion import Converter
from groupdocs.conversion.options.convert import WordProcessingConvertOptions
from groupdocs.conversion.filetypes import WordProcessingFileType
# This script converts an RTF file to TXT using GroupDocs.Conversion for Python.
# Load the source RTF file
converter = Converter("input.rtf")
# Set conversion options for TXT format
@groupdocs-com-kb
groupdocs-com-kb / Convert RTF to DOCX using Python.py
Last active August 23, 2025 10:13
Convert RTF to DOCX using Python. For more information, please follow link: https://kb.groupdocs.com/conversion/python/convert-rtf-to-docx-using-python/
import os
from groupdocs.conversion import Converter
from groupdocs.conversion.options.convert import WordProcessingConvertOptions
from groupdocs.conversion.filetypes import WordProcessingFileType
# This script converts an RTF file to DOCX using GroupDocs.Conversion for Python.
# Load the source RTF file
converter = Converter("input.rtf")
# Set conversion options for DOCX format
@groupdocs-com-kb
groupdocs-com-kb / Convert HTML to Image using Python.py
Last active August 15, 2025 06:29
Convert HTML to Image using Python. For more information, please follow link: https://kb.groupdocs.com/conversion/python/convert-html-to-image-using-python/
import os
from groupdocs.conversion import Converter
from groupdocs.conversion.options.convert import ImageConvertOptions
from groupdocs.conversion.filetypes import ImageFileType
# This code converts an HTML to Image format using GroupDocs.Conversion for Python.
# Ensure you have the GroupDocs.Conversion library installed
# Load the source HTML file
converter = Converter("input.html")
@groupdocs-com-kb
groupdocs-com-kb / Convert HTML to MHTML using Python.py
Last active August 15, 2025 06:34
Convert HTML to MHTML using Python. For more information, please follow link: https://kb.groupdocs.com/conversion/python/convert-html-to-mhtml-using-python/
import os
from groupdocs.conversion import Converter
from groupdocs.conversion.options.convert import WebConvertOptions
from groupdocs.conversion.filetypes import WebFileType
# This code converts an HTML to MHTML format using GroupDocs.Conversion for Python.
# Load the source HTML file
converter = Converter("input.html")
# Set conversion options for HTML format