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 / readme.md
Last active December 2, 2023 17:11
Split Documents using Java
View readme.md

Split Microsoft Word, Excel, Powerpoint and PDF documents using Java applications

@aspose-com-gists
aspose-com-gists / add-digital-signature-to-a-pdf-file.java
Last active December 2, 2023 14:56
Sign Documents using Java Applications
View add-digital-signature-to-a-pdf-file.java
Document document = new Document("unsignedFile.pdf");
PdfFileSignature signature = new PdfFileSignature(document);
PKCS7 pkcs = new PKCS7("/home/aspose/pdf-examples/Samples/test.pfx", "Pa$$w0rd2020"); // Use PKCS7/PKCS7Detached
// TimestampSettings timestampSettings = new TimestampSettings("https://freetsa.org/tsr", ""); // User/Password can be omitted // be omitted
// pkcs.setTimestampSettings(timestampSettings);
signature.sign(1, true, new java.awt.Rectangle(300, 100, 400, 200), pkcs);
signature.save("SignedFile.pdf");
@aspose-com-gists
aspose-com-gists / crop-image.md
Last active November 30, 2023 04:12
Crop Image in Circle
View crop-image.md
@aspose-com-gists
aspose-com-gists / convert-html-file-to-pdf.md
Created November 27, 2023 14:43
Convert HTML File to PDF
View convert-html-file-to-pdf.md
@aspose-com-gists
aspose-com-gists / crop-images-with-rectangle.py
Last active November 23, 2023 12:56
Crop Images in Python
View crop-images-with-rectangle.py
import aspose.pycore as aspycore
from aspose.imaging import RasterImage, Image, Rectangle
import os
if 'TEMPLATE_DIR' in os.environ:
templates_folder = os.environ['TEMPLATE_DIR']
else:
templates_folder = r"C:\Users\USER\Downloads\templates"
delete_output = 'SAVE_OUTPUT' not in os.environ
@aspose-com-gists
aspose-com-gists / graph-cut-feathering.cs
Created November 21, 2023 10:22
Remove Background of Images in C#
View graph-cut-feathering.cs
using Aspose.Imaging;
using Aspose.Imaging.FileFormats.Png;
using Aspose.Imaging.ImageOptions;
using Aspose.Imaging.Masking;
using Aspose.Imaging.Masking.Options;
using Aspose.Imaging.Masking.Result;
using Aspose.Imaging.Sources;
using System;
using System.IO;
@aspose-com-gists
aspose-com-gists / magic-wand.java
Created November 20, 2023 13:57
Java Magic Wand Tool
View magic-wand.java
import com.aspose.imaging.Image;
import com.aspose.imaging.RasterImage;
import com.aspose.imaging.magicwand.*;
import com.aspose.imaging.magicwand.imagemasks.*;
// get path of the input data
String templatesFolder = System.getenv("DATA_PATH");
// get output path
String outputFolder = System.getenv("OUT_PATH");
@aspose-com-gists
aspose-com-gists / open-and-read-word-documents.java
Created November 19, 2023 07:04
Read, Open, and View Documents via Java
View open-and-read-word-documents.java
Document wordDoc = new Document("wordFileToRead.docx");
for (Object obj : wordDoc.getChildNodes(NodeType.PARAGRAPH, true)) {
Paragraph para = (Paragraph)obj;
System.out.println(para.toString(SaveFormat.TEXT));
}
for (Object obj : wordDoc.getChildNodes(NodeType.RUN, true)){
Run run = (Run)obj;
Font font = run.getFont();
@aspose-com-gists
aspose-com-gists / add-diagonal-watermark-to-images.java
Last active December 1, 2023 05:59
Watermark Documents using Java
View add-diagonal-watermark-to-images.java
com.aspose.imaging.Image image = com.aspose.imaging.Image.load("sourceImage.png");
Graphics graphics= new Graphics(image);
Font font = new Font("Times New Roman", 16, FontStyle.Bold);
SolidBrush brush = new SolidBrush();
brush.setColor(Color.getBlack());
brush.setOpacity(100);
@aspose-com-gists
aspose-com-gists / merge-excel-files.java
Last active December 1, 2023 06:00
Merge Documents via Java
View merge-excel-files.java
Workbook excelFileOne = new Workbook("charts.xlsx");
Workbook excelFileTwo = new Workbook("Images.xlsx");
excelFileOne.combine(excelFileTwo);
excelFileOne.save("combined.xlsx");