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 / images_to_pdf.py
Created July 17, 2026 08:02
Generate PDF from Images in Python
import os
import io
from PIL import Image
import aspose.pdf as ap
# -------------------- Configuration --------------------
image_folder = "input_images" # Folder containing source images
output_pdf = "output/result.pdf" # Destination PDF file
jpeg_quality = 80 # Compression quality (0‑100)
@aspose-com-gists
aspose-com-gists / epub_to_pdf_advanced.cs
Created July 16, 2026 08:57
Convert EPUB to PDF in C#
using System;
using Aspose.Pdf;
using Aspose.Pdf.SaveOptions;
namespace EpubToPdfDemo
{
class Program
{
static void Main(string[] args)
{
@aspose-com-gists
aspose-com-gists / csv_to_pdf_converter.java
Created July 16, 2026 08:33
Convert CSV to PDF in Java
import com.aspose.pdf.Document;
import com.aspose.pdf.Page;
import com.aspose.pdf.Table;
import com.aspose.pdf.Row;
import com.aspose.pdf.Cell;
import com.aspose.pdf.FontRepository;
import com.aspose.pdf.Font;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
@aspose-com-gists
aspose-com-gists / pdf_barcode_embed.py
Created July 16, 2026 08:01
Add Barcode to PDF in Python
# Complete working example: add barcode to an existing PDF
from asposebarcode import BarcodeGenerator, EncodeTypes
from asposebarcode.generator import BarCodeImageFormat
from asposepdf import Document, ImageStamp
# 1. Generate barcode image in memory
barcode_generator = BarcodeGenerator(EncodeTypes.CODE_128, "INV-2023-001")
barcode_generator.parameters.image.width = 300
barcode_generator.parameters.image.height = 100
@aspose-com-gists
aspose-com-gists / pdf_booklet_bookmarks.py
Created July 8, 2026 09:57
Create PDF Booklet in Python
import aspose.pdf as ap
def create_pdf_booklet(input_path: str, output_path: str, add_bookmarks: bool = True):
# Load source PDF
source_doc = ap.Document(input_path)
# Initialize booklet
booklet = ap.Booklet()
booklet.layout_options = ap.BookletLayoutOptions()
booklet.layout_options.binding = ap.BookletBinding.LEFT
@aspose-com-gists
aspose-com-gists / csv_to_pdf.py
Created July 8, 2026 08:17
Convert CSV Data to PDF in Python
# Complete working code for CSV to PDF conversion
import pandas as pd
import aspose.pdf as ap
# Load CSV data using pandas
csv_path = "sample_data.csv"
df = pd.read_csv(csv_path)
# Create a new PDF document
@aspose-com-gists
aspose-com-gists / modify_pdf_annotations.py
Created July 8, 2026 06:49
Add or Remove Annotations in Python
import aspose.pdf as ap
# Load an existing PDF
pdf_path = "sample.pdf"
doc = ap.Document(pdf_path)
# -------------------------------------------------
# Add a Text Annotation (Sticky Note)
# -------------------------------------------------
text_annot = ap.annotations.TextAnnotation(doc.pages[1])
@aspose-com-gists
aspose-com-gists / readme.md
Created July 1, 2026 06:03
Complete Guide: Shapefile to CSV in Python

Complete Guide: Shapefile to CSV in Python

Learn to convert Shapefile to CSV in Python using Aspose.GIS for Python via .NET. You will learn the required installation steps, key Aspose.GIS features, handling null values, and performance tips for large datasets, plus a full working code example.

Read the full guide here: https://blog.aspose.com/gis/complete-guide-shapefile-to-csv-in-python/

@aspose-com-gists
aspose-com-gists / convert_kml_to_gpx.py
Created July 1, 2026 05:49
KML to GPX Conversion Tutorial in Python
import aspose.gis as gis
def convert_kml_to_gpx(input_kml_path: str, output_gpx_path: str):
# Load KML file
kml_file = gis.GisFile.open(input_kml_path, gis.GisFormat.KML)
# Ensure source CRS is known; if not, assume WGS‑84
source_crs = kml_file.get_spatial_reference()
if source_crs is None:
source_crs = gis.CoordinateSystem.wgs84()
@aspose-com-gists
aspose-com-gists / geojson_to_topojson.cs
Created July 1, 2026 05:14
GEOJSON to Topojson Conversion in .NET: Sample Guide
using System;
using System.IO;
using System.Threading.Tasks;
using Aspose.Gis;
using Aspose.Gis.Export;
using Aspose.Gis.Geometries;
namespace GeoJsonToTopoJsonDemo
{
class Program