public class Pdf extends Object
Represents the Pdf document.
Pdf pdf1 = new Pdf(); pdf1.getPageSetup().setPageHeight(PageSize.A4_HEIGHT); Section sec1 = pdf.getSections().add(); Text text1 = new Text(sec1,"this is text content"); text1.getMargin().setTop(30); sec1.getParagraphs().add(text1); pdf1.save(...); [XML] <?xml version="1.0" encoding="utf-8" ?> <Pdf xmlns="Aspose.Pdf"> <Section PageHeight="1684"> <Text MarginTop="30"> <Segment>this is text content</Segment> </Text> </Section> </Pdf>
Modifier and Type | Class and Description |
---|---|
static class |
Pdf.HeaderFooterEvaluationArgs
Contains parameters for HeaderFooterEvaluation Event
|
class |
Pdf.HeaderFooterEvaluationDelegate |
static class |
Pdf.InconsistentXmlImageParamsHandlingTypes |
class |
Pdf.OnFlushDelegate
Gets or sets event that raise when stream have more than
DirectModeCurrentItemValue items
|
Constructor and Description |
---|
Pdf()
Initializes a new instance of the
Pdf class for Evaluation
License. |
Pdf(InputStream docStream) |
Modifier and Type | Method and Description |
---|---|
boolean |
addSuitableCustomFontIfNecessary(TextInfo textInfo) |
void |
bindFO(InputStream xmlStream)
Binds a FO content, that got after applying of supplies XSLT to supplied
XML, into the Pdf instance.
|
void |
bindFO(InputStream xmlStream,
InputStream xsltStream)
Binds a FO content, that got after applying of supplies XSLT to supplied
XML, into the Pdf instance.
|
void |
bindFO(String xmlFoFileName)
Binds a FO file into the Pdf instance.
|
void |
bindFO(com.aspose.ms.System.Xml.XmlDocument xmlFoFileBody)
Binds a FO file into the Pdf instance.
|
void |
bindFO(com.aspose.ms.System.Xml.XmlDocument xmlFoFileBody,
String xmlFoFileImagePath)
Binds a FO file into the Pdf instance.
|
void |
bindFO(com.aspose.ms.System.Xml.XmlDocument foXmlDocument,
com.aspose.ms.System.Xml.XmlDocument foXslDocument)
Binds a FO file into the Pdf instance.
|
void |
bindHTML(com.aspose.ms.System.IO.Stream htmlSourceStream,
String basePathIfAny)
Binds a HTML into the Pdf instance.
|
void |
bindHTML(String html)
Binds a HTML into the Pdf instance.
|
void |
bindHTML(String html,
String basePath)
Binds a HTML into the Pdf instance.
|
void |
bindPCL(String pclFileName)
Binds an PCL document to the
T:Aspose.Pdf.Pdf object. |
void |
bindSvg(String svgFileName)
Read svg markup area in to Pdf document section
|
void |
bindSvg(String svgFileName,
boolean ajustPdfToSvg)
Read svg markup area in to Pdf document section svg File or Svg fragment markup text whether sizes of created PDF will be set according
to sizes referenced in SVG
|
void |
bindXML(InputStream xmlStream,
InputStream xslStream) |
void |
bindXML(String xmlFile,
String xslFile)
Binds an xml/xsl document to the
Pdf object. |
void |
bindXML(com.aspose.ms.System.Xml.XmlDocument xmlDoc,
String xslFile)
Create Svg formatted document output using ApsPage set as source
|
void |
close()
Close the document.
|
void |
collectObjectsToCache() |
static Object |
createObjFromXml(InputStream xmlStream,
InputStream xslStream) |
static Object |
createObjFromXml(String xmlFile,
String xslFile)
Gets the xml file with Aspose's xml format from HTML.
|
static Object |
createObjFromXml(com.aspose.ms.System.Xml.XmlDocument xmlDoc,
com.aspose.ms.System.Xml.XslTransform xsl)
Reads object info from a xml document.
|
static byte[] |
createTruetypeFontMapStream() |
AssignInfo |
getAssignInfoForDirectWright() |
String |
getAuthor()
Gets or sets a string that indicates the author of the Pdf document.
|
Color |
getBackgroundColor()
Gets a
aspose.pdf.Color object that indicates the background
color of the pdf. |
TextInfo |
getBackupTextInfo() |
int |
getBookmarkLevel()
Gets or sets a int value that indicates how many levels of
Heading of the pdf document is to be bookmarked. |
int |
getBookMarkLevel()
Deprecated.
|
Bookmarks |
getBookmarks()
Gets or sets a
Bookmarks object that indicates the bookmarks in
the PDF. |
byte[] |
getBuffer()
Gets the data buffer used to generate the pdf document in memory.
|
int |
getCompressionLevel()
Gets or sets an int value that indicates the compression level.
|
int |
getConformance()
null null null null null null null null null {@code
NOTE: This is beta version of PdfA. |
int |
getConsecutiveHyphens()
Gets or sets the number of consecutive hyphens.
|
int |
getConsecutiveHyphensLimits()
Gets or sets an integer value that indicates the consecutive hyphens
limits.
|
String |
getCreator()
Gets or sets a string that indicates the creator of the Pdf document.
|
CustomFonts |
getCustomFonts() |
String |
getDefaultFontName()
Gets or sets a string that indicates the default font name.
|
int |
getDestinationType()
Gets or sets a
DestinationType value that indicates the document
open action. |
boolean |
getDigitSubstitution()
Gets or set bool value that indicates whether to replace digits with
national ones in macros'
|
int |
getDirectModeCurrentItemValue() |
int |
getDirectModeItemsCount() |
int |
getDirectModeItemType()
Gets or sets a DirectModeItemType value that indicates
DirectModeItemsCount measure The default value is DirectModeItemType.Page
|
com.aspose.ms.System.IO.Stream |
getDocStream() |
DocumentAttachments |
getDocumentAttachments()
Gets or sets a
DocumentAttachments which will be added upon the
PDF document. |
int |
getEndNoteNumberInDoc() |
Heading |
getFirstHeading()
Represents a Heading object that indicates the first heading in this
document.
|
int |
getFirstLineIndent()
Gets or sets an int value that indicates the indent of the first line.
|
Substitute |
getFirstSubstitute()
Gets or sets a Substitute object that indicates the first substitutor in
the document.
|
IFontUriResolver |
getFontResolver() |
int |
getFootNoteNumberInDoc() |
GeneratorBase |
getGeneratorBase() |
GraphInfo |
getGraphInfo()
Gets or sets a
GraphInfo object that indicates the graph info in
the Pdf document. |
DocumentBase.HeadingInfoArray |
getHeadingInfos()
Gets or sets a HeadingInfoArray object that indicates the heading info.
|
HtmlInfo |
getHtmlInfo()
Gets or sets a
HtmlInfo object that indicates the necessary info
when converting HTML to PDF. |
String |
getHyphenationDictionaryPath()
Gets or sets a string that indicates the hyphenation dictionary path.
|
float |
getHyphenationZoneWidth()
Gets or sets a float value that indicates the hyphenation area width.
|
Hashmap |
getHyphenDicMap()
Gets or sets the number of consecutive hyphens.
|
com.aspose.ms.System.Xml.XmlDocument |
getHyphenDictionary()
Gets or sets a hyphenation Dictionay file.
|
Index |
getIndex()
Gets or sets an
Index object. |
JavaScripts |
getJavaScripts()
Gets or sets a
JavaScripts object that indicates the JavaScripts
to be added into the PDF. |
String |
getKeywords()
Gets or sets a string that indicates key words of the Pdf document.
|
float |
getLabelWidth()
Gets or sets a float value that indicates the width of the heading label.
|
Substitute |
getLastSubstitute()
Gets or sets a Substitute object that indicates the last substitutor in
the document.
|
boolean |
getLinearized()
Gets or sets a bool value that indicates if the document needs to be
linearized (optimization for web access) .
|
ListSection |
getListOfFigures() |
ListSection |
getListOfTables() |
Object |
getObjectByID(String ID)
Gets a object with specified ID in the document.
|
Object |
getObjectByIDUsingHash(String paragraphId) |
Object |
getObjectFromCache(String paragraphId) |
int |
getOpenType()
Gets or sets a
OpenType that indicates the document open type. |
int |
getPageCount()
Gets a int value that indicates the pages count of the generated PDF.
|
int |
getPageDuration()
Gets or sets a int value that indicates the duration in seconds for the
current page.
|
int |
getPageNumber(String ID)
Gets the page number of a paragraph when the PDF is generated.
|
int |
getPageNumberFormat()
Gets or sets a
PageNumberFormatType value that indicates the
format of the page number . |
Page |
getPages() |
PageSetup |
getPageSetup()
Gets or sets a
PageSetup object that indicates the page setup
info in the Pdf document. |
int |
getPagesNumber()
Represents an int value that indicates the current pages number.
|
int |
getPageTransitionType()
Gets or sets a
PageTransitionType that indicates the pdf document
page transition type. |
String |
getProducer()
Gets a string that indicates the producer of the Pdf document.
|
Sections |
getSections()
Gets or sets a
Sections collection that indicates all sections in
the Pdf document. |
Security |
getSecurity()
Gets or sets a
Aspose.Pdf.Security object that indicates the
document security information. |
float |
getStringWidth(String str,
TextInfo info) |
String |
getSubject()
Gets or sets a string that indicates the subject of the Pdf document.
|
aspose.pdf.TablesOfContents |
getTablesOfContents() |
float |
getTabStopPosition()
Gets or sets the tab stop position.
|
String |
getTempFolder()
Gets or sets a value that indicates where temporary files stored.
|
GeneratorBase |
getTempGenerator() |
TextInfo |
getTextInfo()
Gets or sets a
TextInfo object that indicates the text info in
the Pdf document. |
static int |
getTimeOutOfFileWebRequest()
Gets or sets the length of time until the request times out for the Pdf
document.
|
String |
getTitle()
Gets or sets a string that indicates the title of the Pdf document.
|
String |
getTruetypeFontMapPath()
Gets or set a string that indicates the path of the truetype font map
file.
|
byte[] |
getTruetypeFontMapStream() |
com.aspose.ms.System.IO.MemoryStream |
getTruetypeFontMapStreamInternal() |
static String |
getUserAgentNameOfFileWebRequest() |
Watermarks |
getWatermarks()
Gets or sets a
Watermarks which will be added upon each page of
the PDF document. |
String |
getXmlFilePath() |
XmpMetadata |
getXmpMetadata()
Gets or sets a
XmpMetadata Object that indicates the XMP metadata
to be added into the PDF document. |
void |
import_(com.aspose.ms.System.IO.StreamReader media) |
void |
import_(com.aspose.ms.System.IO.StreamReader media,
ImportOptions options) |
void |
import_(String media) |
void |
import_(String media,
ImportOptions options) |
boolean |
isAutoFontAdjusted()
Gets or sets a bool value that indicates whether allow to adjust fonts
automatically.
|
void |
isAutoFontAdjusted(boolean value) |
boolean |
isAutoHyphenated()
Gets or sets a bool value that indicates whehter the text is hyphenated
automatically.
|
void |
isAutoHyphenated(boolean value) |
boolean |
isBookmarked()
Gets or sets a bool value that indicates whether the pdf document is
bookmarked when generating PDF document.
|
void |
isBookmarked(boolean value) |
boolean |
isBuffered()
Gets or sets a bool value that indicates whether memory buffer is used
when generating PDF document.
|
void |
isBuffered(boolean value) |
boolean |
isCoreFontUsed()
Gets or sets a bool value that indicates whether PDF core fonts are used.
|
void |
isCoreFontUsed(boolean value) |
boolean |
isDirectBatchFlushMode() |
boolean |
isFontNotFoundExceptionThrown()
Gets or sets a bool value that indicates whether throw out exception when
font is not found.
|
void |
isFontNotFoundExceptionThrown(boolean value) |
boolean |
isImageNotFoundErrorIgnored()
Gets or sets a bool value that indicates whether the "image not found"
error is ignored or not.
|
void |
isImageNotFoundErrorIgnored(boolean value) |
boolean |
isImagesInXmlDeleteNeeded()
Gets or sets a bool value that indicates whether images used in XML be
deleted when the PDF document is generated.
|
void |
isImagesInXmlDeleteNeeded(boolean value) |
boolean |
isLandscape()
Gets or sets a bool value that indicates whether the page orientation is
landscape.
|
void |
isLandscape(boolean value) |
boolean |
isPageNumberForDocument()
Gets or sets a bool value that indicates whether total page number is
count for whole document.
|
void |
isPageNumberForDocument(boolean value) |
boolean |
isPageNumberRestarted()
Gets or sets a bool value that indicates whether the page number is
restarted in new section.
|
void |
isPageNumberRestarted(boolean value) |
boolean |
isRightToLeft()
Gets or sets a bool value that indicates whether the text or heading
appear in the pdf is right-to-left aligned.
|
void |
isRightToLeft(boolean value) |
boolean |
isRtlInSegmentMode()
Gets or sets a bool value that indicates whether the text or heading is
processed in segment mode.
|
void |
isRtlInSegmentMode(boolean value) |
boolean |
isSegmentMerged()
Gets or sets a bool value that indicates whether the segments with same
format are merged into one.
|
void |
isSegmentMerged(boolean value) |
boolean |
isSpaced()
Gets or sets a bool value that indicates whether the spaces at the begin
of the text and returns in the text be shown.
|
void |
isSpaced(boolean value) |
boolean |
isTruetypeFontMapCached()
Gets or sets a bool value that indicates whether truetype font map be
cached on disk.
|
void |
isTruetypeFontMapCached(boolean value) |
boolean |
isWatermarkOnTop()
Gets or sets a bool value that indicates if the watermark is on top of
the page.
|
void |
isWatermarkOnTop(boolean value) |
boolean |
isWidowOrphanControlEnabled()
Gets or sets a bool value that indicates whether the Widow/Orphan control
is enabled.
|
void |
isWidowOrphanControlEnabled(boolean value) |
boolean |
isXmlSchemaCheckedOnBind()
Gets or sets a bool value that indicates whether the error is ignored
when unknown elements or attributes are used in xml file.
|
void |
isXmlSchemaCheckedOnBind(boolean value) |
void |
parseToPdf(String source)
Import method that support PdfXml, XslFo, Html, Svg as input source
|
void |
processLists()
Add Lists to the pdf document if the user has specified the list.
|
void |
save(InputStream stream) |
void |
save(OutputStream stream)
Generates Pdf document and put it to a
OutputStream object. |
void |
save(String pdfFile)
Generates Pdf document and saves it.
|
void |
save(String fileName,
int saveType,
HttpResponse response)
Generates Pdf document and sends it to the client browser.
|
void |
sendDirectModeFlushEvent(com.aspose.ms.System.IO.MemoryStream ms) |
void |
sendHeaderFooterEvaluationEvent(Page page)
Send HeaderFooterEvaluationEvent to subscriber
|
void |
setAuthor(String value) |
void |
setBackgroundColor(Color value)
Sets a
aspose.pdf.Color object that indicates the background
color of the pdf. |
void |
setBackupTextInfo(TextInfo value) |
void |
setBookmarkLevel(int value) |
void |
setBookMarkLevel(int value)
Deprecated.
|
void |
setBookmarks(Bookmarks value) |
void |
setCompressionLevel(int value) |
void |
setConformance(int value) |
void |
setConsecutiveHyphens(int value) |
void |
setConsecutiveHyphensLimits(int value) |
void |
setCreator(String value) |
void |
setCustomFonts(CustomFonts value) |
void |
setDefaultFontName(String value) |
void |
setDestinationType(int value) |
void |
setDigitSubstitution(boolean value) |
void |
setDirectModeCurrentItemValue(int value) |
void |
setDirectModeItemsCount(int value) |
void |
setDirectModeItemType(int value) |
void |
setDocStream(com.aspose.ms.System.IO.Stream value) |
void |
setDocumentAttachments(DocumentAttachments value) |
void |
setEndNoteNumberInDoc(int value) |
void |
setFirstHeading(Heading value) |
void |
setFirstLineIndent(int value) |
void |
setFirstSubstitute(Substitute value) |
void |
setFootNoteNumberInDoc(int value) |
void |
setGraphInfo(GraphInfo value) |
void |
setHtmlInfo(HtmlInfo value) |
void |
setHyphenationDictionaryPath(String value) |
void |
setHyphenationZoneWidth(float value) |
void |
setIndex(Index value) |
void |
setJavaScripts(JavaScripts value) |
void |
setKeywords(String value) |
void |
setLabelWidth(float value) |
void |
setLastSubstitute(Substitute value) |
void |
setLinearized(boolean value) |
void |
setOpenType(int value) |
void |
setPageDuration(int value) |
void |
setPageNumberFormat(int value) |
void |
setPages(Page value) |
void |
setPageSetup(PageSetup value) |
void |
setPagesNumber(int value) |
void |
setPageTransitionType(int value) |
void |
setProducer(String value) |
void |
setSections(Sections value) |
void |
setSecurity() |
void |
setSecurity(Security value) |
void |
setSubject(String value) |
void |
setTabStopPosition(float value) |
void |
setTempFolder(String value) |
void |
setTempGenerator(GeneratorBase value) |
void |
setTextInfo(TextInfo value) |
static void |
setTimeOutOfFileWebRequest(int value) |
void |
setTitle(String value) |
void |
setTruetypeFontMapPath(String value) |
void |
setTruetypeFontMapStream(byte[] value) |
void |
setUnicode()
Sets all fonts in the document to be unicode.
|
static void |
setUserAgentNameOfFileWebRequest(String value) |
void |
setWatermarks(Watermarks value) |
void |
setXmpMetadata(XmpMetadata value) |
static void |
traceLog(com.aspose.ms.System.Exception PdfException) |
public final com.aspose.ms.lang.Event<Pdf.HeaderFooterEvaluationDelegate> HeaderFooterEvaluation
public com.aspose.ms.System.Globalization.CultureInfo OriginalLocale
public com.aspose.ms.System.Globalization.CultureInfo CustomLocale
public Paragraph preParagraph
public com.aspose.ms.System.Collections.ArrayList parsedObject
public String Url
public TextInfo curSegTextInfo
public Text currentTextInAll
public Heading pre1
public boolean firstItem
public boolean firstItemInOL
public Paragraphs footnoteParas
public float FootNotePageBottom
public float FootNoteCurPosInMultiSegProcessing
public Paragraphs bkFootNotes
public float FootNoteHeightSum
public boolean isSamePage
public boolean PageHaveFootLine
public int tempNumberOfFootNoteInDoc
public boolean IsSaveCalled
public int[] CurrentBookmarkIds
public Hashmap ImagePath
用于�?�?所有Image的路径,以便删除这些文件。使用hashmap的原因�?�便于查找和追加
public int inconsistentXmlImageParamsHandlingType
public boolean IsFirstPageCreated
public int RefPageID
用户获�?�#$REFPAGE对应的唯一ID。�?次获�?��?�该值加1,确�?唯一。
public boolean IsFirstPage
public com.aspose.ms.System.Collections.ArrayList ToBeFreed
PDF生�?以�?�需�?释放的资�?。�?��?内�?泄�?
public boolean IsSaveState
public boolean IsFromRS
public boolean IsRowBrokenForFixedHeight
public final com.aspose.ms.lang.Event<Pdf.OnFlushDelegate> DirectModeFlush
public Pdf()
Initializes a new instance of the Pdf
class for Evaluation
License.
public Pdf(InputStream docStream)
public void sendHeaderFooterEvaluationEvent(Page page)
Send HeaderFooterEvaluationEvent to subscriber
page
- public IFontUriResolver getFontResolver()
public Hashmap getHyphenDicMap()
Gets or sets the number of consecutive hyphens. Default value is 0.
public int getConsecutiveHyphens()
Gets or sets the number of consecutive hyphens. Default value is 0.
public void setConsecutiveHyphens(int value)
public com.aspose.ms.System.Xml.XmlDocument getHyphenDictionary()
Gets or sets a hyphenation Dictionay file.
public boolean isAutoHyphenated()
Gets or sets a bool value that indicates whehter the text is hyphenated automatically. Default value is false.
Pdf pdf = new Pdf(); pdf.IsAutoHyphenated = true; pdf.HyphenationZoneWidth = 0; pdf.ConsecutiveHyphensLimits = 0; //no limits pdf.HyphenationDictionaryPath =
public void isAutoHyphenated(boolean value)
public String getHyphenationDictionaryPath()
Gets or sets a string that indicates the hyphenation dictionary path.
public void setHyphenationDictionaryPath(String value)
public float getHyphenationZoneWidth()
Gets or sets a float value that indicates the hyphenation area width. Default value is 12 points.
public void setHyphenationZoneWidth(float value)
public int getConsecutiveHyphensLimits()
Gets or sets an integer value that indicates the consecutive hyphens limits. Default value is zero that means no limits.
public void setConsecutiveHyphensLimits(int value)
public int getFootNoteNumberInDoc()
public void setFootNoteNumberInDoc(int value)
public int getEndNoteNumberInDoc()
public void setEndNoteNumberInDoc(int value)
public int getPageNumberFormat()
Gets or sets a PageNumberFormatType
value that indicates the
format of the page number .
public void setPageNumberFormat(int value)
public com.aspose.ms.System.IO.Stream getDocStream()
public final void setDocStream(com.aspose.ms.System.IO.Stream value)
public AssignInfo getAssignInfoForDirectWright()
public void close()
Close the document. This method is used for direct-to-file mode only.
public GeneratorBase getGeneratorBase()
public TextInfo getBackupTextInfo()
public void setBackupTextInfo(TextInfo value)
public void save(String pdfFile)
Generates Pdf document and saves it.
Pdf pdf = new Pdf(); pdf.BindXML("C:/xml/Test.xml",null); pdf.Save(C;/Pdf/Test.pdf);
pdfFile
- The file path and name to save the Pdf document.public static void traceLog(com.aspose.ms.System.Exception PdfException)
public Color getBackgroundColor()
Gets a aspose.pdf.Color
object that indicates the background
color of the pdf.
public void setBackgroundColor(Color value)
Sets a aspose.pdf.Color
object that indicates the background
color of the pdf.
public void save(String fileName, int saveType, HttpResponse response)
Generates Pdf document and sends it to the client browser.
fileName
- The name for the document that will appear at the client
browser. The name should not contain path. If you use
SaveType.OpenInBrowser, the file name is of no use.saveType
- Specifies how the document is presented at the client
browser.response
- The HttpResponse object to put the pdf to.public void save(InputStream stream)
public void save(OutputStream stream) throws IOException
OutputStream
object.stream
- The OutputStream
object to which the document
writes.IOException
public void setSecurity()
public void bindHTML(String html)
Binds a HTML into the Pdf instance.
[C#] string html = File.ReadAllText("C:\\index.htm"); Pdf pdf = new Pdf(); pdf.BindHTML(html); pdf.Save("test.pdf");
html
- The HTML.
public void bindHTML(com.aspose.ms.System.IO.Stream htmlSourceStream, String basePathIfAny)
Binds a HTML into the Pdf instance. Uses stream as source of HTML. Default used encoding is UTF-8. Please use attributes Charset and CharsetAppliingForceLevel to ajust usage of this or that encoding during loading from stream.
htmlSourceStream
- The stream that presumabely contains bytes of
HTML.basePathIfAny
- Source HTML document can contain relative pathes. In
such case this parameter should contain absolute URI of start point that
will be used to convert relative pathes to absolute pathes. If HTML does
not contain relative pathes, then it's possible use null or empy string
as parameter.
public void bindHTML(String html, String basePath)
Binds a HTML into the Pdf instance.
[C#] string html = File.ReadAllText("C:\\index.htm"); Pdf pdf = new Pdf(); pdf.BindHTML(html, "C:\\"); pdf.Save("test.pdf");
html
- The HTML.basePath
- The base path/url for the HTML document.
public void bindFO(com.aspose.ms.System.Xml.XmlDocument xmlFoFileBody) throws ParserConfigurationException
Binds a FO file into the Pdf instance.
[C#] Pdf pdf = new Pdf(); pdf.BindFO(xmlDocument); pdf.Save("test.pdf"); [VisualBasic] Dim pdf As Pdf = New Pdf pdf.BindFO(_XmlDocument) pdf.Save("test.pdf")
xmlFoFileBody
- The FO file.
ParserConfigurationException
public void bindFO(com.aspose.ms.System.Xml.XmlDocument xmlFoFileBody, String xmlFoFileImagePath) throws ParserConfigurationException
Binds a FO file into the Pdf instance.
[C#] Pdf pdf = new Pdf(); pdf.BindFO(xmlDocument, foImagePath); pdf.Save("test.pdf"); [VisualBasic] Dim pdf As Pdf = New Pdf pdf.BindFO(xmlDocument, foImagePath) pdf.Save("test.pdf")
xmlFoFileBody
- The FO file.xmlFoFileImagePath
- Fo Image location path.
ParserConfigurationException
public void bindFO(String xmlFoFileName) throws ParserConfigurationException
Binds a FO file into the Pdf instance.
[C#] Pdf pdf = new Pdf(); pdf.BindFO("test.fo"); pdf.Save("test.pdf"); [VisualBasic] Dim pdf As Pdf = New Pdf pdf.BindFO("test.fo") pdf.Save("test.pdf")
xml_fo_file_name
- The FO file.
ParserConfigurationException
public void bindSvg(String svgFileName)
Read svg markup area in to Pdf document section
[C#] Pdf pdf = new Pdf(); pdf.BindSvg("test.svg"); pdf.Save("test.pdf"); [VisualBasic] Dim pdf As Pdf = New Pdf pdf.BindSvg("test.svg"); pdf.Save("test.pdf")
svgFileName
- svg File or Svg fragment markup textpublic void bindSvg(String svgFileName, boolean ajustPdfToSvg)
Read svg markup area in to Pdf document section svg File or Svg fragment markup text whether sizes of created PDF will be set according to sizes referenced in SVG
public void bindFO(InputStream xmlStream, InputStream xsltStream)
Binds a FO content, that got after applying of supplies XSLT to supplied XML, into the Pdf instance. Method supposes that FO content that will be got after XSLT transformation will be complete valid FO-document, otherwise exception will be thrown.
xmlStream
- Stream that contains converted XML document (that must
be processed with companion XSLT to get valid XSLFO document)xsltStream
- Stream that contains XSLT transformation (that must be
applied to companion XML to get valid XSLFO document).
public void bindFO(InputStream xmlStream) throws ParserConfigurationException
Binds a FO content, that got after applying of supplies XSLT to supplied XML, into the Pdf instance. Method supposes that FO content that will be got after XSLT transformation will be complete valid FO-document, otherwise exception will be thrown.
xmlStream
- Stream that contains converted XML document (that must
be processed with companion XSLT to get valid XSLFO document)xsltStream
- Stream that contains XSLT transformation (that must be
applied to companion XML to get valid XSLFO document).
ParserConfigurationException
public void bindFO(com.aspose.ms.System.Xml.XmlDocument foXmlDocument, com.aspose.ms.System.Xml.XmlDocument foXslDocument)
Binds a FO file into the Pdf instance.
[C#] Pdf pdf = new Pdf(); pdf.BindFO("test.fo", "test.xsl"); pdf.Save("test.pdf"); [VisualBasic] Dim pdf As Pdf = New Pdf pdf.BindFO("test.fo", "test.xsl") pdf.Save("test.pdf")
xml_fo_file_name
- The FO file.
public void bindXML(com.aspose.ms.System.Xml.XmlDocument xmlDoc, String xslFile)
Create Svg formatted document output using ApsPage set as source
Reads info from a xml document.
pageGroup
- xmlDoc
- The xml document.xslFile
- The xsl documnet file name if XSLT is used.public void bindXML(String xmlFile, String xslFile)
Binds an xml/xsl document to the Pdf
object.
xmlFile
- The xml file.xslFile
- The xsl file if XSLT is used.public void bindXML(InputStream xmlStream, InputStream xslStream)
public void bindPCL(String pclFileName)
Binds an PCL document to the T:Aspose.Pdf.Pdf
object.
pclFileName
- The PCL file.public void import_(String media) throws ParserConfigurationException
ParserConfigurationException
public void import_(com.aspose.ms.System.IO.StreamReader media) throws ParserConfigurationException
ParserConfigurationException
public void import_(String media, ImportOptions options) throws ParserConfigurationException
ParserConfigurationException
public void import_(com.aspose.ms.System.IO.StreamReader media, ImportOptions options) throws ParserConfigurationException
ParserConfigurationException
public void parseToPdf(String source) throws ParserConfigurationException
Import method that support PdfXml, XslFo, Html, Svg as input source
source
- Xml formatted input sourceParserConfigurationException
public byte[] getBuffer()
Gets the data buffer used to generate the pdf document in memory.
[C#] Pdf pdf = new Pdf(); pdf.BindXML("C:/xml/Test.xml",null); byte[] buf = pdf.GetBuffer(); [VisualBasic] Dim pdf as Pdf = New Pdf pdf.BindXML("C:/xml/Test.xml",Nothing) Dim buf() As Byte = pdf.GetBuffer()
public PageSetup getPageSetup()
Gets or sets a PageSetup
object that indicates the page setup
info in the Pdf document.
public void setPageSetup(PageSetup value)
public TextInfo getTextInfo()
Gets or sets a TextInfo
object that indicates the text info in
the Pdf document.
public void setTextInfo(TextInfo value)
public GraphInfo getGraphInfo()
Gets or sets a GraphInfo
object that indicates the graph info in
the Pdf document.
public void setGraphInfo(GraphInfo value)
public Page getPages()
public void setPages(Page value)
public int getPagesNumber()
Represents an int value that indicates the current pages number.
public void setPagesNumber(int value)
public Sections getSections()
Gets or sets a Sections
collection that indicates all sections in
the Pdf document.
public void setSections(Sections value)
public int getFirstLineIndent()
Gets or sets an int value that indicates the indent of the first line.
public void setFirstLineIndent(int value)
public boolean isSpaced()
Gets or sets a bool value that indicates whether the spaces at the begin of the text and returns in the text be shown. For the following XML:
<Text> <Segment>The first line, The second line.</Segment> </Text>If IsSpaced is false, the result will be:
The first line,The second line.If IsSpaced is true, the result will be:
The first line, The second line.
public void isSpaced(boolean value)
public DocumentBase.HeadingInfoArray getHeadingInfos()
Gets or sets a HeadingInfoArray object that indicates the heading info.
public Heading getFirstHeading()
Represents a Heading object that indicates the first heading in this document.
public void setFirstHeading(Heading value)
public float getLabelWidth()
Gets or sets a float value that indicates the width of the heading label.
public void setLabelWidth(float value)
public Substitute getFirstSubstitute()
Gets or sets a Substitute object that indicates the first substitutor in the document.
public void setFirstSubstitute(Substitute value)
public Substitute getLastSubstitute()
Gets or sets a Substitute object that indicates the last substitutor in the document.
public void setLastSubstitute(Substitute value)
public int getCompressionLevel()
Gets or sets an int value that indicates the compression level. It can be between 0 (the least compression) and 9 (the most compression) and the default value is 6.
public void setCompressionLevel(int value)
public int getDestinationType()
Gets or sets a DestinationType
value that indicates the document
open action.
public void setDestinationType(int value)
public int getOpenType()
Gets or sets a OpenType
that indicates the document open type.
public void setOpenType(int value)
public String getAuthor()
Gets or sets a string that indicates the author of the Pdf document.
public void setAuthor(String value)
public static int getTimeOutOfFileWebRequest()
Gets or sets the length of time until the request times out for the Pdf document.
public static void setTimeOutOfFileWebRequest(int value)
public static String getUserAgentNameOfFileWebRequest()
public static void setUserAgentNameOfFileWebRequest(String value)
public String getTitle()
Gets or sets a string that indicates the title of the Pdf document.
public void setTitle(String value)
public String getCreator()
Gets or sets a string that indicates the creator of the Pdf document.
public void setCreator(String value)
public String getProducer()
Gets a string that indicates the producer of the Pdf document. Property is read-only, any setted value has no effect.
public void setProducer(String value)
public String getKeywords()
Gets or sets a string that indicates key words of the Pdf document.
public void setKeywords(String value)
public String getSubject()
Gets or sets a string that indicates the subject of the Pdf document.
public void setSubject(String value)
public int getPageTransitionType()
Gets or sets a PageTransitionType
that indicates the pdf document
page transition type.
public void setPageTransitionType(int value)
public int getPageDuration()
Gets or sets a int value that indicates the duration in seconds for the current page. This property is used when using auto advancing in presentation mode.
public void setPageDuration(int value)
public Security getSecurity()
Gets or sets a Aspose.Pdf.Security
object that indicates the
document security information.
public void setSecurity(Security value)
public CustomFonts getCustomFonts()
public void setCustomFonts(CustomFonts value)
public GeneratorBase getTempGenerator()
public void setTempGenerator(GeneratorBase value)
public boolean isImagesInXmlDeleteNeeded()
Gets or sets a bool value that indicates whether images used in XML be deleted when the PDF document is generated.
public void isImagesInXmlDeleteNeeded(boolean value)
public boolean isBuffered()
Gets or sets a bool value that indicates whether memory buffer is used
when generating PDF document. The default value is true. If this property
is set to false, Aspose.Pdf.Generator will write document directly to PDF
file and the GetBuffer
method can't be used.
public void isBuffered(boolean value)
public Object getObjectByID(String ID)
Gets a object with specified ID in the document.
ID
- The object ID.public void collectObjectsToCache()
public aspose.pdf.TablesOfContents getTablesOfContents()
public ListSection getListOfTables()
public ListSection getListOfFigures()
public void processLists()
Add Lists to the pdf document if the user has specified the list.
public boolean isBookmarked()
Gets or sets a bool value that indicates whether the pdf document is
bookmarked when generating PDF document. The default value is false. If
this property is set to true, Aspose.Pdf.Generator will create bookmarks
for all the Heading
s in the PDF if the relative property
BookMarkLevel
is not set.
public void isBookmarked(boolean value)
public int getBookmarkLevel()
Gets or sets a int value that indicates how many levels of
Heading
of the pdf document is to be bookmarked. The default
value is 0, which means every heading of the PDF is to be taged as a
bookmark. Only when the relative property IsBookmarked
is set as
true, this property is valid. If IsBookmarked
is true and this
property is set to a non-integer value levelNumber, Aspose.Pdf.Generator
will create bookmarks for the corresponding Heading
s of level 1
to level levelNumber.
public void setBookmarkLevel(int value)
@Deprecated public int getBookMarkLevel()
@Deprecated public void setBookMarkLevel(int value)
public float getTabStopPosition()
Gets or sets the tab stop position. Default value is 36 points (0.5inch).
public void setTabStopPosition(float value)
public String getXmlFilePath()
public HtmlInfo getHtmlInfo()
Gets or sets a HtmlInfo
object that indicates the necessary info
when converting HTML to PDF.
public void setHtmlInfo(HtmlInfo value)
public boolean isPageNumberRestarted()
Gets or sets a bool value that indicates whether the page number is restarted in new section. Default is false.
public void isPageNumberRestarted(boolean value)
public boolean isCoreFontUsed()
Gets or sets a bool value that indicates whether PDF core fonts are used. Default is true. If this property is set to false, PDF core fonts will be ignored and all font will be used as TrueType font.
public void isCoreFontUsed(boolean value)
public boolean isXmlSchemaCheckedOnBind()
Gets or sets a bool value that indicates whether the error is ignored when unknown elements or attributes are used in xml file. Default is false.
public void isXmlSchemaCheckedOnBind(boolean value)
public boolean isImageNotFoundErrorIgnored()
Gets or sets a bool value that indicates whether the "image not found" error is ignored or not.
public void isImageNotFoundErrorIgnored(boolean value)
public boolean isPageNumberForDocument()
Gets or sets a bool value that indicates whether total page number is count for whole document. If this property is set to true, the "$P" symbol will be replaced by the total page number of the document. Otherwise "$P" will be replaced with the total page number of all sections that were not restarted ("IsPageNumberRestarted" is set to true).
public void isPageNumberForDocument(boolean value)
public boolean isTruetypeFontMapCached()
Gets or sets a bool value that indicates whether truetype font map be cached on disk. Truetype font map is a font name to font file name map which is used when using unicode. If unicode is used, setting this property to true can make your application run fast. If this property is set to true and the system's fonts are changed (for example, new fonts are installed), delete the font map file (Aspose.Pdf.Generator.TruetypeFontMap.xml) and it will be generated again automatically.
public void isTruetypeFontMapCached(boolean value)
public String getTruetypeFontMapPath()
Gets or set a string that indicates the path of the truetype font map file. This property is valid only when the "IsTruetypeFontMapCached" property is set to true.
IsTruetypeFontMapCached
public void setTruetypeFontMapPath(String value)
public com.aspose.ms.System.IO.MemoryStream getTruetypeFontMapStreamInternal()
public byte[] getTruetypeFontMapStream()
public void setTruetypeFontMapStream(byte[] value)
public static byte[] createTruetypeFontMapStream()
public boolean isSegmentMerged()
Gets or sets a bool value that indicates whether the segments with same format are merged into one. This property is used when converting Word document into PDF. Aspose.Words may export one word into more than one segments which makes the line warpping bad.
public void isSegmentMerged(boolean value)
public int getPageCount()
Gets a int value that indicates the pages count of the generated PDF. You
can only get the value of this property when the Save
method is
called.
public Watermarks getWatermarks()
Gets or sets a Watermarks
which will be added upon each page of
the PDF document.
public void setWatermarks(Watermarks value)
public DocumentAttachments getDocumentAttachments()
Gets or sets a DocumentAttachments
which will be added upon the
PDF document.
public void setDocumentAttachments(DocumentAttachments value)
public boolean isFontNotFoundExceptionThrown()
Gets or sets a bool value that indicates whether throw out exception when font is not found. The default value is false.In this case,if user specified font is not found,default font works.
public void isFontNotFoundExceptionThrown(boolean value)
public boolean isWatermarkOnTop()
Gets or sets a bool value that indicates if the watermark is on top of the page.
public void isWatermarkOnTop(boolean value)
public boolean isLandscape()
Gets or sets a bool value that indicates whether the page orientation is landscape. The default is false, portrait.
public void isLandscape(boolean value)
public static Object createObjFromXml(String xmlFile, String xslFile)
Gets the xml file with Aspose's xml format from HTML. BindHTML method should be called before this method.
Gets the xml stream with Aspose's xml format from HTML. BindHTML method should be called before this method.
Create object from an xml/xsl document.
[c#] Pdf p = new Pdf(); p.BindHTML("Test.htm"); p.GetXmlFromHtml("html.xml"); [VB.Net] Dim p As Pdf = New Pdf() p.BindHTML("Test.htm") p.GetXmlFromHtml("html.xml")
[c#] Pdf p = new Pdf(); p.BindHTML("Test.htm"); MemoryStream mstream = new MemoryStream(); p.GetXmlFromHtml(mstream); [VB.Net] Dim p As Pdf = New Pdf() p.BindHTML("Test.htm") Dim mstream As MemoryStream = New MemoryStream() p.GetXmlFromHtml(mstream)
[C#] Pdf pdf = new Pdf(); Text text = Pdf.CreateObjFromXml("testText.xml", null) as Text; Section sec = pdf.Sections.Add(); sec.Paragraphs.Add(text); pdf.Save("d:/test/test.pdf"); [VB.Net] Dim pdf As Pdf = New Pdf() Dim text As Text = Pdf.CreateObjFromXml("testText.xml",Nothing) Dim sec As Section = pdf.Sections.Add() sec.Paragraphs.Add(text) pdf.Save("d:/test/test.pdf")
xmlFile
- The xml file path.xmlStream
- The xml stream.xmlFile
- The xml file.xslFile
- The xsl file if XSLT is used. null null null null null
null null
Section
, Text
, Graph
, Image
,
Segment
, Table
, Attachment
, FloatingBox
objects are supported. public static Object createObjFromXml(InputStream xmlStream, InputStream xslStream)
public static Object createObjFromXml(com.aspose.ms.System.Xml.XmlDocument xmlDoc, com.aspose.ms.System.Xml.XslTransform xsl)
Reads object info from a xml document.
[c#] Pdf pdf = new Pdf(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(
xmlDoc
- The xml document.xsl
- The XslTransform
object if XSLT is used. null null
null null null null null
Section
, Text
, Graph
, Image
,
Segment
, Table
, Attachment
, FloatingBox
objects are supported. public int getPageNumber(String ID)
Gets the page number of a paragraph when the PDF is generated.
ID
- The ID of the paragraph.public Index getIndex()
Gets or sets an Index
object.
public void setIndex(Index value)
public JavaScripts getJavaScripts()
Gets or sets a JavaScripts
object that indicates the JavaScripts
to be added into the PDF.
[c#] Pdf pdf = new Pdf(); pdf.JavaScripts = new JavaScripts(); pdf.JavaScripts.Add("this.print(true);"); pdf.JavaScripts.Add("app.alert(\"hello world\");"); pdf.Save(
public void setJavaScripts(JavaScripts value)
public XmpMetadata getXmpMetadata()
Gets or sets a XmpMetadata
Object that indicates the XMP metadata
to be added into the PDF document.
[C#] Pdf pdf = new Pdf(); Section s = pdf.Sections.Add(); Text text1 = new Text("This is a test for XMP Metadata"); s.Paragraphs.Add(text1); pdf.XmpMetadata = new XmpMetadata(); //core properties pdf.XmpMetadata.AddCreationDate(System.DateTime.Now.ToString()); //user properties pdf.XmpMetadata.AddUserProperty("xmlns:dc=\"http://purl.org/dc/elements/1.1/\"","dc:contributor","Aspose"); pdf.Save(
public void setXmpMetadata(XmpMetadata value)
public void setUnicode()
Sets all fonts in the document to be unicode. This method should be called just before the Save method.
public String getDefaultFontName()
Gets or sets a string that indicates the default font name. When font name is not set or the font is not found, this font will be used. The default value is "Times-Roman".
public void setDefaultFontName(String value)
public boolean isRightToLeft()
Gets or sets a bool value that indicates whether the text or heading appear in the pdf is right-to-left aligned. If it is true, all the texts and headings will be processed as right-to-left language previously. If text or heading don't contain any right-to-left lanuage character, they will be processed as usual( left-to-right). This property is used for right-to-left aligned language such as Arabic and Hebrew.
public void isRightToLeft(boolean value)
public boolean isRtlInSegmentMode()
Gets or sets a bool value that indicates whether the text or heading is processed in segment mode. If it is true(default),segment in text will be processed one by one. If false, all segments in text will be put together, reorder in arabic rule. We recommend set it true when rendering rtl and non-rtl mixed texts.
public void isRtlInSegmentMode(boolean value)
public boolean isWidowOrphanControlEnabled()
Gets or sets a bool value that indicates whether the Widow/Orphan control is enabled. Default is true. If it is true, Widow/Orphan control is enabled and Widows/orphans themselves are eliminated (disabled).
public void isWidowOrphanControlEnabled(boolean value)
public String getTempFolder()
Gets or sets a value that indicates where temporary files stored. In current implementation it concerns only of fonts. So, if must be used fonts not from system directory, but rather from some specific one, put path to that specific directory to this property
public void setTempFolder(String value)
public boolean isAutoFontAdjusted()
Gets or sets a bool value that indicates whether allow to adjust fonts automatically. Each font has a set of supported characters. Sometimes, users may assign a font to a Segment paragraph which doesn't support every character appear in the Segment. If this bool value is true, it will assign proper font to Segment paragraph according to its contents in this case. Default is false.
public void isAutoFontAdjusted(boolean value)
public Bookmarks getBookmarks()
Gets or sets a Bookmarks
object that indicates the bookmarks in
the PDF.
public void setBookmarks(Bookmarks value)
public boolean getLinearized()
Gets or sets a bool value that indicates if the document needs to be linearized (optimization for web access) . The default value is false . you need to set this property before Save method is called .
public void setLinearized(boolean value)
public int getConformance()
null null null null null null null null null <BLOCKQUOTE class="dtBlock">
<Font color="red">NOTE: This is beta version of PdfA. </Font>
</BLOCKQUOTE>
Gets or sets a PdfConformance
object that
indicates the conformance in the PDF. The default value is
PdfConformance.None . you need to set this property before Save method is
called . Notice that PdfConformance.PdfA1B and PdfConformance.PdfA1A
currently only support TrueType fonts and RGB color space , specify a
wrong font name or a CMYK color name will cause exception.
public void setConformance(int value)
public int getDirectModeItemType()
Gets or sets a DirectModeItemType value that indicates DirectModeItemsCount measure The default value is DirectModeItemType.Page
public void setDirectModeItemType(int value)
public int getDirectModeItemsCount()
public void setDirectModeItemsCount(int value)
public int getDirectModeCurrentItemValue()
public void setDirectModeCurrentItemValue(int value)
public boolean getDigitSubstitution()
Gets or set bool value that indicates whether to replace digits with national ones in macros'
public void setDigitSubstitution(boolean value)
public boolean isDirectBatchFlushMode()
public void sendDirectModeFlushEvent(com.aspose.ms.System.IO.MemoryStream ms)
public boolean addSuitableCustomFontIfNecessary(TextInfo textInfo)
Copyright © 2016 Aspose. All Rights Reserved.