com.cete.dynamicpdf.pageelements.Html
Class HtmlArea
Examples |
Description |
Example 1 |
This example shows simple HTML being displayed on the page. |
Example 2 |
The following example shows you how to use the GetOverflowHtmlArea object.
|
Example 3 |
The following example shows you how to use the GetOverflowHtmlArea object. |
Example 1 : This example shows simple HTML being displayed on the page.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.html.*;
import java.net.URI;
import java.net.URISyntaxException;
public class MyClass {
public static void main(String args[]) {
// Create a PDF Document
Document document = new Document();
// Create a Uri
URI filePath = null;
try {
filePath = new URI("[physicalpath]/TestPage.html");
} catch (URISyntaxException ex) {
System.out.println("A URISyntaxException was caught :"+ ex.getMessage());
}
// Create a html area
HtmlArea htmlArea = new HtmlArea(filePath, 0, 0, 500, 600);
//Create a page
Page page = new Page();
// Add the html area to the page;
page.getElements().add(htmlArea);
// Add the page to the document
document.getPages().add(page);
// Save the PDF
document.draw("[Physicalpath]/MyDocument.pdf" );
}
}
Top
EXample 2 : The following example shows you how to use the GetOverflowHtmlArea object.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.html.*;
import java.net.URI;
import java.net.URISyntaxException;
public class MyClass {
public static void main(String args[]) {
// Create a PDF Document
Document document = new Document();
// Create a Uri
URI filePath = null;
try {
filePath = new URI("[physicalpath]/TestPage.html");
} catch (URISyntaxException ex) {
System.out.println("A URISyntaxException was caught :"+ ex.getMessage());
}
// create a html area
HtmlArea htmlArea = new HtmlArea(filePath, 0, 0, 500, 600);
do {
// Create a new page
Page page = new Page();
// Add the html area to the page;
page.getElements().add(htmlArea);
// Add the page to the document
document.getPages().add(page);
// Set the html area object equal to the rest of the html area that did not fit
// if all the html area did fit, GetOverflowHtmlArea will return null
htmlArea = htmlArea.getOverflowHtmlArea(0, 0, 600);
} while (htmlArea != null);
// Save the PDF
document.draw("[Physicalpath]/MyDocument.pdf" );
}
}
Top
Example 3 : The following example shows you how to use the GetOverflowHtmlArea object.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.html.*;
import java.net.URI;
import java.net.URISyntaxException;
public class MyClass {
public static void main(String args[]) {
// Create a PDF Document
Document document = new Document();
// Create a Uri
URI filePath = null;
try {
filePath = new URI("[physicalpath]/TestPage.html");
} catch (URISyntaxException ex) {
System.out.println("A URISyntaxException was caught :"+ ex.getMessage());
}
// create a html area
HtmlArea htmlArea = new HtmlArea(filePath, 0, 0, 500, 600);
do {
// Create a new page
Page page = new Page();
// Add the html area to the page;
page.getElements().add(htmlArea);
// Add the page to the document
document.getPages().add(page);
// Set the html area object equal to the rest of the html area that did not fit
// if all the html area did fit, GetOverflowHtmlArea will return null
htmlArea = htmlArea.getOverflowHtmlArea(0, 0, 600);
} while (htmlArea != null);
// Save the PDF
document.draw("[Physicalpath]/MyDocument.pdf" );
}
}
Top