Skip to content

Instantly share code, notes, and snippets.

View aspose-com-gists's full-sized avatar

Aspose.com Gists aspose-com-gists

View GitHub Profile
@aspose-com-gists
aspose-com-gists / html_to_pdf_conversion_complete_code_example.py
Created February 16, 2026 10:29
Boost Performance of HTML to PDF Conversion with Aspose.HTML in Python via .NET
import asyncio
import aspose.html as ahtml
from concurrent.futures import ThreadPoolExecutor
# Paths - update these to match your environment
HTML_INPUT = r"C:\Docs\sample.html"
PDF_OUTPUT = r"C:\Docs\sample_converted.pdf"
def create_converter():
# Load options with performance tweaks
@aspose-com-gists
aspose-com-gists / convert_ai_to_svg_complete_code_example.py
Created February 14, 2026 13:26
How to Convert AI Files to SVG in Python via .NET
import sys
from aspose.psd import Image
from aspose.psd.imageoptions import SvgExportOptions
def convert_ai_to_svg(input_path: str, output_path: str):
"""
Converts an AI file to SVG format.
Parameters:
input_pathPath to the source .ai file.
output_pathDesired path for the resulting .svg file.
using Aspose.Imaging;
using Aspose.Imaging.FileFormats.Png;
string dataDir = @"c:\Users\USER\Downloads\templates\";
string password = "veryStr0ngPassword";
using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Image.Load(Path.Combine(dataDir, @"template.png")))
{
image.EmbedDigitalSignature(password); // Embeds LSB-based signature data into the image using the specified password.
@aspose-com-gists
aspose-com-gists / convert_html_to_jpg_complete_code_example.py
Created February 11, 2026 10:09
How to Convert HTML to JPG with Python via .NET Using Aspose.HTML
import aspose.html as ah
from aspose.html import HtmlDocument, ImageSaveOptions, ImageFormat, Color
def convert_html_to_jpg(input_path: str, output_path: str,
width: int = 1200, height: int = 800,
dpi: int = 300, quality: int = 90) -> None:
"""
Converts an HTML file to a JPG image with the specified rendering options.
"""
try:
@aspose-com-gists
aspose-com-gists / convert_latex_to_bmp_complete_code_example.py
Created February 9, 2026 20:06
Step-by-Step Guide to Convert LaTeX to BMP with Python via .NET
import sys
import clr
import os
# Add reference to the Aspose.TeX .NET assembly
clr.AddReference("Aspose.TeX")
from Aspose.TeX import TeXDocument, RenderingOptions, ImageFormat
def render_latex_to_bmp(latex_path: str, output_path: str):
try:
@aspose-com-gists
aspose-com-gists / Aspose.SVG for .NET – SVG Styling, Fonts and DOM Management
Last active February 6, 2026 16:20
This Gist contains C# examples Aspose.SVG for .NET – SVG Styles and Fonts Management
Aspose.SVG for .NET – SVG Styling, Fonts and DOM Management
@aspose-com-gists
aspose-com-gists / convert_latex_to_png_complete_code_example.py
Created February 5, 2026 11:45
How to Convert LaTeX to PNG in Python
# Complete working example: Flask app that renders LaTeX to PNG
import io
from flask import Flask, request, send_file, abort
from aspose.tex import TexDocument, ImageFormat, RenderOptions
app = Flask(__name__)
def render_latex_to_png(latex_string):
"""
Renders the given LaTeX string to a PNG image and returns a BytesIO stream.
@aspose-com-gists
aspose-com-gists / convert_latex_to_png_complete_code_example.py
Created February 4, 2026 08:22
How to Convert LaTeX to PNG Using Aspose.Tex in Python via .NET
import io
from flask import Flask, request, send_file, abort
import aspose.tex as tex
from aspose.tex.render import ImageRenderOptions
app = Flask(__name__)
@app.route("/render", methods=["POST"])
def render_latex():
"""
import com.aspose.slides.*;
import java.io.FileOutputStream;
public class GenerateSvgFromSlides {
public static void main(String[] args) {
// Validate arguments
if (args.length < 2) {
System.out.println("Usage: java GenerateSvgFromSlides <input.pptx> <outputFolder>");
return;
}
@aspose-com-gists
aspose-com-gists / convert_csv_to_excel.cs
Created December 26, 2025 14:51
Convert CSV to Excel in C# with Aspose.cells
using Aspose.Cells;
using System;
class CsvToExcelConverter
{
static void Main()
{
// Path to the CSV file
string csvPath = "input.csv";
// Path to the output Excel file