GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java · thongh/Java@fe6b2e4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • itext-java-html-pdf/main/java/com/hmkcode
    • App.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎itext-java-html-pdf/main/java/com/hmkcode/App.java‎

Copy file name to clipboard
+33Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.hmkcode;
2+
3+
import java.io.FileInputStream;
4+
import java.io.FileOutputStream;
5+
import java.io.IOException;
6+
7+
import com.itextpdf.text.Document;
8+
import com.itextpdf.text.DocumentException;
9+
import com.itextpdf.text.pdf.PdfWriter;
10+
import com.itextpdf.tool.xml.XMLWorkerHelper;
11+
import com.itextpdf.tool.xml.pipeline.css.CSSResolver;
12+
13+
public class App
14+
{
15+
public static void main( String[] args ) throws DocumentException, IOException
16+
{
17+
// step 1
18+
Document document = new Document();
19+
// step 2
20+
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("pdf.pdf"));
21+
// step 3
22+
document.open();
23+
// step 4
24+
//CSSResolver cssResolver = XMLWorkerHelper.getInstance().getDefaultCssResolver(true);
25+
26+
XMLWorkerHelper.getInstance().parseXHtml(writer, document,
27+
new FileInputStream("index.html"));
28+
//step 5
29+
document.close();
30+
31+
System.out.println( "PDF Created!" );
32+
}
33+
}

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.