Supported
Configurations
Example usage
sferyx.administration.pdfgenerator.PDFGenerator pdfGenerator=new
sferyx.administration.pdfgenerator.PDFGenerator();
pdfGenerator.generatePDFFromURL("http://your_url_here",
destinationStream, "Letter", "Portrait");
Generates PDF automatically for given URL. It will generate
the file using the given standard page format string such as
"A4", "Letter" etc. and and save the file to the given
OutputStream and page orientation such as "Portrait" or
"Landscape". You can also set the page margins using the
method setMarginsForStandardPageFormat
pdfGenerator.generatePDFFromContent("your HTML content
here", destinationStream, new java.awt.PageFormat());
Generates PDF automatically for given html content. It will
generate the file using the given PageFormat and and save the file to
the given OutputStream.
pdfGenerator.generatePDFFromContent("your HTML content
here", destinationStream, "Letter", "Portrait");
Generates PDF automatically for given html content. It will
generate the file using the given standard page format
string such as "A4", "Letter" etc. and and save the file to
the given OutputStream and page orientation such as
"Portrait" or "Landscape". You can also set the page margins
using the method setMarginsForStandardPageFormat
pdfGenerator.generatePDFFromPlainTextContent("your text
content here", destinationStream, "Letter", "Portrait");
Generates PDF automatically for given plain text content. It
will generate the file using the given standard page format
string such as "A4", "Letter" etc. and and save the file to
the given OutputStream and page orientation such as
"Portrait" or "Landscape". You can also set the page margins
using the method setMarginsForStandardPageFormat
pdfGenerator.generatePDFFromPlainTextContent("your HTML content
here", destinationStream, new java.awt.PageFormat());
Generates PDF automatically for given plain text content. It will
generate the file using the given PageFormat and and save the file to
the given OutputStream.
pdfGenerator.generatePDFFromURL("http://your_url_here",
"c:/pdfgenerator-test1.pdf");
Generates PDF
automatically for given URL source. It will display a
PageFormat dialog and save the file to the given destination
file
pdfGenerator.generatePDFFromURL("http://your_url_here");
Generates PDF
automatically for given URL source. It will display a
PageFormat dialog and file dialog for saving the generated
file
pdfGenerator.generatePDFFromURL("http://your_url_here",
"c:/pdfgenerator-test1.pdf", new java.awt.PageFormat());
Generates PDF
automatically for given URL source. It generate the file
using the given java.awt.PageFormat and save the file to the
given destination file
pdfGenerator.generatePDFFromURL("http://your_url_here",
"c:/pdfgenerator-test1.pdf", "A4", "Portrait");
or
pdfGenerator.generatePDFFromURL("http://your_url_here",
"c:/pdfgenerator-test1.pdf", "Letter", "Landscape");
Generates PDF
automatically for given html content. It will generate the
file using the given standard page format string such
as "A4", "Letter" etc. and and save the file to the given
File and page orientation such as "Portrait" or "Landscape".
You can also set the page margins using the method
setMarginsForStandardPageFormat
pdfGenerator.generatePDFFromPlainTextContent("some text
here", "c:/pdfgenerator-test1.pdf", "Letter", "Landscape");
Generates PDF
automatically for given text content. It will generate the
file using the given standard page format string such as
"A4", "Letter" etc. and and save the file to the given File
and page oriantation such as "Portrait" or "Landscape". You
can also set the page margins using the method
setMarginsForStandardPageFormat
pdfGenerator.generatePDFFromPlainTextContent("some HTML
content here", "c:/pdfgenerator-test1.pdf", "Letter",
"Landscape");
Generates pdf
automatically for given html content. It will generate the
file using the given standard page format string such as
"A4", "Letter" etc. and and save the file to the given File
and page oriantation such as "Portrait" or "Landscape". You
can also set the page margins using the method
setMarginsForStandardPageFormat
pdfGenerator.setHeader("<h1
style=\"color:red;\">This is a Header</h1>");
Generates the header for each
page in the document. The parameter content can be any plain
text or HTML string - it will be parsed and rendered as a
header on the pages. You can includes any HTML element such
as images, tables, colors etc. Keep in mind to adjust the
top margin in order to make enough room for the header if
necessary.
pdfGenerator.setFooter("<h3
style=\"color:blue;\">This is a Footer</h3>");
Geneates the footer for each
page in the document. The parameter content can be any plain
text or HTML string - it will be parsed and rendered as a
footer on the pages. You can includes any HTML element such
as images, tables, colors etc. Keep in mind to adjust the
bottom margin in order to make enough room for the footer if
necessary.
pdfGenerator.setDiscardEmptyPages(true);
Specifies to automatically
discard all pages that do not contain text and are
practically a blank pages.
pdfGenerator.setGeneratePageNumbers(true,"<p
align=center style=\"padding-top:30px;border-top:1px solid
#0000FF;\"><font face=\"arial\" color=\"blue\">Page: @#SferyxPDFGenerator-PageNumber#@</font></p>");
Generates page numbers for each
page in the document. The parameter content can be any plain
text or HTML string - it will be parsed and rendered
practically as footer in the pages and will parse the
special directive "@#SferyxPDFGenerator-PageNumber#@" in
order to place the page number inside the custom formatting.
You can includes any HTML element such as images, tables,
colors etc. Keep in mind to adjust the top margin in order
to make enough room for the page numbering if necessary.
pdfGenerator.setDoNotBreakTablesAcrossPages(true);
If set to true, the PDFGenerator
will try to not break tables when page break is encountered
if the table is not longer than the page height. The default
value is false
pdfGenerator.setDoNotBreakListsAcrossPages(boolean
disablebreak)
If set to true, the PDFGenerator
will try to not break tables when page break is encountered
if the table is not longer than the page height. The default
value is false
Further you can manage the page breaks through the standard
CSS properties
page-break-before:always,
page-break-after:always, page-break-inside:never, by
specifying them inside the document like this:
<div
style="page-break-before:always">some text</div>
or
<table style="page-break-after:always">some text ...</table>
or
<p
style="page-break-inside:never">some text...</p>
|