This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.github.davidmoten.pandoc.Pandoc; | |
import java.nio.file.*; | |
import java.util.*; | |
/** | |
* Generates legal contracts using custom Pandoc templates with dynamic variables. | |
* Features: | |
* - YAML front-matter injection for client-specific terms | |
* - Conditional clauses via Pandoc filters | |
* - Multi-format output (PDF for signing, DOCX for editing) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.github.davidmoten.pandoc.Pandoc; | |
import java.io.*; | |
/** | |
* Converts HTML business reports to MS Word (DOCX) with corporate styling. | |
* Features: | |
* - Preserves tables, images, and CSS classes from HTML | |
* - Applies custom DOCX template (e.g., company-branded styles) | |
* - Handles embedded base64 images | |
* - Post-processes with Office-Open-XML (OOXML) hooks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.github.davidmoten.pandoc.Pandoc; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
/** | |
* Converts academic Markdown (with LaTeX math and citations) to PDF using Pandoc. | |
* Requires: | |
* - Pandoc installed (v2.11+) | |
* - LaTeX distribution (e.g., TeX Live/MiKTeX) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import PDF Clown annotation and action classes | |
import org.pdfclown.documents.Document; | |
import org.pdfclown.documents.Page; | |
import org.pdfclown.documents.interaction.annotations.Link; | |
import org.pdfclown.documents.interaction.actions.GoToURI; | |
import org.pdfclown.files.File; | |
import org.pdfclown.documents.interaction.navigation.document.Destination; | |
import org.pdfclown.documents.interaction.navigation.document.LocalDestination; | |
import java.awt.geom.Rectangle2D; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import PDF Clown text extraction classes | |
import org.pdfclown.documents.Document; | |
import org.pdfclown.documents.Page; | |
import org.pdfclown.files.File; | |
import org.pdfclown.tools.TextExtractor; | |
public class ExtractTextFromPDF { | |
public static void main(String[] args) { | |
try { | |
// 1. Load an existing PDF file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import PDF Clown core classes | |
import org.pdfclown.documents.Document; | |
import org.pdfclown.documents.Page; | |
import org.pdfclown.documents.contents.composition.PrimitiveComposer; | |
import org.pdfclown.documents.contents.fonts.StandardType1Font; | |
import org.pdfclown.files.File; | |
import java.awt.geom.Point2D; | |
public class CreateBasicPDF { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.lowagie.text.Document; | |
import com.lowagie.text.Font; | |
import com.lowagie.text.FontFactory; | |
import com.lowagie.text.Paragraph; | |
import com.lowagie.text.pdf.PdfAConformanceLevel; | |
import com.lowagie.text.pdf.PdfAWriter; | |
import com.lowagie.text.pdf.PdfReader; | |
import com.lowagie.text.pdf.ICC_Profile; | |
import java.io.FileOutputStream; | |
import java.io.InputStream; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.lowagie.text.Document; | |
import com.lowagie.text.Font; | |
import com.lowagie.text.FontFactory; | |
import com.lowagie.text.Paragraph; | |
import com.lowagie.text.pdf.PdfPTable; | |
import com.lowagie.text.pdf.PdfWriter; | |
import java.io.FileOutputStream; | |
public class PdfTableExample { | |
public static void main(String[] args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.lowagie.text.Document; | |
import com.lowagie.text.Font; | |
import com.lowagie.text.FontFactory; | |
import com.lowagie.text.Paragraph; | |
import com.lowagie.text.pdf.PdfWriter; | |
import java.io.FileOutputStream; | |
public class SimplePdfCreator { | |
public static void main(String[] args) { | |
// Step 1: Create a Document object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Element div = doc.select("div").first(); // <div></div> | |
div.html("<p>lorem ipsum</p>"); // <div><p>lorem ipsum</p></div> | |
div.prepend("<p>First</p>"); | |
div.append("<p>Last</p>"); | |
// now: <div><p>First</p><p>lorem ipsum</p><p>Last</p></div> | |
Element span = doc.select("span").first(); // <span>One</span> | |
span.wrap("<li><a href='http://example.com/'></a></li>"); | |
// now: <li><a href="http://example.com"><span>One</span></a></li> |
NewerOlder