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
File input = new File("input.html"); | |
Document doc = Jsoup.parse(input, "UTF-8", "https://some-website.com/"); | |
Elements links = doc.select("a[href]"); // a with href | |
Elements pngs = doc.select("img[src$=.png]"); | |
// img with src ending .png | |
Element masthead = doc.select("div.masthead").first(); | |
// div with class=masthead |
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
String html = "<html><head><title>First parse</title></head>" | |
+ "<body><p>Parsed HTML into a doc.</p></body></html>"; | |
Document doc = Jsoup.parse(html); |
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 org.apache.pdfbox.pdmodel.PDDocument; | |
import org.apache.pdfbox.text.PDFTextStripper; | |
import java.io.File; | |
import java.io.IOException; | |
public class PDFTextExtractor { | |
public static void main(String[] args) { | |
// Path to your PDF file | |
String filePath = "sample.pdf"; | |
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 org.apache.pdfbox.pdmodel.PDDocument; | |
import org.apache.pdfbox.pdmodel.PDPage; | |
import org.apache.pdfbox.pdmodel.PDPageContentStream; | |
import org.apache.pdfbox.pdmodel.font.PDType1Font; | |
import java.io.IOException; | |
public class CreatePDFExample { | |
public static void main(String[] args) { | |
// 1. Create a new empty document |
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
using UglyToad.PdfPig; | |
class PdfInspector | |
{ | |
public void Inspect(string filePath) | |
{ | |
using var document = PdfDocument.Open(filePath); | |
// Document metadata | |
Console.WriteLine($"Title: {document.Information.Title}"); |
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
using UglyToad.PdfPig; | |
using UglyToad.PdfPig.Content; | |
class TableExtractor | |
{ | |
public void AnalyzeDocument(string filePath) | |
{ | |
using var document = PdfDocument.Open(filePath); | |
foreach (var page in document.GetPages()) |
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
using UglyToad.PdfPig; | |
using System; | |
class Program | |
{ | |
static void Main() | |
{ | |
using var document = PdfDocument.Open("document.pdf"); | |
foreach (var page in document.GetPages()) |
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
$(document).ready(function() { | |
$('#advancedTree').jstree({ | |
'plugins': ['checkbox', 'dnd'], | |
'core': { | |
'data': [ | |
{ | |
"text": "Documents", | |
"state": { "opened": true }, | |
"children": [ | |
{ "text": "Project.docx", "type": "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
$(document).ready(function() { | |
$('#jsonTree').jstree({ | |
'core': { | |
'data': [ | |
{ | |
"text": "Root Node", | |
"children": [ | |
{ | |
"text": "Child Node 1", | |
"icon": "fa fa-file" |