diff --git a/.gitignore b/.gitignore index 9c692245..2954917c 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ Out/ Out*/ *.lic Data/*Out* +*out* diff --git a/Artifacts/Aspose.Pdf.xsd b/Artifacts/Aspose.Pdf.xsd new file mode 100644 index 00000000..b4732d58 --- /dev/null +++ b/Artifacts/Aspose.Pdf.xsd @@ -0,0 +1,5275 @@ + + + + + Config schema for Aspose.Pdf. + Copyright 2002-2009 Aspose Pty Ltd. All rights reserved. + + + + + Represents the Pdf document. + + + + + + + Represents a section in a Pdf document. + + + + + Represents a ListSection in a Pdf. + + + + + Represents a custom watermark of the Pdf. + + + + + Represents a document level attachment. + + + + + Represents a document level JavaScript. + + + + + Represents the XMP metadata to be added into the document. + + + + + + Represents the custom bookmarks to be created in the document. + + + + + + + A bool value that indicates whether the text in the pdf file is hyphenated automatically. + + + + + A string specifies the path of customer's hyphenation dictionary.This attribute must be set and valid when the "IsAutoHyphenated" attribute is set to true,otherwise, the text is hyphenated automatically. + + + + + A float value specifies the width of hyphenation area. Default value is 12 points. This attribute is valid only when the "IsAutoHyphenated" attribute is set to true. + + + + + An integer value specifies the consecutive hyphens limits in a pdf file. Default value is zero that means no limits. This attribute is valid only when the "IsAutoHyphenated" attribute is set to be true. + + + + + + A string that indicates the background color of the pdf.For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180".But It can be overloaded by attribute BackgroundColor set in section. + + + + + 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". + + + + + + a bool value that indicates if the document needs to be linearized (optimization for web access) . + + + + + A string that indicates the culture information of the xml. For example, CultureInfo="en-US". + + + + + a bool value that indicates whether the page orientation is landscape. The default is false, which means portrait. + + + + + A float value (culture-neutral format) that indicates the tab stop position. Default value is 36 points (0.5inch). The default unit is point, but cm and inch are also supported. For example, TabStopPosition="2cm" or TabStopPosition="2inch". + + + + + A string that indicates the name of custom AFM font file. + + + + + A string that indicates the name of custom PFM font file. + + + + + A string that indicates the name of custom font outline file. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'. This attribute is valid for custom PostScript fonts only. + + + + + An non negative integer that indicates the compression level. It can be between 0 (the least compression) and 9 (the most compression) and the default value is 6. + + + + + A string that indicates the text font name. When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be choosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A bool value that indicates whether the font is unicode. + + + + + A bool value that indicates whether the watermarks are on the top of the page. + + + + + A bool value that 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. + + + + + A string that indicates the path of the truetype font map file. This attribute is valid only when the "IsTruetypeFontMapCatched" attribute is set to true. + + + + + A bool value that indicates whether images used in XML be deleted when the PDF document is generated. This property is used when integration with Aspose.Word. When converting Word document to PDF,Aspose.Word will save images in Word document as file and add the file name into XML. If this property is set to true,Aspose.Pdf will delete these image files used in XML. + + + + + A bool value that indicates whether the "image not found" error is ignored or not. + + + + + 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.. + + + + + A bool value that indicates whether the page number is restarted in new section. + + + + + 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). + + + + + 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. + + + + + A bool value that indicates that indicates whether the error is ignored when unknown elements or attributes are used in xml file. Default is true. + + + + + A bool value that indicates whether 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 language character, they will be processed as usual( left-to-right). This attribute is used for right-to-left aligned language such as Arabic and Hebrew. + + + + + A bool value that indicates whether whether 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). + + + + + 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. text will be put together, reorder in Arabic rule. We recommend set it true when rendering rtl and non-rtl mixed texts. + + + + + A bool value that indicates whether allow to adjust fonts automatically. Sometimes, users may assign a font to a Segment paragraph which doesn't support every character appear in the Segment. If it is true(default is false), it will assign proper font to Segment paragraph according to its contents in this case. + + + + + A string that indicates the truetype font file name. This attribute is only needed when using truetype font unicode. + + + + + + A bool value that indicates whether the TrueType font is bold. This attribute is valid for TrueType fonts only. + + + + + A bool value that indicates whether the TrueType font is italic. This attribute is valid for TrueType fonts only. + + + + + A float number (culture-neutral format) that indicates the size of font. + + + + + A string that indicates the font encoding name. For 8-bit fonts, encoding should be "builtin"(Original encoding used by non-text or non-Latin text fonts) , or "winansi"(Windows code page 1252), or the name of an external encoding("cp1251" for example). The default value is "winansi". + + + + + A bool value that indicates if the font is embedded. + + + + + A string that indicates the text alignment mode. + + + + + + A string that indicates the conformance in the PDF. The default value is PdfConformance.None. + + + + + A bool value that indicates whether the text is with underline. + + + + + A bool value that indicates whether the text is with overline. + + + + + A bool value that indicates whether the text is with strikeout. + + + + + A float value (culture-neutral format) that indicates space between characters. The unit is point. + + + + + A float value (culture-neutral format) that indicates space between words. The unit is point. + + + + + An string that indicates the rendering mode of the text. + + + + + A string that indicates the color of the text. For example, "Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A string that indicates the color of the button. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A float value (culture-neutral format) that indicates the indent of the first line. + + + + + A bool value that indicates whether the text is spaced or not. + + + + + A float value (culture-neutral format) that indicates the width of the heading label. + + + + + A float value (culture-neutral format) that indicates the spacing between two text lines. The unit is point. + + + + + A string that indicates the destination type. + + + + + A string that indicates the document open type. + + + + + + An integer that indicates the length of the time (ms) until the request times out for the web images. + + + + + + A string that indicates the author of the Pdf document. + + + + + A string that indicates the title of the Pdf document. + + + + + A string that indicates the creator of the Pdf document. + + + + + A string that indicates the producer of the Pdf document. + + + + + A string that indicates key words of the Pdf document. + + + + + A string that indicates the subject of the Pdf document. + + + + + A string that indicates the pdf document page transition type. + + + + + An integer value that indicates the duration in seconds for the current page. This property is only used when using auto advancing in presentation mode. + + + + + Four float number separated by blank that indicates the crop box of the page. + + + + + Four float number separated by blank that indicates the bleed box of the page. + + + + + Four float number separated by blank that indicates the art box of the page. + + + + + Four float number separated by blank that indicates the trim box of the page. + + + + + A bool value that indicates whether the Pdf documents will be 128 bits or 40 bits encrypted. Default is false, 40 bits encrypted. + + + + + A string that indicates the user password used in pdf encryption. + + + + + A string that indicates the master password used in pdf encryption. + + + + + A bool value that indicates whether all permissions are set to allowed as default. Default value is true. If this property is set to false, then all permissions are set to NOT allowed. + + + + + A bool value that indicates whether printing is allowed.To fully disable Pdf documents to be printable both "IsPrintingAllowed" and "IsDegradedPrintingAllowed" should be false. + + + + + A bool value that indicates whether modifying contents is allowed. + + + + + A bool value that indicates whether copying or otherwise extracting text and graphics from the document is allowed. + + + + + A bool value that indicates whether adding or modifying text annotations is allowed. + + + + + A bool value that indicates whether filling in forms and signing the document is allowed. + + + + + A bool value that indicates whether screen readers are allowed. + + + + + A bool value that indicates whether assembling the document is allowed. This includes inserting, rotating, or deleting pages and creating navigation elements such as bookmarks or thumbnail images. + + + + + A bool value that indicates whether printing in low resolution is allowed.To fully disable Pdf documents to be printable both "IsPrintingAllowed" and "IsDegradedPrintingAllowed" should be false. + + + + + A bool value that indicates whether the pdf document is bookmarked .If this property is set to true, Aspose.Pdf will create bookmarks for all the headings in the PDF if the relative property BookMarkLevel is not set. + + + + + A non-negative integer value that indicates how many levels of headings of the pdf document is to be bookmarked. Only when the relative property IsBookmarked is set as true, this property is valid, which specifies the max level of headings to be tagged as bookmarks. + + + + + A string that indicates the page number format type. + + + + + + + + Represents the page border of the section. + + + + + Represents a text paragraph in a Pdf document. + + + + + Represents a graph Paragraph. + + + + + Represents a table Paragraph in a Pdf document. + + + + + Represents a image paragraph. + + + + + Represents a attachment paragraph. + + + + + Represents a formfield paragraph. + + + + + Represents a floating box paragraph. + + + + + Represents a canvas paragraph. + + + + + Represents header of a page in a Pdf document. + + + + + Represents footer of a page in a Pdf document. + + + + + Represents a heading in Pdf document. + + + + + + + A bool value that indicates whether the text in the section is hyphenated automatically. Default value is true. This attribute is valid only when the attribute named "IsAutoHyphenated" in Pdf is set to true. + + + + + + A string that indicates the background color of the section. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180" It overloads the BackgroundColor set in Pdf. + + + + + A float value (culture-neutral format) that indicates the number of columns in each page in the section. + + + + + A string that contains the width of columns in each page in the section. The value of each column should be separated by blank. The default unit is point, but cm and inch are also supported. For example,"120 2.5cm 1.5inch". The max column number is 16. If this property is not set, column width will be calculated automatically according to column count and column spacing. + + + + + A string that contains the spacing between columns in each page in the section. The value of each spacing should be separated by blank.The default unit is point,but cm and inch are also supported.For example,"120 2.5cm 1.5inch". If this property is not set, default value 20 points will be used for each spacing. + + + + + A string that indicates the vertical line between columns need to been added. + + + + + An integer value that indicates the number of degrees by which the page should be rotated clockwise when displayed or printed. The value must be a multiple of 90. Default value is 0. + + + + + A float value (culture-neutral format) that indicates the page size. The default unit is point,but cm and inch are also supported. For example, PageWidth="20cm" or PageWidth="5inch". + + + + + A float value (culture-neutral format) that indicates the page width. The default unit is point, but cm and inch are also supported. For example, PageWidth="20cm" or PageWidth="5inch". + + + + + A float value (culture-neutral format) that indicates the page height. + + + + + + A float value (culture-neutral format) that indicates the page gutter size. + + + + + A string value (culture-neutral format) that indicates the page gutter placement type. It can be set to right,left,top,inner,outer and none. The default is none. + + + + + A float value (culture-neutral format) that indicates the page top margin. The default unit is point,but cm and inch are also supported. For example, PageMarginTop="2cm" or PageMarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the page bottom margin. The default unit is point,but cm and inch are also supported. For example, PageMarginBottom="2cm" or PageMarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the page left margin. The default unit is point, but cm and inch are also supported. For example, +PageMarginLeft="2cm" or PageMarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the page right margin. The default unit is point,but cm and inch are also supported. For example, PageMarginRight="2cm" or PageMarginRight="2inch". + + + + + A float value (culture-neutral format) that indicates the page inner margin. In case of mirror margins we can use PageMarginInner and PageMarginOuter instead of PageMarginLeft and PageMarginRight.The default unit is point,but cm and inch are also supported. For example, PageMarginInner="2cm" or PageMarginInner="2inch". + + + + + A float value (culture-neutral format) that indicates the page outer margin. In case of mirror margins we can use PageMarginInner and PageMarginOuter instead of PageMarginLeft and PageMarginRight.The default unit is point,but cm and inch are also supported. For example, PageMarginInner="2cm" or PageMarginInner="2inch". + + + + + A float value (culture-neutral format) that indicates the margin between the left page border and the left page edge on even page or between the right page border and the right page edge on odd page. In case of mirror margins we can use PageBorderMarginInner and PageBorderMarginOuter instead of PageBorderMarginLeft and PageBorderMarginRight. The default value is 0. The default unit is point, but cm and inch are also supported. For example, PageBorderMarginInner="2cm" or PageBorderMarginInner="2inch". + + + + + A float value (culture-neutral format) that indicates the margin between the right page border and the right page edge on even page or between the left page border and the left page edge on odd page. In case of mirror margins we can use PageBorderMarginInner and PageBorderMarginOuter instead of PageBorderMarginLeft and PageBorderMarginRight. The default value is 0. The default unit is point, but cm and inch are also supported. For example, PageBorderMarginOuter="2cm" or PageBorderMarginOuter="2inch". + + + + + + A float value (culture-neutral format) that indicates the margin between the top page border and the top page edge.The default value is half of the page top margin. The default unit is point, but cm and inch are also supported. For example, PageBorderMarginTop="2cm" or PageBorderMarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the margin between the bottom page border and the bottom page edge. The default value is half of the page bottom margin. The default unit is point, but cm and inch are also supported. For example, PageBorderMarginBottom="2cm" or PageBorderMarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the margin between the left page border and the left page edge.The default value is half of the page left margin. The default unit is point,but cm and inch are also supported. For example, PageBorderMarginLeft="2cm" or PageBorderMarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the margin between the right page border and the right page edge. The default value is half of the page right margin. The default unit is point,but cm and inch are also supported. For example, PageBorderMarginRight="2cm" or PageBorderMarginRight="2inch". + + + + + A string that indicates the text font name.When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be choosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A bool value that indicates whether the font is unicode. + + + + + A bool value that indicates whether this section is disabled. The default value is false. If this property is set to true, this section will not be rendered. + + + + + A bool value that indicates whether the page number be restarted at this section. + + + + + A bool value that indicates whether whether 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). + + + + + A bool value that indicates the starting page number of the section. Default is 1. + + + + + A bool value that indicates whether the section starts at new column.Default is true. If this property is set to false, please make sure the section has the same column setting as the former section. + + + + + A bool value that indicates whether this section starts a new page. The default value is true. + + + + + A string that indicates the truetype font file name. This attribute is only needed when using truetype font unicode. + + + + + + A string that indicates the name of custom AFM font file. + + + + + A string that indicates the name of custom PFM font file. + + + + + A string that indicates the name of custom font outline file. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'.This attribute is valid for custom PostScript fonts only. + + + + + A bool value that indicates whether the TrueType font is bold. This attribute is valid for TrueType fonts only. + + + + + A bool value that indicates whether the TrueType font is italic. This attribute is valid for TrueType fonts only. + + + + + A float number (culture-neutral format) that indicates the size of font. + + + + + A string that indicates the font encoding name. + + + + + A bool value that indicates if the font is embedded. + + + + + A string that indicates the text alignment mode. + + + + + A bool value that indicates whether the text is with underline. + + + + + A bool value that indicates whether the text is with overline. + + + + + A bool value that indicates whether the text is with strikeout. + + + + + A float value (culture-neutral format) that indicates space between characters.The unit is point. + + + + + A float value (culture-neutral format) that indicates space between words.The unit is point. + + + + + An string that indicates the rendering mode of the text. + + + + + A string that indicates the color of the text.For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A string that indicates the color of the graph. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A float value (culture-neutral format) that indicates the line width of the graph. + + + + + Two Float values separated by blank that indicates line dash in graph. + + + + + An int value that indicates the indent of the first line. + + + + + A bool value that indicates whether the text is spaced or not. + + + + + A string that indicates the ID of the section. + + + + + A float value (culture-neutral format) that indicates the spacing between two text lines.The unit is point. + + + + + A string that indicates the background image file name. + + + + + A string that indicates the type of the background image. + + + + + A float value (culture-neutral format) that indicates the fixed width of the background image. If this property is not set, the real image size will be used as page size. + + + + + Gets or sets a bool value that indicates whether the background image is forced to be black-and-white. If black-and-white TIFF image of CCITT subformat is used, this property must be set to true. + + + + + a bool value that indicates whether the page orientation is landscape. The default is false, which means portrait. + + + + + + + + Represents a text paragraph. + + + + + Represents a graph paragraph. + + + + + Represents a image paragraph. + + + + + Represents a table paragraph. + + + + + Represents a formfield paragraph. + + + + + Represents a floating box paragraph. + + + + + Represents a canvas paragraph. + + + + + + A string that indicates the type of the HeadFooter. It can be "odd" or "even". If this attribute is not set, the HeadFooter will appear in both odd and even page. + + + + + A float value (culture-neutral format) that indicates the distance from the header or footer's edge. The default unit is point, but cm and inch are also supported. For example, DistanceFromEdge="2cm" or DistanceFromEdge="2inch". + + + + + A float value (culture-neutral format) that indicates the bottom margin of the header or footer.The default unit is point,but cm and inch are also supported. For example, MarginTop="2cm" or MarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the bottom margin of the header or footer.The default unit is point,but cm and inch are also supported. For example, MarginBottom="2cm" or MarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the left margin of the header or footer.The default unit is point,but cm and inch are also supported. For example, MarginLeft="2cm" or MarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the right margin of the header or footer.The default unit is point, but cm and inch are also supported. For example, MarginRight="2cm" or MarginRight="2inch". + + + + + A string that indicates the text font name. When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be chosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A bool value that indicates whether the font is unicode. + + + + + A bool value that indicates whether the header or footer be printed on first page only. The default value is false. If this property is set to true, the IsSubsequentPagesOnly property should be false. + + + + + A bool value that indicates whether the header or footer be printed on last page only. The default value is false. + + + + + A bool value that indicates whether the header or footer be printed not on first page but on subsequent pages only. The default value is false. If this property is set to true, the IsFirstPageOnly property should be false. + + + + + A string that indicates the truetype font file name. This attribute is only needed when using truetype font unicode. + + + + + + A string that indicates the name of custom AFM font file. + + + + + A string that indicates the name of custom PFM font file. + + + + + A string that indicates the name of custom font outline file. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'.This attribute is valid for custom PostScript fonts only. + + + + + A bool value that indicates whether the TrueType font is bold. This attribute is valid for TrueType fonts only. + + + + + A bool value that indicates whether the TrueType font is italic. This attribute is valid for TrueType fonts only. + + + + + A float number (culture-neutral format) that indicates the size of font. + + + + + A string that indicates the font encoding name. + + + + + A bool value that indicates if the font is embedded. + + + + + A string that indicates the text alignment mode. + + + + + A bool value that indicates whether the text is with underline. + + + + + A bool value that indicates whether the text is with overline. + + + + + A bool value that indicates whether the text is with strikeout. + + + + + A float value (culture-neutral format) that indicates space between characters. The unit is point. + + + + + A float value (culture-neutral format) that indicates space between words. The unit is point. + + + + + An string that indicates the rendering mode of the text. + + + + + A string that indicates the color of the text. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A string that indicates the color of the graph. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A float value (culture-neutral format) that indicates the line width of the graph. + + + + + Float values separated by blank that indicates line dash in graph. The values number of ploydash should be less than 8. + + + + + + + A float value (culture-neutral format) that indicates tab stop position. + + + + + A string that indicates the custom tab leader type. + + + + + A string that indicates the custom tab alignment type. + + + + + + + + Represents the tab stop positions in this paragraph. + + + + + + + + + Represents the text borders. + + + + + Represents the tab stop positions in this paragraph. + + + + + Represents a segment in a Text paragraph. + + + + + + + + A float value (culture-neutral format) between 0.0 and 1.0 that indicates the opacity of the text. The default value is 1.0. + + + + + + + + + Gets or sets a bool value that indicates whether the text need to be repeated when the pdf is broken across pages. Default value is false. The attribute is only valid when the text itself and the object its ReferenceParagraphID referred to both are included in RepeatingRows. + + + + + + + + A bool value that indicates whether the text is hyphenated automatically. Default value is true. This attribute is valid only when the attribute named "IsAutoHyphenated" in Pdf and in Section both are set to true. + + + + + + A float value (culture-neutral format) that indicates the left position of the paragraph. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the top position of the paragraph. The top position means the distance between the paragraph and the page's top edge. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A string that indicates the positioning type when using custom positioning. Default is "Auto" which means custom positioning is not used. + + + + + A string that indicates the reference paragraph when using paragraph relative custom positioning. The reference paragraph must be ahead of the current paragraph in the document object model. + + + + + A bool value that indicates whether the chars in right-to-left aligned. This attribute is used for right-to-left aligned language such as Arabic and Hebrew. + + + + + A bool value that indicates whether whether 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). + + + + + A bool value that indicates whether the HTML tags in text is supported. Default is false. + + + + + A float value (culture-neutral format) that indicates the width of text paragraph. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A string that indicates the text font name. When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be chosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A bool value that indicates whether the font is unicode. + + + + + A bool value that indicates whether this paragraph is disabled. The default value is false. If this property is set to true, this paragraph will not be rendered. + + + + + A string that indicates the truetype font file name. This attribute is only needed when using truetype font unicode. + + + + + + A string that indicates the name of custom AFM font file. + + + + + A string that indicates the name of custom PFM font file. + + + + + A string that indicates the name of custom font outline file. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'. +This attribute is valid for custom PostScript fonts only. + + + + + A bool value that indicates whether the TrueType font is bold. This attribute is valid for TrueType fonts only. + + + + + A bool value that indicates whether the TrueType font is italic. This attribute is valid for TrueType fonts only. + + + + + A float number (culture-neutral format) that indicates the size of font. + + + + + A string that indicates the font encoding name. + + + + + A bool value that indicates if the font is embedded. + + + + + A string that indicates the text alignment mode. It can be "Left","Center","Right","Justify" or "FullJustify". + + + + + A bool value that indicates whether the text is with underline. + + + + + A bool value that indicates whether the text is with overline. + + + + + A bool value that indicates whether the text is with strikeout. + + + + + A bool value that indicates whether the text is aligned by word. + + + + + A float value (culture-neutral format) that indicates space between characters. The unit is point. + + + + + A float value (culture-neutral format) that indicates space between words. The unit is point. + + + + + An string that indicates the rendering mode of the text. + + + + + A string that indicates the color of the text. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A string that indicates the background color of the text. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A float value (culture-neutral format) that indicates the paragraph top margin. The default unit is point, but cm and inch are also supported. For example, MarginTop="2cm" or MarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph bottom margin. The default unit is point, but cm and inch are also supported. For example, MarginBottom="2cm" or MarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph left margin. The default unit is point, but cm and inch are also supported. For example, MarginLeft="2cm" or MarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph right margin. The default unit is point, but cm and inch are also supported. For example, MarginRight="2cm" or MarginRight="2inch". + + + + + An integer value that indicates the indent of the first line. + + + + + A bool value that indicates whether the text is spaced or not. + + + + + A string that indicates the ID of the paragraph. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a page. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a column. + + + + + A bool value that indicates whether all lines in the paragraph are to remain on the same page. Default is false. This property only affects paragraphs in section (but ont in table). + + + + + A bool value that indicates whether current paragraph remains in the same page along with next paragraph. + + + + + A bool value that indicates whether this paragraph be shown in odd page only. This property used for duplex Printing. If you want to print a paragraph in a new odd page in duplex Printing,you can set "IsFirstParagraph = true" and "IsOnOddPage = true". + + + + + A float value (culture-neutral format) that indicates the spacing between two text lines. The unit is point. + + + + + A float value (culture-neutral format) that indicates the number of degrees by which the text should be rotated anticlockwise when displayed or printed. Default value is 0. + + + + + A non-negative integer number that indicates the index of the inline radiobutton that has been checked. + + + + + A string that indicates the name of inlineRadioButton's the field. When use inlineRadioButton,this must be set a unique name. + + + + + A string that indicates the color of the inline radio button background. Only RGB color is supported. The string can be the name of the color or the RGB value. R,G and B should be a value between 0 and 255. For example "Red" or "255 0 0". + + + + + A string that indicates the color of the inline radio button. Only RGB color is supported. The string can be the name of the color or the RGB value. R,G and B should be a value between 0 and 255. For example "Red" or "255 0 0". + + + + + + + + Represents the text borders. + + + + + Represents a segment in a heading paragraph. + + + + + Represents the tab stop positions in this paragraph. + + + + + Represents an image that is used as label. If ImageLabel is not null, the ImageLabel substitutes for number heading. The size of the ImageLabel will be adjusted following the Segment.TextInfo.FontSize. + + + + + + + + Gets or sets a bool value that indicates whether the heading need to be repeated when the pdf is broken across pages. Default value is false. The attribute is only valid when the heading itself and the object its ReferenceParagraphID referred to both are included in RepeatingRows. + + + + + + + + A bool value that indicates whether the text in the heading is hyphenated automatically.Default value is true. This attribute is valid only when the attribute named "IsAutoHyphenated" in Pdf and in Section both are set to true. + + + + + + A bool value that indicates whether the chars in right-to-left aligned. This attribute is used for right-to-left aligned language such as Arabic and Hebrew. + + + + + A bool value that indicates whether whether 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). + + + + + A float value (culture-neutral format) that indicates the left position of the paragraph. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the top position of the paragraph. The top position means the distance between the paragraph and the page's top edge. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A string that indicates the positioning type when using custom positioning. Default is "Auto" which means custom positioning is not used. + + + + + A string that indicates the reference paragraph when using paragraph relative custom positioning. The reference paragraph must be ahead of the current paragraph in the document object model. + + + + + A float value (culture-neutral format) that indicates the spacing between two text lines. The unit is point. + + + + + A float value (culture-neutral format) that indicates the width of text paragraph. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + An integer value that indicates the level of the heading. + + + + + Gets or sets an integer number that indicates the start number of this heading when using auto numbering. + + + + + A float value (culture-neutral format) that indicates the width of the label of the heading. The default unit is point, but cm and inch are also supported. For example, LabelWidth="2cm" or LabelWidth="2inch". + + + + + A string that indicates the number style of the heading. + + + + + A string that indicates the caption label. Set this property to 'bullet1','bullet2'...'bullet7' to use system-defined bullet. To use user defined lebel, set the BulletFontName to "Symbol" or "ZapfDingbats" and set this property to the char value of the bullet symbol. For example, UserLabel="44" and BulletFontName="ZapfDingbats". + + + + + A string that indicates the heading pattern in the "ch(s)%ch(s)" form, ch(s) can be none ,an ASCII or a combination of ASCIIs, % stands for the heading number. For example, "(%)" means "(1.1)" if here % equals 1.1. + + + + + A string that indicates the font name for bullet. "Symbol" and "ZapfDingbats" are supported. + + + + + A string that indicates the alignment type of Bullet/Label. Default value is Left. + + + + + A string that indicates the color of the Bullet/Label. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A string that indicates the alignment type of Bullet/Label. Default value is Left. + + + + + A string that indicates the color of the Bullet/Label. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A bool value that indicates whether the bullet is bold. Default is false. + + + + + A bool value that indicates whether the bullet is italic. Default is false. + + + + + A bool value that indicates whether the label is underline. Default is false. + + + + + A string that indicates the font name of the label. + + + + + A float value (culture-neutral format) that indicates the font size of label. + + + + + A bool value that indicates whether the font for bullet/Label is unicode. + + + + + A bool value that indicates whether the font for bullet/Label is unicode. + + + + + A string that indicates the truetype font file name for the bullet. This attribute is only needed when using truetype font with unicode. If your truetype font has been installed in your system, you can use truetype font with unicode without this property. But using this property will greatly improve the performance. + + + + + + A bool value that indicates whether this paragraph is disabled. The default value is false. If this property is set to true, this paragraph will not be rendered. + + + + + A bool value that indicates whether the number of the heading is in an automatical sequence. + + + + + Gets or sets a bool value that indicates if the prefix of the number is shown when using auto sequence. For example, for a label "1.2.5", if this property is set to false, the label will be "5". + + + + + A string that indicates the text font name. When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be chosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A bool value that indicates whether the font is unicode. + + + + + A string that indicates the truetype font file name. This attribute is only needed when using truetype font with unicode. If your truetype font has been installed in your system, you can use truetype font with unicode without this property. But using this property will greatly improve the performance. + + + + + + A string that indicates the name of custom AFM font file. + + + + + A string that indicates the name of custom PFM font file. + + + + + A string that indicates the name of custom font outline file. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'.This attribute is valid for custom PostScript fonts only. + + + + + A bool value that indicates whether the TrueType font is bold. This attribute is valid for TrueType fonts only. + + + + + A bool value that indicates whether the TrueType font is italic. This attribute is valid for TrueType fonts only. + + + + + A float number (culture-neutral format) that indicates the size of font. + + + + + A string that indicates the font encoding name. + + + + + A bool value that indicates if the font is embedded. + + + + + A string that indicates the text alignment mode. + + + + + A bool value that indicates whether the text is with underline. + + + + + A bool value that indicates whether the text is with overline. + + + + + A bool value that indicates whether the text is with strikeout. + + + + + A float value (culture-neutral format) that indicates space between characters. The unit is point. + + + + + A float value (culture-neutral format) that indicates space between words. The unit is point. + + + + + An string that indicates the rendering mode of the text. + + + + + A string that indicates the color of the text. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + An integer value that indicates the Z-order of the text. A text with larger ZIndex will be placed over paragraphs with smaller ZIndex. ZIndex can be negative. Text with negative ZIndex will be placed behind the text in the page. + + + + + A string that indicates the background color of the heading. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A float value (culture-neutral format) that indicates the paragraph top margin.The default unit is point, but cm and inch are also supported. For example, MarginTop="2cm" or MarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph bottom margin. The default unit is point, but cm and inch are also supported. For example, MarginBottom="2cm" or MarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph left margin.The default unit is point, but cm and inch are also supported. For example, MarginLeft="2cm" or MarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph right margin. The default unit is point, but cm and inch are also supported. For example, MarginRight="2cm" or MarginRight="2inch". + + + + + An integer value that indicates the indent of the first line. + + + + + A bool value that indicates whether the text is spaced or not. + + + + + A string that indicates the ID of the paragraph. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a page. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a column. + + + + + A bool value that indicates whether all lines in the paragraph are to remain on the same page. Default is false. This property only affects paragraphs in section (but ont in table). + + + + + A bool value that indicates whether current paragraph remains in the same page along with next paragraph. + + + + + A bool value that indicates whether this paragraph be shown in odd page only. This property used for duplex Printing. If you want to print a paragraph in a new odd page in duplex Printing, you can set "IsFirstParagraph = true" and "IsOnOddPage = true". + + + + + A bool value indicates whether the heading is added to the Table of Contents. + + + + + + + + Represents the graph borders. + + + + + Represents a line shape in a graph. + + + + + Represents a rectangle shape in a graph. + + + + + Represents a ellipse shape in a graph. + + + + + Represents a circle shape in a graph. + + + + + Represents a arc shape in a graph. + + + + + Represents a curve shape in a graph. + + + + + Represents the graph title. + + + + + Represents a note in a graph. + + + + + + + + Gets or sets a bool value that indicates whether the graph need to be repeated when the pdf is broken across pages. Default value is false. The attribute is only valid when the graph itself and the object its ReferenceParagraphID referred to both are included in RepeatingRows. + + + + + + + A int value that indicates the Z-order of the graph. A graph with larger ZIndex will be placed over the graph with smaller ZIndex. ZIndex can be negative. Graph with negative ZIndex will be placed behind the text in the page. + + + + + A float value (culture-neutral format) that indicates the graph width. The default unit is point, but cm and inch are also supported. For example, GraphWidth="10cm" or GraphWidth="5inch". + + + + + A float value (culture-neutral format) that indicates the graph height. The default unit is point, but cm and inch are also supported. For example, GraphWidth="10cm" or GraphWidth="5inch". + + + + + A float value (culture-neutral format) that indicates the left position of the paragraph. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the top position of the paragraph. The top position means the distance between the paragraph and the page's top edge.The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A string that indicates the positioning type when using custom positioning. Default is "Auto" which means custom positioning is not used. + + + + + A string that indicates the reference paragraph when using paragraph relative custom positioning. The reference paragraph must be ahead of the current paragraph in the document object model. + + + + + A float value (culture-neutral format) that indicates the paragraph top margin.The default unit is point, but cm and inch are also supported. For example, MarginTop="2cm" or MarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph bottom margin.The default unit is point, but cm and inch are also supported. For example, MarginBottom="2cm" or MarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph left margin. The default unit is point, but cm and inch are also supported. For example, MarginLeft="2cm" or MarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph right margin. The default unit is point, but cm and inch are also supported. For example, MarginRight="2cm" or MarginRight="2inch". + + + + + A string that indicates the text alignment mode. + + + + + A float value (culture-neutral format) that indicates the line width of the graph. + + + + + A string that indicates the color of the graph. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A bool value that indicates whether this paragraph is disabled. The default value is false. If this property is set to true, this paragraph will not be rendered. + + + + + A string that indicates the fill color of the graph. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + An integer value between 0 and 2 that indicates the line join mode. + + + + + An integer value between 0 and 2 that indicates the line cap mode. + + + + + A positive integer value that indicates the flatness. + + + + + An integer value greater than or equal to 1 that indicates the miter limit. + + + + + Two float value separated by blank that indicates the coordinate of the new origin when transforming a coordinate system. + + + + + Two float value separated by blank that indicates the scale rate in x and y coordinate. + + + + + Two float value separated by blank that indicates the skew angle in x and y coordinate. The unit is degree. + + + + + A float value (culture-neutral format) that indicates the rotation angle of the coordinate system when transforming a coordinate system. The unit is degree. + + + + + A string that indicates the graph fill rule. It can be "winding" or "evenodd". + + + + + A string that indicates the ID of the section. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a page. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a column. + + + + + A bool value that indicates whether all lines in the paragraph are to remain on the same page. Default is false. This property only affects paragraphs in section (but ont in table). + + + + + A bool value that indicates whether current paragraph remains in the same page along with next paragraph. + + + + + A bool value that indicates whether this paragraph be shown in odd page only. This property used for duplex Printing. If you want to print a paragraph in a new odd page in duplex Printing,you can set "IsFirstParagraph = true" and "IsOnOddPage = true". + + + + + A string that indicates the hyperlink type. + + + + + A string that indicates the link target ID. + + + + + A string that indicates the link file name. + + + + + An integer value that indicates the page number of the link page. + + + + + A string that indicates the link url. + + + + + A string that indicates the link destination type. It can be "Retain","FitPage","FitWidth","FitHeight","FitBox". + + + + + A bool value indicates whether the graph is added to List of Figures. + + + + + A string that indicates the menu item type when setting ExcuteMenuItem link actions. If there are more than one actions, separate them by a blank like 'ViewZoomFitWidth ViewGoToPage'. + + + + + A string that indicates the web URL when setting OpenWebLink link actions. + + + + + A string that indicates the file name when setting OpenFile link actions. + + + + + + + + + Represent a row in a table. + + + + + Represents the border of the table. + + + + + Represents the default cell border of the table. + + + + + + A string that indicates which type of reporting service items is mapped to this table. + + + + + Represents the default column width in the table. The default unit is point, but cm and inch are also supported. For example,FitWidth="2cm" or FitWidth="2inch". + + + + + + + Gets or sets a bool value that indicates whether the table need to be repeated when the pdf is broken across pages. Default value is false. The attribute is only valid when the table itself and the object its ReferenceParagraphID referred to both are included in RepeatingRows. + + + + + + + A string that indicates the vertical alignment type of all paragraphs in the cell of this table. + + + + + A float value (culture-neutral format) that indicates the left position of the paragraph. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the top position of the paragraph. The top position means the distance between the paragraph and the page's top edge. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A string that indicates adjustment types for determining the column widths of table. + + + + + A string that indicates the positioning type when using custom positioning. Default is "Auto" which means custom positioning is not used. + + + + + A string that indicates the reference paragraph when using paragraph relative custom positioning. The reference paragraph must be ahead of the current paragraph in the document object model. + + + + + A float value (culture-neutral format) that indicates the paragraph top margin.The default unit is point, but cm and inch are also supported. For example, MarginTop="2cm" or MarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph bottom margin. The default unit is point, but cm and inch are also supported. For example, MarginBottom="2cm" or MarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph left margin.The default unit is point, but cm and inch are also supported. For example,MarginLeft="2cm" or MarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph right margin.The default unit is point,but cm and inch are also supported. For example,MarginRight="2cm" or MarginRight="2inch". + + + + + A bool value that indicates whether this table is disabled. The default value is false. If this property is set to true, this table will not be rendered. + + + + + A bool value that indicates whether table with only a header(IsFirstRowRepeated=true and Rows. Count=1) be shown. The default value is true. + + + + + A bool value that indicates if the empty row at the bottom of the table be shown in the PDF. When a table is larger and can't be display in one page, the table will be split into more tables. Sometimes the broken table has a empty row at the bottom. This property is used to control the displaying of the empty row. The default value is false. + + + + + A float value (culture-neutral format) that indicates the default cell top padding. The default unit is point, but cm and inch are also supported. For example,DefaultCellPaddingTop="2cm" or DefaultCellPaddingTop="2inch". + + + + + A float value (culture-neutral format) that indicates the default cell bottom padding. The default unit is point, but cm and inch are also supported. For example, DefaultCellPaddingBottom="2cm" or DefaultCellPaddingBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the default cell left padding.The default unit is point, but cm and inch are also supported. For example,DefaultCellPaddingLeft="2cm" or DefaultCellPaddingLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the default cell right padding. The default unit is point, but cm and inch are also supported. For example,DefaultCellPaddingRight="2cm" or DefaultCellPaddingRight="2inch". + + + + + A string that indicates the default text font name in cells. When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be chosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A bool value that indicates whether the font is unicode in cells. + + + + + A string that indicates the default truetype font file name in cells. This attribute is only needed when using truetype font unicode. + + + + + + A string that indicates the default name of custom AFM font file in cells. + + + + + A string that indicates the default name of custom PFM font file in cells. + + + + + A string that indicates the default name of custom font outline file in cells. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the default name of font encoding file in cells. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'.This attribute is valid for custom PostScript fonts only. + + + + + A bool value that indicates whether the TrueType font is bold in cells. This attribute is valid for TrueType fonts only. + + + + + A bool value that indicates whether the TrueType font is italic in cells. This attribute is valid for TrueType fonts only. + + + + + A float number (culture-neutral format) that indicates the default size of font in cells. + + + + + A string that indicates the default font encoding name in cells. + + + + + A bool value that indicates if the font is embedded in cells. + + + + + A string that indicates the default text alignment mode in cells. It can be "Left","Center","Right","Justify" or "FullJustify". + + + + + A bool value that indicates whether the text is with underline in cells. + + + + + A bool value that indicates whether the text is with overline in cells. + + + + + A bool value that indicates whether the text is with strikeout in cells. + + + + + A float value (culture-neutral format) that indicates default space between charcters in cells. The unit is point. + + + + + A float value (culture-neutral format) that indicates default space between words in cells. The unit is point. + + + + + An string that indicates the default rendering mode of the text in cells. + + + + + A string that indicates the default color of the text in cells. For example, "Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A string that indicates the default background color of the text in cells. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A float value (culture-neutral format) that indicates the default spacing between two text lines in cells. The unit is point. + + + + + A string that indicates the paragraph alignment mode. + + + + + A string that indicates the ID of the paragraph. + + + + + A string that contains the width of each columns in this table. The value of each column should be separated by blank. The default unit is point, but cm and inch are also supported. For example,"120 2.5cm 1.5inch". The max column number is 128. If this property is set, the FitWidth property of the Cell object needs not set. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a page. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a column. + + + + + A bool value that indicates whether all lines in the paragraph are to remain on the same page. Default is false. This property only affects paragraphs in section (but ont in table). + + + + + A bool value that indicates whether current paragraph remains in the same page along with next paragraph. + + + + + A bool value that indicates whether this paragraph be shown in odd page only. This property used for duplex Printing. If you want to print a paragraph in a new odd page in duplex Printing,you can set "IsFirstParagraph = true" and "IsOnOddPage = true". + + + + + A bool value that indicates whether the row can be broken or not when its table is broken. + + + + + A bool value that indicates whether the table can be broken or not when it span pages. + + + + + A bool value that indicates whether the first row of table be repeated when table break. + + + + + An int value that indicates how many rows from the first row will be repeated when the table is broken across pages. + + + + + A bool value indicates whether the table is added to List of Tables. + + + + + + + + Represents the border of the row. + + + + + Represents a cell in a row of table. + + + + + + Represents the default cell border of the row. + + + + + + A bool value that indicates whether to split the table from this row and display the subsequent rows on the next page. + + + + + A string that indicates the background color of the row.For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180" + + + + + A string that indicates the vertical alignment type of all paragraphs in the cell of this row. It can be "Top", "Center" or "Bottom". + + + + + A float value (culture-neutral format) that indicates the fixed row height. If the fixed row height is set too small, it will be enlarged automatically. The default unit is point, but cm and inch are also supported. For example,FixedRowHeight="2cm" or FixedRowHeight="2inch". + + + + + A float value (culture-neutral format) that indicates the row height. The default unit is point, but cm and inch are also supported. For example,FixedRowHeight="2cm" or FixedRowHeight="2inch". + + + + + A bool value that indicates whether the row's height is fixed. The default value is false. It will be enlarged automatically if the fixed row height is set too small. Otherwise(true), the row's height is fixed and text exceed the height will be cut. + + + + + A bool value that indicates whether this row is disabled. The default value is false. If this property is set to true, this row will not be rendered. + + + + + A string that indicates the row alignment mode. + + + + + A string that indicates the ID of the row. + + + + + A bool value that indicates whether the row can be broken or not when it span pages. + + + + + + + + Represents the border of the cell. + + + + + Represents a text paragraph. + + + + + Represents a graph paragraph. + + + + + Represents a image paragraph. + + + + + Represents a attachment paragraph. + + + + + Represents a formfield paragraph. + + + + + Represents a table paragraph. + + + + + Represents a heading paragraph. + + + + + Represents a canvas paragraph. + + + + + Represents a floating box paragraph. + + + + + + A float value (culture-neutral format) that indicates the rotation angle of the texts in cells. The unit is degree. + + + + + A string that indicates the cell alignment mode. + + + + + A string that indicates the vertical alignment type of all paragraphs in the cell. It can be "Top","Center" or "Bottom". + + + + + A float value (culture-neutral format) that indicates the top padding of the cell.The default unit is point, but cm and inch are also supported. For example, PaddingTop="2cm" or PaddingTop="2inch". + + + + + A float value (culture-neutral format) that indicates the bottom padding of the cell.The default unit is point, but cm and inch are also supported. For example, PaddingBottom="2cm" or PaddingBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the left padding of the cell.The default unit is point, but cm and inch are also supported. For example,PaddingLeft="2cm" or PaddingLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the right padding of the cell.The default unit is point, but cm and inch are also supported. For example, PaddingRight="2cm" or PaddingRight="2inch". + + + + + Obsolete. Please use Table.ColumnWidths instead. A float value (culture-neutral format) that indicates the fit width of the cell. The default unit is point, but cm and inch are also supported. For example, FitWidth="2cm" or FitWidth="2inch". + + + + + A string that indicates the background color of the cell.For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180" + + + + + A string that indicates the ID of the cell. + + + + + An integer value that indicates how many columns the cell spans. + + + + + An integer value that indicates how many rows the cell spans. + + + + + + + + Represents the left border. + + + + + Represents the top border. + + + + + Represents the right border. + + + + + Represents the bottom border. + + + + + Represents all borders.It has the same meaning when using "Box" and will be replaced by "Box" one year later. So, please use "Box" if possible. + + + + + Represents all borders. + + + + + + + + A float value (culture-neutral format) that indicates the line width of the border. + + + + + A string that indicates the color of the border. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + Two Float values separated by blank that indicates line dash in graph. + + + + + Float values separated by blank that indicates line dash of border. The values number of ploydash should be less than 8. + + + + + A string that indicates the border style. It can be "Normal" or "Double". More styles will be supported later. + + + + + An integer value between 0 and 2 that indicates the line cap mode of the border. + + + + + + + A string that indicates the ID of the JavaScript. + + + + + + + + Represents the borders of the segment. + + + + + Represents a image paragraph. + + + + + Represents a graph Paragraph. + + + + + Represents a formfield paragraph. + + + + + Represents a RadioButton paragraph. + + + + + Represents a attachment paragraph. + + + + + Represents the footnote of the previous segment. + + + + + Represents the endnote of the previous segment. + + + + + + + A bool value that indicates whether the text in the segment is hyphenated automatically. Default value is true. This attribute is valid only when the attribute named "IsAutoHyphenated" in Pdf, in Section and in Text are set to true. + + + + + + A string that indicates the text font name. When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be chosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A bool value that indicates whether the font is unicode. + + + + + A bool value that indicates whether the chars in right-to-left aligned. This attribute is used for right-to-left aligned language such as Arabic and Hebrew. + + + + + A string that indicates the truetype font file name. This attribute is only needed when using truetype font unicode. + + + + + + A string that indicates the name of custom AFM font file. + + + + + A string that indicates the name of custom PFM font file. + + + + + A string that indicates the name of custom font outline file. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'. +This attribute is valid for custom PostScript fonts only. + + + + + A bool value that indicates whether the TrueType font is bold. This attribute is valid for TrueType fonts only. + + + + + A bool value that indicates whether the TrueType font is italic. This attribute is valid for TrueType fonts only. + + + + + A float number (culture-neutral format) that indicates the size of font. + + + + + A string that indicates the font encoding name. + + + + + A bool value that indicates if the font is embedded. + + + + + A bool value that indicates whether the text is with underline. + + + + + A bool value that indicates whether the text is with overline. + + + + + A bool value that indicates whether the text is with strikeout. + + + + + A bool value that indicates whether the text is baseline. + + + + + A float value (culture-neutral format) that indicates space between characters. The unit is point. + + + + + A float value (culture-neutral format) that indicates space between words. The unit is point. + + + + + An string that indicates the rendering mode of the text. + + + + + A string that indicates the color of the text. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A string that indicates the background color of the segment.For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A string that indicates the date format of the replaceable date symbol($D).It's value can be "d", "D", "f", "F","g", "G","m","r","s","t", "T","u", "U","y","dddd, MMMM dd yyyy","ddd, MMM d \"'\"yy","dddd, MMMM dd","M/yy","dd-MM-yy". The default value is "d". Please refer to example of DateTime.ToString() in MSDN. + + + + + A bool value that indicates whether a symbol like $p is replaceable or not. + + + + + A string that indicates the hyperlink type. + + + + + A string that indicates the link target ID. + + + + + A string that indicates the link file name. + + + + + An integer value that indicates the page number of the link page. + + + + + A string that indicates the link url. + + + + + A string that indicates the link destination type. It can be "Retain","FitPage","FitWidth","FitHeight","FitBox". + + + + + A string that indicates the ID of the paragraph. + + + + + A bool value that indicates whether Roman number is used. The default value is false which means Arabic number. + + + + + a bool value that indicates the Roman page number is Capital or lowercase, the default value is false which means lowercase. + + + + + A string that indicates the menu item type when setting ExcuteMenuItem link actions. If there are more than one actions, separate them by a blank like 'ViewZoomFitWidth ViewGoToPage'. + + + + + A string that indicates the web URL when setting OpenWebLink link actions. + + + + + A string that indicates the file name when setting OpenFile link actions. + + + + + + + + Float numbers separated by blank that indicates the coordinates of the line end points. + + + + + A float value (culture-neutral format) that indicates the line width. + + + + + An integer value between 0 and 2 that indicates the line join mode. + + + + + An integer value between 0 and 2 that indicates the line cap mode. + + + + + A string that indicates the color of the line. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + + + + Two Float values separated by blank that indicates line dash in graph. + + + + + Float values separated by blank that indicates line dash in graph. The values number of ploydash should be less than 8. + + + + + A string that indicates the ID of the line. + + + + + A bool value indicates whether add arrow at the start of line. + + + + + A bool value indicates whether add arrow at the end of line. + + + + + + + Four float numbers separated by blank that indicates the left, bottom, width and height of the rectangle. + + + + + A float value (culture-neutral format) that indicates the line width. + + + + + A float value (culture-neutral format) that indicates the radius for the round corner. + + + + + A string that indicates the color of the line. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + Two Float values separated by blank that indicates line dash. + + + + + Float values separated by blank that indicates line dash in graph. The values number of ploydash should be less than 8. + + + + + A string that indicates the fill color of the rectangle. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A bool value that indicates whether the rectangle be filled. + + + + + A string that indicates the graph fill rule. It can be "winding" or "evenodd". + + + + + A string that indicates the ID of the rectangle. + + + + + + + Two float numbers separated by blank that indicates the coordinates of the center position of the circle. + + + + + A float value (culture-neutral format) that indicates the line width. + + + + + A float value (culture-neutral format) that indicates the radius of the circle. + + + + + A string that indicates the color of the circle. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + Two Float values separated by blank that indicates line dash in graph. + + + + + Float values separated by blank that indicates line dash in graph. The values number of ploydash should be less than 8. + + + + + A string that indicates the fill color of the circle. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A bool value that indicates whether the circle be filled. + + + + + A string that indicates the graph fill rule. It can be "winding" or "evenodd". + + + + + A string that indicates the ID of the circle. + + + + + + + Two float numbers separated by blank that indicates the coordinates of the center position of the arc. + + + + + A float value (culture-neutral format) that indicates the line width. + + + + + A float value (culture-neutral format) that indicates the radius of the arc. + + + + + A string that indicates the color of the arc. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + Two Float values separated by blank that indicates line dash in graph. + + + + + Float values separated by blank that indicates line dash in graph. The values number of ploydash should be less than 8. + + + + + A float value (culture-neutral format) that indicates the beginning angle degree of the arc. + + + + + A float value (culture-neutral format) that indicates the ending angle degree of the arc. + + + + + A string that indicates the ID of the arc. + + + + + + + Float numbers separated by blank that indicates the coordinates of the curve control points. + + + + + A float value (culture-neutral format) that indicates the line width. + + + + + A string that indicates the color of the curve. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + Two Float values separated by blank that indicates line dash in graph. + + + + + Float values separated by blank that indicates line dash in graph. The values number of ploydash should be less than 8. + + + + + A string that indicates the ID of the curve. + + + + + + + A string that indicates the text font name. When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be chosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A bool value that indicates whether the font is unicode. + + + + + A string that indicates the truetype font file name. This attribute is only needed when using truetype font unicode. + + + + + + A string that indicates the name of custom AFM font file. + + + + + A string that indicates the name of custom PFM font file. + + + + + A string that indicates the name of custom font outline file. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'.This attribute is valid for custom PostScript fonts only. + + + + + A bool value that indicates whether the TrueType font is bold. This attribute is valid for TrueType fonts only. + + + + + A bool value that indicates whether the TrueType font is italic. This attribute is valid for TrueType fonts only. + + + + + A float number (culture-neutral format) that indicates the size of font. + + + + + A string that indicates the font encoding name. + + + + + A bool value that indicates if the font is embedded. + + + + + A bool value that indicates whether the text is with underline. + + + + + A bool value that indicates whether the text is with overline. + + + + + A bool value that indicates whether the text is with strikeout. + + + + + A float value (culture-neutral format) that indicates space between characters. The unit is point. + + + + + A float value (culture-neutral format) that indicates space between words. The unit is point. + + + + + An string that indicates the rendering mode of the text. + + + + + A string that indicates the color of the text. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64", "gray 180". + + + + + + + A string that indicates the text font name. +When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be chosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A bool value that indicates whether the font is unicode. + + + + + A string that indicates the truetype font file name. This attribute is only needed when using truetype font unicode. + + + + + + A string that indicates the name of custom AFM font file. + + + + + A string that indicates the name of custom PFM font file. + + + + + A string that indicates the name of custom font outline file. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'.This attribute is valid for custom PostScript fonts only. + + + + + A bool value that indicates whether the TrueType font is bold. This attribute is valid for TrueType fonts only. + + + + + A bool value that indicates whether the TrueType font is italic. This attribute is valid for TrueType fonts only. + + + + + A float number (culture-neutral format) that indicates the size of font. + + + + + A string that indicates the font encoding name. + + + + + A bool value that indicates if the font is embedded. + + + + + A bool value that indicates whether the text is with underline. + + + + + A bool value that indicates whether the text is with overline. + + + + + A bool value that indicates whether the text is with strikeout. + + + + + A float value (culture-neutral format) that indicates space between characters.The unit is point. + + + + + A float value (culture-neutral format) that indicates space between words.The unit is point. + + + + + An string that indicates the rendering mode of the text. + + + + + A string that indicates the color of the text. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + Two float numbers separated by blank that indicates the coordinates of the position of the note. + + + + + + + + Represents the image borders. + + + + + Represents the title of the image. + + + + + Represents a note of the image. + + + + + Represents a Base64 string that indicatesthe image data. + + + + + + + + Gets or sets a bool value that indicates whether the image need to be repeated when the pdf is broken across pages. Default value is false. The attribute is only valid when the image itself and the object its ReferenceParagraphID referred to both are included in RepeatingRows. + + + + + + + A float value (culture-neutral format) between 0.0 and 1.0 that indicates the opacity of the image. The default value is 1.0. + + + + + A float value (culture-neutral format) between -90 and 90 that indicates the number of degrees by which the image should be rotated anticlockwise when displayed or printed. Default value is 0. + + + + + A int value that indicates the Z-order of the image. A image with larger ZIndex will be placed over the image with smaller ZIndex. ZIndex can be negative. Image with negative ZIndex will be placed behind the text in the page. + + + + + A float value (culture-neutral format) that indicates the image width. This property is need when using CCITT fax image or image on the web. NOTE: This attribute is now obsolete. Web image can be supported by setting the URL in Image.ImageInfo.File.You need not set this property any more. For CCITT image, please use ImageInfo.CcittImageWidth instead. It will be removed 12 months later since release 3.0.0.0 in April 2006. Aspose apologizes for any inconvenience you may have experienced. + + + + + A float value (culture-neutral format) that indicates the image height.This property is need when using CCITT fax image or image on the web. NOTE: This attribute is now obsolete. Web image can be supported by setting the URL in Image.ImageInfo.File. You need not set this property any more. For CCITT image, please use ImageInfo.CcittImageWidth instead. It will be removed 12 months later since release 3.0.0.0 in April 2006. Aspose apologizes for any inconvenience you may have experienced. + + + + + A float value (culture-neutral format) that indicates the CCITT image width. CCITT image does not contain size information so the width and height must be set by user. + + + + + A float value (culture-neutral format) that indicates the CCITT image height. CCITT image does not contain size information so the width and height must be set by user. + + + + + A float value (culture-neutral format) that indicates the left position of the paragraph. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the top position of the paragraph. The top position means the distance between the paragraph and the page's top edge. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A string that indicates the positioning type when using custom positioning. Default is "Auto" which means custom positioning is not used. + + + + + A string that indicates the reference paragraph when using paragraph relative custom positioning. The reference paragraph must be ahead of the current paragraph in the document object model. + + + + + Gets or sets a float value that indicates the fixed width of the image. If this property is set, the image will be scaled to the fixed width. + + + + + Gets or sets a float value that indicates the fixed height of the image. If this property is set, the image will be scaled to the fixed width. + + + + + A float value (culture-neutral format) that indicates the paragraph top margin.The default unit is point,but cm and inch are also supported. For example,MarginTop="2cm" or MarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph bottom margin.The default unit is point, but cm and inch are also supported. For example,MarginBottom="2cm" or MarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph left margin. The default unit is point, but cm and inch are also supported. For example,MarginLeft="2cm" or MarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph right margin. The default unit is point, but cm and inch are also supported. For example,MarginRight="2cm" or MarginRight="2inch". + + + + + A string that indicates the paragraph alignment mode. + + + + + A bool value that indicates whether this paragraph is disabled. The default value is false. If this property is set to true, this paragraph will not be rendered. + + + + + A string that indicates the image file name and its path or url of a web image. + + + + + A string that indicates the default image file name. If this name is not null, Aspose.Pdf will use this image file when the image specified in File property is not found. + + + + + A string that indicates the subformat of CCITT image. It is used for CCITT image only. The value can be Group31D,Group32D and Group4 + + + + + Gets or sets a bool value that indicates whether the image is forced to be black-and-white. If TIFF image of CCITT subformat is used, this property must be set to true. + + + + + A bool value that indicates whether the "image not found" error be ignored or not. + + + + + A bool value that indicates whether black is considered as 1 in an image. + + + + + A string that indicates the image type. + + + + + A string that indicates the image open type. + + + + + An int value that indicates the color component number of the image. This atribute is need only when using web image. + + + + + An integer value that indicates the frame number of TIFF image. This attribute is need only when using multi-pages TIFF image. If this property is set to -1, all frames of the tiff images will be added into the PDF document. + + + + + An integer value that indicates the color bits per component of the image. This attribute is need only when using web image. + + + + + A string that indicates the ID of the paragraph. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a page. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a column. + + + + + A bool value that indicates whether all lines in the paragraph are to remain on the same page. Default is false. This property only affects paragraphs in section (but ont in table). + + + + + A bool value that indicates whether current paragraph remains in the same page along with next paragraph. + + + + + A bool value that indicates whether this paragraph be shown in odd page only. This property used for duplex Printing. If you want to print a paragraph in a new odd page in duplex Printing, you can set "IsFirstParagraph = true" and "IsOnOddPage = true". + + + + + A float value (culture-neutral format) that indicates the scale of the image when placed into pdf file. + + + + + A string that indicates the hyperlink type. + + + + + A string that indicates the link target ID. + + + + + A string that indicates the link file name. + + + + + An integer value that indicates the page number of the link page. + + + + + A string that indicates the link url. + + + + + A string that indicates the link destination type. It can be "Retain","FitPage","FitWidth","FitHeight","FitBox". + + + + + A bool value indicates whether the image is added to the ListOfFigures. + + + + + A string that indicates the menu item type when setting ExcuteMenuItem link actions. If there are more than one actions, separate them by a blank like 'ViewZoomFitWidth ViewGoToPage'. + + + + + A string that indicates the web URL when setting OpenWebLink link actions. + + + + + A string that indicates the file name when setting OpenFile link actions. + + + + + Gets or sets a bool value that indicates whether the image fit to the size of cell which has the only image paragraph. + + + + + + + + A string that indicates the attach file name. + + + + + A string that indicates the MIME type of the attached file. + + + + + + + + Represents a XMP metadata item. + + + + + + + + A string that indicates the XML namespace of the XMP metadata. + + + + + A string that indicates the name of the XMP metadata item. + + + + + A string that indicates the value of the XMP metadata item. + + + + + + + A float value (culture-neutral format) that indicates the left position of the paragraph. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the top position of the paragraph. The top position means the distance between the paragraph and the page's top edge. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the left position of the note's popup window. The default unit is point, but cm and inch are also supported. The property is used for custom positioning of the note's popup window. You need not use this property if you want the note's popup window be auto aligned. + + + + + A float value (culture-neutral format) that indicates the top position of the note's popup window. The default unit is point, but cm and inch are also supported. The property is used for custom positioning of the note's popup window. You need not use this property if you want the note's popup window be auto aligned. + + + + + A float value (culture-neutral format) that indicates the width of the note's popup window. The default unit is point, but cm and inch are also supported. The property is used for custom positioning of the note's popup window. You need not use this property if you want the note's popup window be auto aligned. + + + + + A float value (culture-neutral format) that indicates the height of the note's popup window. The default unit is point, but cm and inch are also supported. The property is used for custom positioning of the note's popup window. You need not use this property if you want the note's popup window be auto aligned. + + + + + A string that indicates the positioning type when using custom positioning. Default is "Auto" which means custom positioning is not used. + + + + + A string that indicates the positioning type when using custom positioning for note's oppup window. Default is "Auto" which means custom positioning is not used. + + + + + A string that indicates the reference paragraph when using paragraph relative custom positioning. The reference paragraph must be ahead of the current paragraph in the document object model. + + + + + A float value (culture-neutral format) that indicates the paragraph top margin.The default unit is point, but cm and inch are also supported. For example, MarginTop="2cm" or MarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph bottom margin.The default unit is point, but cm and inch are also supported. For example,MarginBottom="2cm" or MarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph left margin. The default unit is point, but cm and inch are also supported. For example, MarginLeft="2cm" or MarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph right margin. The default unit is point, but cm and inch are also supported. For example, MarginRight="2cm" or MarginRight="2inch". + + + + + A string that indicates the attachment type. It can be "File" or "Note". + + + + + A string that indicates the attach file name. + + + + + A string that indicates the MIME type of the attached file. + + + + + A bool value that indicates whether this paragraph is disabled. The default value is false. If this property is set to true, this paragraph will not be rendered. + + + + + A string that indicates the file attachment icon type. + + + + + A string that indicates the content of the attached note. + + + + + A string that indicates the title of the attached note. + + + + + A string that indicates the note icon type. + + + + + A string that indicates the color of the icon. For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A bool value that indicates whether the note is open or not when the Pdf document is opened. + + + + + A string that indicates the ID of the note. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a page. + + + + + A bool value that indicates whether the paragraph is the first paragraph of a column. + + + + + A bool value that indicates whether all lines in the paragraph are to remain on the same page. Default is false. This property only affects paragraphs in section (but ont in table). + + + + + A bool value that indicates whether current paragraph remains in the same page along with next paragraph. + + + + + A bool value that indicates whether this paragraph be shown in odd page only. This property used for duplex Printing. If you want to print a paragraph in a new odd page in duplex Printing,you can set "IsFirstParagraph = true" and "IsOnOddPage = true". + + + + + + + A float value (culture-neutral format) that indicates the left position of the paragraph. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the top position of the paragraph. The top position means the distance between the paragraph and the page's top edge. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the width of the radiobutton. The default unit is point, but cm and inch are also supported. The property is used for custom positioning of the note's popup window. You need not use this property if you want the note's popup window be auto aligned. + + + + + A float value (culture-neutral format) that indicates the height of the radiobutton. The default unit is point, but cm and inch are also supported. The property is used for custom positioning of the note's popup window. You need not use this property if you want the note's popup window be auto aligned. + + + + + A string that indicates the positioning type when using custom positioning. Default is "Auto" which means custom positioning is not used. + + + + + A string that indicates the reference paragraph when using paragraph relative custom positioning. The reference paragraph must be ahead of the current paragraph in the document object model. + + + + + A float value (culture-neutral format) that indicates the paragraph top margin.The default unit is point, but cm and inch are also supported. For example, MarginTop="2cm" or MarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph bottom margin.The default unit is point, but cm and inch are also supported. For example,MarginBottom="2cm" or MarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph left margin.The default unit is point, but cm and inch are also supported. For example, MarginLeft="2cm" or MarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph right margin.The default unit is point, but cm and inch are also supported. For example, MarginRight="2cm" or MarginRight="2inch". + + + + + + + + Represents a radiobutton item in a radiobutton field. + + + + + Represents a choice option item for a combo or list field. + + + + + + A string that indicates the ID of the form field. + + + + + A float value (culture-neutral format) that indicates the left position of the paragraph. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the top position of the paragraph. The top position means the distance between the paragraph and the page's top edge.The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the width of the form. The default unit is point, but cm and inch are also supported. The property is used for custom positioning of the note's popup window. You need not use this property if you want the note's popup window be auto aligned. + + + + + A float value (culture-neutral format) that indicates the height of the form. The default unit is point, but cm and inch are also supported. The property is used for custom positioning of the note's popup window. You need not use this property if you want the note's popup window be auto aligned. + + + + + A string that indicates the positioning type when using custom positioning. Default is "Auto" which means custom positioning is not used. + + + + + A string that indicates the reference paragraph when using paragraph relative custom positioning. The reference paragraph must be ahead of the current paragraph in the document object model. + + + + + A string consists of a int array that indicates the choice selection indexes, e.g., If items 2 and 4 are selected, it should be ChoiceSelections="2 4" + + + + + A float value (culture-neutral format) that indicates the paragraph top margin.The default unit is point, but cm and inch are also supported. For example, MarginTop="2cm" or MarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph bottom margin.The default unit is point, but cm and inch are also supported. For example, MarginBottom="2cm" or MarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph left margin.The default unit is point, but cm and inch are also supported. For example, MarginLeft="2cm" or MarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the paragraph right margin.The default unit is point, but cm and inch are also supported. For example, MarginRight="2cm" or MarginRight="2inch". + + + + + A string that indicates the formfield type. + + + + + A string that indicates the name of the formfield. Note that each field MUST have a unique name. + + + + + A string that indicates the value of the formfield. + + + + + A bool value that indicates whether the combo is editable. + + + + + A bool value that indicates if the field is readonly. + + + + + A bool value that indicates if multi-selecting is allowed. + + + + + A string list that indicates the options of combo or list field. For example, "red green blue". NOTE: This attribute is obsolete. Please use the 'ChoiceOption' element. + + + + + A non-negative integer number that indicates the index (in the options list) of combo or list. + + + + + a bool value that indicates whether the checkbox is checked. Default is false. + + + + + A string that indicates the font name of the text field. The core fonts (Courier,Courier-Bold,Courier-BoldOblique,Courier-Oblique,Helvetica,Helvetica-Bold,Helvetica-BoldOblique, Helvetica-Oblique,Symbol,Times-Bold,Times-BoldItalic,Times-Italic,Times-Roman and ZapfDingbats) and Truetype fonts are supported. When using Truetype font, you should use the font family name. If you want the font be bold or italic, set the font name like "Arial,Bold","Arial,Italic" or "Arial,BoldItalic". + + + + + A string that indicates the color of the text field. Only RGB color is supported. The string can be the name of the color or the RGB value. R,G abd B should be a value between 0 and 255. For example "Red" or "255 0 0". + + + + + A string that indicates the color of the background. Only RGB color is supported. The string can be the name of the color or the RGB value. R,G abd B should be a value between 0 and 255. For example "Red" or "255 0 0". + + + + + A string that indicates the color of the border. Only RGB color is supported. The string can be the name of the color or the RGB value. R,G abd B should be a value between 0 and 255. For example "Red" or "255 0 0". + + + + + A string that indicates the color of the button. Only RGB color is supported. The string can be the name of the color or the RGB value. R,G and B should be a value between 0 and 255. For example "Red" or "255 0 0". + + + + + A bool value that indicates whether the text field can be multiline. Default is true. + + + + + A bool value that indicates whether the text field is password. If set to true, the field is intended for entering a secure password that should not be echoed visibly to the screen. Default value is false. + + + + + A non-negative int number that indicates the max length of the text can be entered in this field. + + + + + A non-negative int number that indicates the index of the radiobutton that has been checked. + + + + + A bool value that indicates whether the field is bordered. Default value is false. + + + + + A float value (culture-neutral format) that indicates the font size of the text field. Default is 14 points. + + + + + + + + + + Represents the border of the floating box. + + + + + Represents a text paragraph. + + + + + Represents a graph paragraph. + + + + + Represents a image paragraph. + + + + + Represents a attachment paragraph. + + + + + Represents a formfield paragraph. + + + + + Represents a table paragraph. + + + + + Represents a heading paragraph. + + + + + Represents a floating box paragraph. + + + + + + + + Gets or sets a bool value that indicates whether the floatingbox need to be repeated when the pdf is broken across pages. Default value is false. The attribute is only valid when the floatingbox itself and the object its ReferenceParagraphID referred to both are included in RepeatingRows. + + + + + + + A int value that indicates the Z-order of the floating box. A floating box with larger ZIndex will be placed over the floating box with smaller ZIndex. ZIndex can be negative. Floating box with negative ZIndex will be placed behind the text in the page. + + + + + A string that indicates the vertical alignment type of the floating box. + + + + + A string that indicates the horizontal alignment type of the floating box. + + + + + A string that indicates the vertical positioning type of the floating box. + + + + + A string that indicates the horizontal positioning type of the floating box. + + + + + A string that indicates the vertical alignment type of all paragraphs in the floating box. + + + + + A float value (culture-neutral format) that indicates the top padding of the floating box. The default unit is point, but cm and inch are also supported. For example, PaddingTop="2cm" or PaddingTop="2inch". + + + + + A float value (culture-neutral format) that indicates the bottom padding of the floating box. The default unit is point, but cm and inch are also supported. For example,PaddingBottom="2cm" or PaddingBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the left padding of the floating box. The default unit is point, but cm and inch are also supported. For example, PaddingLeft="2cm" or PaddingLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the right padding of the floating box. The default unit is point, but cm and inch are also supported. For example, PaddingRight="2cm" or PaddingRight="2inch". + + + + + A string that indicates the background color of the floating box.For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A float value (culture-neutral format) that indicates the left position of the floating box. The default unit is point, but cm and inch are also supported. The property is used when BoxHorizontalAlignment is set to "None". + + + + + A float value (culture-neutral format) that indicates the top position of the floating box. The default unit is point, but cm and inch are also supported. The property is used when BoxVerticalAlignment is set to "None". + + + + + A float value (culture-neutral format) that indicates the width of the floating box. The default unit is point, but cm and inch are also supported. + + + + + A float value (culture-neutral format) that indicates the height of the floating box. The default unit is point, but cm and inch are also supported. + + + + + A bool value that indicates whether the box's height is fixed. The default value is false. It will be enlarged automatically if the height is set too small. Otherwise(true), the box's height is fixed and text exceed the height will be cut. + + + + + A float value (culture-neutral format) that indicates the rotation angle of the texts in floating box. The unit is degree. + + + + + A string that indicates the reference paragraph when using paragraph relative horizontal positioning. The reference paragraph must be ahead of the current paragraph in the document object model. + + + + + A string that indicates the ID of the floating box. + + + + + + + + Represents the border of the canvas. + + + + + Represents a floating box paragraph. + + + + + + A string that indicates the background color of the canvas.For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A float value (culture-neutral format) that indicates the width of the canvas. The default unit is point, but cm and inch are also supported. + + + + + A float value (culture-neutral format) that indicates the height of the canvas. The default unit is point, but cm and inch are also supported. + + + + + A string that indicates the ID of the canvas. + + + + + A bool value that indicates whether current paragraph remains in the same page along with next paragraph. + + + + + + + + + + A positive value indicates the current level of the ListLevelFormat. + + + + + An integer value indicates how many chars are indented for the subsequent lines in the list item. + + + + + A string that indicates the tab leader type for the list. The default value is "Dot" + + + + + A float value (culture-neutral format) indicates left margin of list item. NOTE: This attribute is now obsolete. Please use MarginLeft instead. It will be removed 12 months later since release 3.3.1.0 in January 2007. Aspose apologizes for any inconvenience you may have experienced. + + + + + A float value (culture-neutral format) indicates left margin of list item. + + + + + A float value (culture-neutral format) indicates right margin of list item. + + + + + A float value (culture-neutral format) indicates top margin of list item. + + + + + A float value (culture-neutral format) indicates bottom margin of list item. + + + + + + + + A string that indicates the color of the border. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + + A string that indicates the color of the border. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + sets a string that indicates the name of custom AFM font file. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'.This attribute is valid for custom PostScript fonts only. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'.This attribute is valid for custom PostScript fonts only. + + + + + A string that indicates the text font name. When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be chosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A string that indicates the name of custom font outline file. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the name of custom PFM font file. + + + + + A float number (culture-neutral format) that indicates the size of font. + + + + + A bool value that indicates whether the text is baseline. + + + + + A bool value that indicates if the font is embedded. + + + + + A bool value that indicates whether the text is with overline. + + + + + A bool value that indicates whether the text is with strikeout. + + + + + + + + + A float value (culture-neutral format) that indicates the spacing between two text lines. The unit is point. + + + + + An string that indicates the rendering mode of the text. + + + + + A string that indicates the truetype font file name. This attribute is only needed when using truetype font unicode. + + + + + + A float value (culture-neutral format) that indicates space between words.The unit is point. + + + + + + + + Represents the title of the list section. + + + + + Represents the format for specified level of the list section. + + + + + Represents the page border of the section. + + + + + Represents header of a page in a Pdf document. + + + + + Represents footer of a page in a Pdf document. + + + + + Represents a text paragraph in a Pdf document. + + + + + Represents a graph Paragraph. + + + + + Represents a table Paragraph in a Pdf document. + + + + + Represents a image paragraph. + + + + + Represents a floating box paragraph. + + + + + + Represents a string that indicates the type of the list section. + + + + + Represents a bool value that indicates whether caption label is needed in TOC. + + + + + A string that indicates the background color of the section. For example, "Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180" It overloads the BackgroundColor set in Pdf. + + + + + A float value (culture-neutral format) that indicates the page size. The default unit is point, but cm and inch are also supported. For example, PageWidth="20cm" or PageWidth="5inch". + + + + + A float value (culture-neutral format) that indicates the page width. The default unit is point, but cm and inch are also supported. For example, PageWidth="20cm" or PageWidth="5inch". + + + + + A float value (culture-neutral format) that indicates the page height. + + + + + A float value (culture-neutral format) that indicates the page top margin. The default unit is point, but cm and inch are also supported. For example, PageMarginTop="2cm" or PageMarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the page bottom margin. The default unit is point, but cm and inch are also supported. For example, PageMarginBottom="2cm" or PageMarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the page left margin. The default unit is point, but cm and inch are also supported. For example, PageMarginLeft="2cm" or PageMarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the page right margin. The default unit is point, but cm and inch are also supported. For example, PageMarginRight="2cm" or PageMarginRight="2inch". + + + + + A float value (culture-neutral format) that indicates the margin between the top page border and the top page edge. The default value is half of the page top margin. The default unit is point, but cm and inch are also supported. For example, PageBorderMarginTop="2cm" or PageBorderMarginTop="2inch". + + + + + A float value (culture-neutral format) that indicates the margin between the bottom page border and the bottom page edge. The default value is half of the page bottom margin. The default unit is point, but cm and inch are also supported. For example, PageBorderMarginBottom="2cm" or PageBorderMarginBottom="2inch". + + + + + A float value (culture-neutral format) that indicates the margin between the left page border and the left page edge. The default value is half of the page left margin. The default unit is point,but cm and inch are also supported. For example, PageBorderMarginLeft="2cm" or PageBorderMarginLeft="2inch". + + + + + A float value (culture-neutral format) that indicates the margin between the right page border and the right page edge. The default value is half of the page right margin. The default unit is point,but cm and inch are also supported. For example, PageBorderMarginRight="2cm" or PageBorderMarginRight="2inch". + + + + + A string that indicates the background image file name. + + + + + A string that indicates the type of the background image. + + + + + A float value (culture-neutral format) that indicates the fixed width of the background image. If this property is not set, the real image size will be used as page size. + + + + + Gets or sets a bool value that indicates whether the background image is forced to be black-and-white. If black-and-white TIFF image of CCITT subformat is used, this property must be set to true. + + + + + a bool value that indicates whether the page orientation is landscape. The default is false, which means portrait. + + + + + + + + + + + Represents a segment in a Footnote.Note that segment object will be replaced by text in one year later. + + + + + Represents a text in a Footnote. + + + + + Represents a table in a Footnote. + + + + + Represents a image in a Footnote. + + + + + + + the value indicates the numbering continuation. The default value is ContinuationInDocument. + + + + + the value indicates the numbering format. The default value is Arab format. + + + + + A float value (culture-neutral format) that indicates the left position of the footnote. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the top position of the footnote. The top position means the distance between the paragraph and the page's top edge. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A bool value that indicates whether the chars in right-to-left aligned. This attribute is used for right-to-left aligned language such as Arabic and Hebrew. + + + + + A string that indicates the footnote font name. When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be choosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A bool value that indicates whether the font is unicode. + + + + + A string that indicates the truetype font file name. This attribute is only needed when using truetype font unicode. + + + + + + A string that indicates the name of custom AFM font file. + + + + + A string that indicates the name of custom PFM font file. + + + + + A string that indicates the name of custom font outline file. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'. +This attribute is valid for custom PostScript fonts only. + + + + + A bool value that indicates whether the TrueType font is bold. This attribute is valid for TrueType fonts only. + + + + + A bool value that indicates whether the TrueType font is italic. This attribute is valid for TrueType fonts only. + + + + + A float number (culture-neutral format) that indicates the size of font. + + + + + A string that indicates the font encoding name. + + + + + A bool value that indicates if the font is embedded. + + + + + A string that indicates the footnote alignment mode. It can be "Left","Center","Right","Justify" or "FullJustify". + + + + + A bool value that indicates whether the footnote is with underline. + + + + + A bool value that indicates whether the footnote is with overline. + + + + + A bool value that indicates whether the footnote is with strikeout. + + + + + A float value (culture-neutral format) that indicates space between characters.The unit is point. + + + + + A float value (culture-neutral format) that indicates space between words. The unit is point. + + + + + An string that indicates the rendering mode of the footnote. + + + + + A string that indicates the color of the footnote. For example, "Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A string that indicates the background color of the footnote.For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + + + + + Represents a segment in a Endnote.Note that segment object will be replaced by text in one year later. + + + + + Represents a text in a Endnote. + + + + + Represents a table in a Endnote. + + + + + Represents a image in a Endnote. + + + + + + + the value indicates the numbering continuation. The default value is ContinuationInDocument. Please NOTE that ContinuationInPage is not suitable for EndNote + + + + + the value indicates the numbering format. The default value is Arab format. + + + + + the value indicates the position of endnote. The default value is EndOfSection. + + + + + A float value (culture-neutral format) that indicates the left position of the footnote. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A float value (culture-neutral format) that indicates the top position of the footnote. The top position means the distance between the paragraph and the page's top edge. The default unit is point, but cm and inch are also supported. The property is used for custom positioning. You need not use this property if you want the paragraph be auto aligned. + + + + + A bool value that indicates whether the chars in right-to-left aligned. This attribute is used for right-to-left aligned language such as Arabic and Hebrew. + + + + + A string that indicates the footnote font name. When using TrueType fonts, it's the Family Name when you double click the TrueType font in the Fonts of the Control Panel, instead of the Full Name displayed at the first line. Generally each TrueType font has two versions: Bold and Italic, which can be chosen by setting IsTrueTypeFontBold and IsTrueTypeFontItalic attribute. + + + + + A bool value that indicates whether the font is unicode. + + + + + A string that indicates the truetype font file name. This attribute is only needed when using truetype font unicode. + + + + + + A string that indicates the name of custom AFM font file. + + + + + A string that indicates the name of custom PFM font file. + + + + + A string that indicates the name of custom font outline file. Font outline file is needed when embedding custom PostScript font into PDF files. + + + + + A string that indicates the name of font encoding file. Font encoding files are available at "http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/" and "http://www.unicode.org/Public/MAPPINGS/ISO8859/". The font encoding name is same as the encoding file name. For example, the encoding file is 'cp1250.txt' and the encoding name is 'cp1250';the encoding file is '8859-1.TXT' and the encoding name is '8859-1'. +This attribute is valid for custom PostScript fonts only. + + + + + A bool value that indicates whether the TrueType font is bold. This attribute is valid for TrueType fonts only. + + + + + A bool value that indicates whether the TrueType font is italic. This attribute is valid for TrueType fonts only. + + + + + A float number (culture-neutral format) that indicates the size of font. + + + + + A string that indicates the font encoding name. + + + + + A bool value that indicates if the font is embedded. + + + + + A string that indicates the footnote alignment mode. It can be "Left","Center","Right","Justify" or "FullJustify". + + + + + A bool value that indicates whether the footnote is with underline. + + + + + A bool value that indicates whether the footnote is with overline. + + + + + A bool value that indicates whether the footnote is with strikeout. + + + + + A float value (culture-neutral format) that indicates space between characters.The unit is point. + + + + + A float value (culture-neutral format) that indicates space between words.The unit is point. + + + + + An string that indicates the rendering mode of the footnote. + + + + + A string that indicates the color of the footnote. For example, "Red", "rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + A string that indicates the background color of the footnote.For example,"Red","rgb 0 128 128","cmyk 0 128 0 64","gray 180". + + + + + + Represents the three types of ListSection. + + + + + + + + + + Represents the enumeration of the rotation angle in cell or floatingBox. + + + + + + + + + + Represents the enumeration of the text alignment types. + + + + + + + + + + + + Represents the enumeration of PDF conformance types. + + + + + + + + + + Represents the enumeration of the alignment types. + + + + + + + + + + Represents the enumeration of the attachment types. + + + + + + + + + + Represents the enumeration of the gutter placement types. + + + + + + + + + + + + + + Represents the enumeration of the border styles. + + + + + + + + + + Represents the enumeration of the floating box horizontal alignment types. + + + + + + + + + + + Represents the enumeration of the floating box horizontal positioning types. + + + + + + + + + + Represents the enumeration of the floating box vertical alignment types. + + + + + + + + + + + Represents the enumeration of the floating box vertical positioning types. + + + + + + + + + + Represents the enumeration of the CCITT subformat types. + + + + + + + + + + Represents the enumeration of the destination types. + + + + + + + + + + + + Represents the enumeration of the file icon types. + + + + + + + + + + + Represents the enumeration of the form field types. + + + + + + + + + + + + Represents the enumeration of the header or footer types. + + + + + + + + + + Represents the enumeration of the number styles of the heading. + + + + + + + + + + + + Represents the enumeration of the hyperlink types. + + + + + + + + + + + Represents the enumeration of the image types. + + + + + + + + + + + + + + + + + + Represents the enumeration of the image open types. + + + + + + + + + + Represents the enumeration of the pdf open types. + + + + + + + + + + + Represents the enumeration of the note icon types. + + + + + + + + + + + + + + Represents the enumeration of positioning types for note's popup window. + + + + + + + + + + Represents the enumeration of page transition effects when revealing the new page. + + + + + + + + + + + + + + Represents the enumeration of the positioning types when using custom positioning. Custom positioning means customer specify the position of paragraph instead of render automatically. + + + + + + + + + + + Represents the enumeration of text rendering modes. + + + + + + + + + + + Represents the enumeration of types of custom tab stops. + + + + + + + + + + + Represents the enumeration of tab leader types. + + + + + + + + + + + Represents the enumeration of vertical alignment types. + + + + + + + + + + Represents the enumeration of vertical alignment types. + + + + + + + + + + + + + + + + + + + Represents the enumeration of column adjustment types. + + + + + + + + + + Represents the enumeration of footnote or endnote numbering continuation types. + + + + + + + + + + Represents the enumeration of footnote or endnote numbering format types. + + + + + + + + + + + + Represents the enumeration of endnote position types. + + + + + + + + + Represents the enumeration of reporting services item types. + + + + + + + + + + + + + + + + Represents the enumeration of the page number format types. + + + + + + + + + + + + + Represents the enumeration of menu item types when executing a menu item in link action. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents child bookmarks. + + + + + + A string that indicates the ID of the paragraph that the bookmark item links to. If this property is set, the 'PageNumber' and 'YPosition' properties are not needed. + + + + + A string that indicates the title of the bookmark. If the 'LinkParagraphID' is set and the linked paragraph is 'Text' or 'Heading' and this attribute is not set, the content of the 'Text' or 'Heading' will be used as the title of the bookmark item. + + + + + An integer number that indicates the page number of the bookmark link. If the 'LinkParagraphID' is set, this attribute is not needed. + + + + + A float number that indicates the Y coordination of the bookmark link. The origin of the coordination is the lower-left corner of the page. If the 'LinkParagraphID' is set, this property is not needed. + + + + + A bool value that indicates whether the bookmark item is expanded if it has child bookmarks. + + + + + A string that indicates the menu item type when setting ExcuteMenuItem link actions. If there are more than one actions, separate them by a blank like 'ViewZoomFitWidth ViewGoToPage'. + + + + + A string that indicates the web URL when setting OpenWebLink link actions. + + + + + A string that indicates the file name when setting OpenFile link actions. + + + + + + + + Represents a bookmark item + + + + + \ No newline at end of file diff --git a/Examples/README.md b/Examples/README.md index 820561a6..95fe08f4 100644 --- a/Examples/README.md +++ b/Examples/README.md @@ -10,4 +10,13 @@ This package contains Java Example Project for [Aspose.PDF for Java](http://prod ## How to Run the Examples? -All the examples are arranged in src folder and any modern IDE like IntelliJ IDEA, Eclipse, Netbeans etc can import the source folder easily. Visit our [documentation website](https://docs.aspose.com/display/pdfjava/How+to+Run+the+Examples) for more details. \ No newline at end of file +All the examples are arranged in src folder and any modern IDE like IntelliJ IDEA, Eclipse, Netbeans etc can import the source folder easily. Visit our [documentation website](https://docs.aspose.com/display/pdfjava/How+to+Run+the+Examples) for more details. + +## Install and Configure Maven + +You may find following resources helpful: + +1. Learn how to install and configure Maven - Environment Setup +2. Maven support for NetBeans +3. Maven support for IntelliJ IDEA +4. Maven support for Eclipse IDE diff --git a/Examples/pom.xml b/Examples/pom.xml index 54b53020..8eaeb544 100644 --- a/Examples/pom.xml +++ b/Examples/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.aspose pdf-java-examples - 1.0-SNAPSHOT + 1.1-SNAPSHOT jar 1.8 @@ -13,36 +13,21 @@ AsposeJavaAPI Aspose Java API - http://artifact.aspose.com/repo/ - - - com.springsource.repository.bundles.external - SpringSource Enterprise Bundle Repository - External Bundle Releases - http://repository.springsource.com/maven/bundles/external + https://releases.aspose.com/java/repo/ com.aspose aspose-pdf - 18.4 - - - javax.media.jai - com.springsource.javax.media.jai.core - 1.1.3 + 22.12 + com.aspose aspose-words - 18.5 + 22.12 jdk16 - - - commons-io - commons-io - 2.5 - \ No newline at end of file diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/AddAnnotationToPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/AddAnnotationToPDF.java index 82fa9d46..64803ead 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/AddAnnotationToPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/AddAnnotationToPDF.java @@ -1,57 +1,71 @@ package com.aspose.pdf.examples.AsposePdfExamples.Annotations; -import com.aspose.pdf.AnnotationFlags; -import com.aspose.pdf.AnnotationState; import com.aspose.pdf.Border; import com.aspose.pdf.Dash; import com.aspose.pdf.DefaultAppearance; import com.aspose.pdf.Document; import com.aspose.pdf.FreeTextAnnotation; import com.aspose.pdf.Rectangle; -import com.aspose.pdf.TextAnnotation; import com.aspose.pdf.TextIcon; +import com.aspose.pdf.examples.Utils; public class AddAnnotationToPDF { - public static void main(String[] args) { - addAnnotationToPDF(); - invisibleAnnotation(); - } - - public static void addAnnotationToPDF() { - // Open the source PDF document - Document pdfDocument = new Document("input.pdf"); - // Create annotation - TextAnnotation textAnnotation = new TextAnnotation(pdfDocument.getPages().get_Item(1), new Rectangle(200, 400, 400, 600)); - // Set annotation title - textAnnotation.setTitle("Sample Annotation Title"); - // Set annotation subject - textAnnotation.setSubject("Sample Subject"); - textAnnotation.setState(AnnotationState.Accepted); - // Specify the annotation contents - textAnnotation.setContents("Sample contents for the annotation"); - textAnnotation.setOpen(true); - textAnnotation.setIcon(TextIcon.Key); - Border border = new Border(textAnnotation); - border.setWidth(5); - border.setDash(new Dash(1, 1)); - textAnnotation.setBorder(border); - textAnnotation.setRect(new Rectangle(200, 400, 400, 600)); - // Add annotation in the annotations collection of the page - pdfDocument.getPages().get_Item(1).getAnnotations().add(textAnnotation); - // Save the output file - pdfDocument.save("output.pdf"); - } - - public static void invisibleAnnotation() { - Document doc = new Document(); - doc.getPages().add(); - FreeTextAnnotation annotation = new FreeTextAnnotation(doc.getPages().get_Item(1), new Rectangle(50, 600, 250, 650), new DefaultAppearance("Helvetica", 16, java.awt.Color.RED)); - annotation.setContents("ABCDEFG"); - annotation.getCharacteristics().setBorder(java.awt.Color.RED); - annotation.setFlags(AnnotationFlags.Print | AnnotationFlags.NoView); - doc.getPages().get_Item(1).getAnnotations().add(annotation); - doc.save("Invisible_Annotation.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Annotations/addannotation/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example addAnnotationToPDF start"); + addAnnotationToPDF(dataDir, outputDir); + System.out.println("Example addAnnotationToPDF end"); + + System.out.println("============================"); + System.out.println("Example invisibleAnnotation start"); + invisibleAnnotation(dataDir, outputDir); + System.out.println("Example invisibleAnnotation end"); + } + + public static void addAnnotationToPDF(String dataDir, String outputDir) { + // Open the source PDF document + com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(dataDir + "input.pdf"); + // Create annotation + com.aspose.pdf.TextAnnotation textAnnotation = new com.aspose.pdf.TextAnnotation(pdfDocument.getPages().get_Item(1), new Rectangle(200, 400, 400, 600)); + // Set annotation title + textAnnotation.setTitle("Sample Annotation Title"); + // Set annotation subject + textAnnotation.setSubject("Sample Subject"); + textAnnotation.setState(com.aspose.pdf.AnnotationState.Accepted); + // Specify the annotation contents + textAnnotation.setContents("Sample contents for the annotation"); + textAnnotation.setOpen(true); + textAnnotation.setIcon(TextIcon.Key); + Border border = new Border(textAnnotation); + border.setWidth(5); + border.setDash(new Dash(1, 1)); + textAnnotation.setBorder(border); + textAnnotation.setRect(new Rectangle(200, 400, 400, 600)); + // Add annotation in the annotations collection of the page + pdfDocument.getPages().get_Item(1).getAnnotations().add(textAnnotation); + // Save the output file + pdfDocument.save(outputDir + "addAnnotationToPDF.pdf"); + } + + public static void invisibleAnnotation(String dataDir, String outputDir) { + Document doc = new Document(); + doc.getPages().add(); + FreeTextAnnotation annotation = new FreeTextAnnotation(doc.getPages().get_Item(1), new Rectangle(50, 600, 250, 650), new DefaultAppearance("Helvetica", 16, java.awt.Color.RED)); + annotation.setContents("ABCDEFG"); + annotation.getCharacteristics().setBorder(java.awt.Color.RED); + annotation.setFlags(com.aspose.pdf.AnnotationFlags.Print | com.aspose.pdf.AnnotationFlags.NoView); + doc.getPages().get_Item(1).getAnnotations().add(annotation); + doc.save(outputDir + "Invisible_Annotation.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/DeleteAllAnnotationsFromPageOfPDFFile.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/DeleteAllAnnotationsFromPageOfPDFFile.java index a57de94f..269a27f1 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/DeleteAllAnnotationsFromPageOfPDFFile.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/DeleteAllAnnotationsFromPageOfPDFFile.java @@ -1,16 +1,33 @@ package com.aspose.pdf.examples.AsposePdfExamples.Annotations; import com.aspose.pdf.Document; +import com.aspose.pdf.examples.Utils; public class DeleteAllAnnotationsFromPageOfPDFFile { - public static void main(String[] args) { - // Open source PDF document - Document pdfDocument = new Document("input.pdf"); - // Delete all annotation - pdfDocument.getPages().get_Item(1).getAnnotations().delete(); - // Save the update document - pdfDocument.save("output.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Annotations/deleteallannotations/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example deleteAllAnnotationsFromPageOfPDFFile start"); + deleteAllAnnotationsFromPageOfPDFFile(dataDir, outputDir); + System.out.println("Example deleteAllAnnotationsFromPageOfPDFFile end"); + } + + private static void deleteAllAnnotationsFromPageOfPDFFile(String dataDir, String outputDir) { + // Open source PDF document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Delete all annotation + pdfDocument.getPages().get_Item(1).getAnnotations().delete(); + // Save the update document + pdfDocument.save(outputDir + "output.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/DeleteParticularAnnotationFromThePDFFile.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/DeleteParticularAnnotationFromThePDFFile.java index 83cd2cd1..07387f70 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/DeleteParticularAnnotationFromThePDFFile.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/DeleteParticularAnnotationFromThePDFFile.java @@ -1,16 +1,32 @@ package com.aspose.pdf.examples.AsposePdfExamples.Annotations; import com.aspose.pdf.Document; +import com.aspose.pdf.examples.Utils; public class DeleteParticularAnnotationFromThePDFFile { - public static void main(String[] args) { - // Open source PDF document - Document pdfDocument = new Document("input.pdf"); - // Delete particular annotation - pdfDocument.getPages().get_Item(1).getAnnotations().delete(1); - // Save the update document - pdfDocument.save("output.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Annotations/deleteparticularannotation/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example deleteParticularAnnotationFromThePDFFile start"); + deleteParticularAnnotationFromThePDFFile(dataDir, outputDir); + System.out.println("Example deleteParticularAnnotationFromThePDFFile end"); + } + + private static void deleteParticularAnnotationFromThePDFFile(String dataDir, String outputDir) { + // Open source PDF document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Delete particular annotation + pdfDocument.getPages().get_Item(1).getAnnotations().delete(1); + // Save the update document + pdfDocument.save(outputDir + "output.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/GetAllAnnotationsFromPageInPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/GetAllAnnotationsFromPageInPDF.java index 935dedc8..a49a8881 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/GetAllAnnotationsFromPageInPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/GetAllAnnotationsFromPageInPDF.java @@ -1,18 +1,34 @@ package com.aspose.pdf.examples.AsposePdfExamples.Annotations; import com.aspose.pdf.Document; +import com.aspose.pdf.examples.Utils; public class GetAllAnnotationsFromPageInPDF { - public static void main(String[] args) { - // Open source PDF document - Document pdfDocument = new Document("Annotated_output.pdf"); - // Loop through all the annotations - for (int Annot_counter = 1; Annot_counter <= pdfDocument.getPages().get_Item(1).getAnnotations().size(); Annot_counter++) { - // Get annotation properties - System.out.printf("Full Name :- " + pdfDocument.getPages().get_Item(Annot_counter).getAnnotations().get_Item(Annot_counter).getFullName()); - System.out.printf("Page Number :- " + pdfDocument.getPages().get_Item(Annot_counter).getAnnotations().get_Item(Annot_counter).getPageIndex()); - System.out.printf("Contents :- " + pdfDocument.getPages().get_Item(Annot_counter).getAnnotations().get_Item(Annot_counter).getContents()); - } - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Annotations/getallannotations/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example getAllAnnotationsFromPageInPDF start"); + getAllAnnotationsFromPageInPDF(dataDir, outputDir); + System.out.println("\r\nExample getAllAnnotationsFromPageInPDF end"); + } + + private static void getAllAnnotationsFromPageInPDF(String dataDir, String outputDir) { + // Open source PDF document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Loop through all the annotations + for (int Annot_counter = 1; Annot_counter <= pdfDocument.getPages().get_Item(1).getAnnotations().size(); Annot_counter++) { + // Get annotation properties + System.out.printf("Full Name :- " + pdfDocument.getPages().get_Item(Annot_counter).getAnnotations().get_Item(Annot_counter).getFullName()); + System.out.printf("Page Number :- " + pdfDocument.getPages().get_Item(Annot_counter).getAnnotations().get_Item(Annot_counter).getPageIndex()); + System.out.printf("Contents :- " + pdfDocument.getPages().get_Item(Annot_counter).getAnnotations().get_Item(Annot_counter).getContents()); + } + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/GetParticularAnnotationFromPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/GetParticularAnnotationFromPDF.java index f1a67a1e..c36ffaaf 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/GetParticularAnnotationFromPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/GetParticularAnnotationFromPDF.java @@ -2,18 +2,34 @@ import com.aspose.pdf.Document; import com.aspose.pdf.TextAnnotation; +import com.aspose.pdf.examples.Utils; public class GetParticularAnnotationFromPDF { - public static void main(String[] args) { - // Open source PDF document - Document pdfDocument = new Document("input.pdf"); - // Get particular annotation - TextAnnotation textAnnotation = (TextAnnotation) pdfDocument.getPages().get_Item(1).getAnnotations().get_Item(1); - // Get annotation properties - System.out.printf("Title :- " + textAnnotation.getTitle()); - System.out.printf("Subject :- " + textAnnotation.getSubject()); - System.out.printf("Contents :- " + textAnnotation.getContents()); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Annotations/getparticularannotation/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example getParticularAnnotationFromPDF start"); + getParticularAnnotationFromPDF(dataDir, outputDir); + System.out.println("\r\nExample getParticularAnnotationFromPDF end"); + } + + private static void getParticularAnnotationFromPDF(String dataDir, String outputDir) { + // Open source PDF document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Get particular annotation + TextAnnotation textAnnotation = (TextAnnotation) pdfDocument.getPages().get_Item(1).getAnnotations().get_Item(1); + // Get annotation properties + System.out.printf("Title :- " + textAnnotation.getTitle()); + System.out.printf("Subject :- " + textAnnotation.getSubject()); + System.out.printf("Contents :- " + textAnnotation.getContents()); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/RedactCertainPageRegionWithRedactionAnnotation.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/RedactCertainPageRegionWithRedactionAnnotation.java index 5ad624b4..95cf3192 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/RedactCertainPageRegionWithRedactionAnnotation.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/RedactCertainPageRegionWithRedactionAnnotation.java @@ -5,35 +5,55 @@ import com.aspose.pdf.HorizontalAlignment; import com.aspose.pdf.Rectangle; import com.aspose.pdf.RedactionAnnotation; +import com.aspose.pdf.examples.Utils; import com.aspose.pdf.facades.PdfAnnotationEditor; public class RedactCertainPageRegionWithRedactionAnnotation { - public static void main(String[] args) { - redactCertainPageRegionWithRedactionAnnotation(); - facadesApproach(); - } - - public static void redactCertainPageRegionWithRedactionAnnotation() { - Document doc = new Document("HelloWorld.pdf"); - Rectangle rect = new Rectangle(200, 500, 300, 600); - RedactionAnnotation annot = new RedactionAnnotation(doc.getPages().get_Item(1), rect); - annot.setFillColor(Color.getBlack()); - annot.setBorderColor(Color.getYellow()); - annot.setColor(Color.getBlue()); - annot.setOverlayText("REDACTED"); - annot.setTextAlignment(HorizontalAlignment.Center); - annot.setRepeat(true); - doc.getPages().get_Item(1).getAnnotations().add(annot); - doc.save("Redaction_out.pdf"); - } - - public static void facadesApproach() { - PdfAnnotationEditor editor = new PdfAnnotationEditor(); - editor.bindPdf("HelloWorld.pdf"); - // redact certain page region - editor.redactArea(1, new Rectangle(100, 100, 20, 70), java.awt.Color.WHITE); - editor.save("Redaction_out.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Annotations/redactCertainPageRegionWithRedactionAnnotation/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example redactCertainPageRegionWithRedactionAnnotation start"); + redactCertainPageRegionWithRedactionAnnotation(dataDir, outputDir); + System.out.println("Example redactCertainPageRegionWithRedactionAnnotation end"); + + System.out.println("============================"); + System.out.println("Example facadesApproach start"); + facadesApproach(dataDir, outputDir); + System.out.println("Example facadesApproach end"); + + } + + public static void redactCertainPageRegionWithRedactionAnnotation(String dataDir, String outputDir) { + //ExStart: RedactCertainPageRegionWithRedactionAnnotation + Document doc = new Document(dataDir + "input.pdf"); + Rectangle rect = new Rectangle(200, 500, 300, 600); + RedactionAnnotation annot = new RedactionAnnotation(doc.getPages().get_Item(1), rect); + annot.setFillColor(Color.getBlack()); + annot.setBorderColor(Color.getYellow()); + annot.setColor(Color.getBlue()); + annot.setFontSize(20); + annot.setOverlayText("REDACTED"); + annot.setTextAlignment(HorizontalAlignment.Center); + annot.setRepeat(true); + doc.getPages().get_Item(1).getAnnotations().add(annot); + doc.save(outputDir + "Redaction_out.pdf"); + //ExEnd: RedactCertainPageRegionWithRedactionAnnotation + } + + public static void facadesApproach(String dataDir, String outputDir) { + PdfAnnotationEditor editor = new PdfAnnotationEditor(); + editor.bindPdf(dataDir + "input.pdf"); + // redact certain page region + editor.redactArea(1, new Rectangle(100, 100, 20, 70), java.awt.Color.WHITE); + editor.save(outputDir + "Redaction_out.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/StrikeOutWordsUsingStrikeOutAnnotation.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/StrikeOutWordsUsingStrikeOutAnnotation.java index 885c344d..97a0393a 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/StrikeOutWordsUsingStrikeOutAnnotation.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Annotations/StrikeOutWordsUsingStrikeOutAnnotation.java @@ -9,44 +9,59 @@ import com.aspose.pdf.TextFragment; import com.aspose.pdf.TextFragmentAbsorber; import com.aspose.pdf.TextFragmentCollection; -import com.aspose.pdf.TextSegment; +import com.aspose.pdf.examples.Utils; public class StrikeOutWordsUsingStrikeOutAnnotation { - public static void main(String[] args) { - // Instantiate Document object - Document document = new Document("test.pdf"); - // Create TextFragment Absorber instance to search particular text - // fragment - TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("Estoque"); - // Iterate through pages of PDF document - for (int i = 1; i <= document.getPages().size(); i++) { - // Get first page of PDF document - Page page = document.getPages().get_Item(i); - page.accept(textFragmentAbsorber); - } - // Create a collection of Absorbed text - TextFragmentCollection textFragmentCollection = textFragmentAbsorber.getTextFragments(); - // Iterate on above collection - for (int j = 1; j <= textFragmentCollection.size(); j++) { - TextFragment textFragment = textFragmentCollection.get_Item(j); - // Get rectangular dimensions of TextFragment object - Rectangle rect = new Rectangle((float) textFragment.getPosition().getXIndent(), (float) textFragment.getPosition().getYIndent(), (float) textFragment.getPosition().getXIndent() + (float) textFragment.getRectangle().getWidth(), (float) textFragment.getPosition().getYIndent() + (float) textFragment.getRectangle().getHeight()); - // Instantiate StrikeOut Annotation instance - StrikeOutAnnotation strikeOut = new StrikeOutAnnotation(textFragment.getPage(), rect); - // Set opacity for annotation - strikeOut.setOpacity(.80); - // Set the border for annotation instance - strikeOut.setBorder(new Border(strikeOut)); - // Set the color of annotation - strikeOut.setColor(Color.getRed()); - // Add annotation to annotations collection of TextFragment - textFragment.getPage().getAnnotations().add(strikeOut); - } - // Save updated document - document.save("StrikeOut.pdf"); + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Annotations/StrikeOutWordsUsingStrikeOutAnnotation/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example strikeOutWordsUsingStrikeOutAnnotation start"); + strikeOutWordsUsingStrikeOutAnnotation(dataDir, outputDir); + System.out.println("Example strikeOutWordsUsingStrikeOutAnnotation end"); + } + + private static void strikeOutWordsUsingStrikeOutAnnotation(String dataDir, String outputDir) { + // Instantiate Document object + Document document = new Document(dataDir + "input.pdf"); + // Create TextFragment Absorber instance to search particular text + // fragment + TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("Sample"); + // Iterate through pages of PDF document + for (int i = 1; i <= document.getPages().size(); i++) { + // Get first page of PDF document + Page page = document.getPages().get_Item(i); + page.accept(textFragmentAbsorber); + } + // Create a collection of Absorbed text + TextFragmentCollection textFragmentCollection = textFragmentAbsorber.getTextFragments(); + // Iterate on above collection + for (int j = 1; j <= textFragmentCollection.size(); j++) { + TextFragment textFragment = textFragmentCollection.get_Item(j); + // Get rectangular dimensions of TextFragment object + Rectangle rect = new Rectangle((float) textFragment.getPosition().getXIndent(), (float) textFragment.getPosition().getYIndent(), (float) textFragment.getPosition().getXIndent() + (float) textFragment.getRectangle().getWidth(), (float) textFragment.getPosition().getYIndent() + (float) textFragment.getRectangle().getHeight()); + // Instantiate StrikeOut Annotation instance + StrikeOutAnnotation strikeOut = new StrikeOutAnnotation(textFragment.getPage(), rect); + // Set opacity for annotation + strikeOut.setOpacity(.80); + // Set the border for annotation instance + strikeOut.setBorder(new Border(strikeOut)); + // Set the color of annotation + strikeOut.setColor(Color.getRed()); + // Add annotation to annotations collection of TextFragment + textFragment.getPage().getAnnotations().add(strikeOut); + } + // Save updated document + document.save(outputDir + "StrikeOut.pdf"); /* - // Info + // extra Info for (TextSegment ts : (Iterable) textFragment.getSegments()) { StrikeOutAnnotation strikeOut = new StrikeOutAnnotation(textFragment.getPage(), ts.getRectangle()); // Create a new section in the Pdf object @@ -57,6 +72,6 @@ public static void main(String[] args) { } // Info */ - } + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/AddAttachmentToPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/AddAttachmentToPDF.java index 297b9096..69e6819e 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/AddAttachmentToPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/AddAttachmentToPDF.java @@ -2,18 +2,35 @@ import com.aspose.pdf.Document; import com.aspose.pdf.FileSpecification; +import com.aspose.pdf.examples.Utils; public class AddAttachmentToPDF { - public static void main(String[] args) { - // Open a document - Document pdfDocument = new Document("input.pdf"); - // Set up a new file to be added as attachment - FileSpecification fileSpecification = new FileSpecification("sample.txt", "Sample text file"); - // Add an attachment to document's attachment collection - pdfDocument.getEmbeddedFiles().add(fileSpecification); - // Save the updated document - pdfDocument.save("output.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Attachments/addattachment/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example addAttachmentToPDF start"); + addAttachmentToPDF(dataDir, outputDir); + System.out.println("Example addAttachmentToPDF end"); + + } + + private static void addAttachmentToPDF(String dataDir, String outputDir) { + // Open a document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Set up a new file to be added as attachment + FileSpecification fileSpecification = new FileSpecification(dataDir + "test.txt", "Sample text file"); + // Add an attachment to document's attachment collection + pdfDocument.getEmbeddedFiles().add(fileSpecification); + // Save the updated document + pdfDocument.save(outputDir + "output.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/DeleteAllAttachmentsFromPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/DeleteAllAttachmentsFromPDF.java index dced1aa7..7c5233f1 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/DeleteAllAttachmentsFromPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/DeleteAllAttachmentsFromPDF.java @@ -1,16 +1,32 @@ package com.aspose.pdf.examples.AsposePdfExamples.Attachments; import com.aspose.pdf.Document; +import com.aspose.pdf.examples.Utils; public class DeleteAllAttachmentsFromPDF { - public static void main(String[] args) { - // Open a document - Document pdfDocument = new Document("input.pdf"); - // Delete all attachments - pdfDocument.getEmbeddedFiles().delete(); - // Save the updated file - pdfDocument.save("output.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Attachments/deleteallattachments/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example deleteAllAttachmentsFromPDF start"); + deleteAllAttachmentsFromPDF(dataDir, outputDir); + System.out.println("Example deleteAllAttachmentsFromPDF end"); + } + + private static void deleteAllAttachmentsFromPDF(String dataDir, String outputDir) { + // Open a document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Delete all attachments + pdfDocument.getEmbeddedFiles().delete(); + // Save the updated file + pdfDocument.save(outputDir + "output.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/DisableFilesCompressionWhenAddingAsEmbeddedResources.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/DisableFilesCompressionWhenAddingAsEmbeddedResources.java index 5143b19f..ed873065 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/DisableFilesCompressionWhenAddingAsEmbeddedResources.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/DisableFilesCompressionWhenAddingAsEmbeddedResources.java @@ -1,31 +1,53 @@ package com.aspose.pdf.examples.AsposePdfExamples.Attachments; -import java.io.ByteArrayInputStream; -import java.io.InputStream; - import com.aspose.pdf.Document; import com.aspose.pdf.FileEncoding; import com.aspose.pdf.FileSpecification; +import com.aspose.pdf.examples.Utils; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; public class DisableFilesCompressionWhenAddingAsEmbeddedResources { - public static void main(String[] args) throws Exception { - // get reference of source/input file - java.nio.file.Path path = java.nio.file.Paths.get("input.pdf"); - // read all the contents from source file into ByteArray - byte[] data = java.nio.file.Files.readAllBytes(path); - // create an instance of Stream object from ByteArray contents - InputStream is = new ByteArrayInputStream(data); - // Instantiate Document object from stream instance - Document pdfDocument = new Document(is); - // setup new file to be added as attachment - FileSpecification fileSpecification = new FileSpecification("test.txt", "Sample text file"); - // Specify Encoding property setting it to FileEncoding.None - fileSpecification.setEncoding(FileEncoding.None); - // add attachment to document's attachment collection - pdfDocument.getEmbeddedFiles().add(fileSpecification); - // save new output - pdfDocument.save("output.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Attachments/addattachment/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example disableFilesCompressionWhenAddingAsEmbeddedResources start"); + try { + disableFilesCompressionWhenAddingAsEmbeddedResources(dataDir, outputDir); + } catch (IOException e) { + e.printStackTrace(); + } + System.out.println("Example disableFilesCompressionWhenAddingAsEmbeddedResources end"); + } + + private static void disableFilesCompressionWhenAddingAsEmbeddedResources(String dataDir, String outputDir) throws IOException { + // get reference of source/input file + java.nio.file.Path path = java.nio.file.Paths.get(dataDir + "input.pdf"); + // read all the contents from source file into ByteArray + byte[] data = java.nio.file.Files.readAllBytes(path); + // create an instance of Stream object from ByteArray contents + InputStream is = new ByteArrayInputStream(data); + // Instantiate Document object from stream instance + Document pdfDocument = new Document(is); + // setup new file to be added as attachment + FileSpecification fileSpecification = new FileSpecification(dataDir + "test.txt", "Sample text file"); + // Specify Encoding property setting it to FileEncoding.None + fileSpecification.setEncoding(FileEncoding.None); + // add attachment to document's attachment collection + pdfDocument.getEmbeddedFiles().add(fileSpecification); + // save new output + pdfDocument.save(outputDir + "outputNoCompression.pdf"); + is.close(); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/GetAttachmentInformation.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/GetAttachmentInformation.java index 7acfe4a4..ad6c2d2d 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/GetAttachmentInformation.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/GetAttachmentInformation.java @@ -2,25 +2,41 @@ import com.aspose.pdf.Document; import com.aspose.pdf.FileSpecification; +import com.aspose.pdf.examples.Utils; public class GetAttachmentInformation { - public static void main(String[] args) { - // Open document - Document pdfDocument = new Document("input.pdf"); - // Get particular embedded file - FileSpecification fileSpecification = pdfDocument.getEmbeddedFiles().get_Item(1); - // Get the file properties - System.out.println("Name:-" + fileSpecification.getName()); - System.out.println("Description:- " + fileSpecification.getDescription()); - System.out.println("Mime Type:-" + fileSpecification.getMIMEType()); - // Check if parameter object contains the parameters - if (fileSpecification.getParams() != null) { - System.out.println("CheckSum:- " + fileSpecification.getParams().getCheckSum()); - System.out.println("Creation Date:- " + fileSpecification.getParams().getCreationDate()); - System.out.println("Modification Date:- " + fileSpecification.getParams().getModDate()); - System.out.println("Size:- " + fileSpecification.getParams().getSize()); - } - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Attachments/getinfoofattachment/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example getAttachmentInformation start"); + getAttachmentInformation(dataDir, outputDir); + System.out.println("Example getAttachmentInformation end"); + } + + private static void getAttachmentInformation(String dataDir, String outputDir) { + // Open document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Get particular embedded file + FileSpecification fileSpecification = pdfDocument.getEmbeddedFiles().get_Item(1); + // Get the file properties + System.out.println("Name:-" + fileSpecification.getName()); + System.out.println("Description:- " + fileSpecification.getDescription()); + System.out.println("Mime Type:-" + fileSpecification.getMIMEType()); + // Check if parameter object contains the parameters + if (fileSpecification.getParams() != null) { + System.out.println("CheckSum:- " + fileSpecification.getParams().getCheckSum()); + System.out.println("Creation Date:- " + fileSpecification.getParams().getCreationDate()); + System.out.println("Modification Date:- " + fileSpecification.getParams().getModDate()); + System.out.println("Size:- " + fileSpecification.getParams().getSize()); + } + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/GetAttachmentsFromPDFDocument.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/GetAttachmentsFromPDFDocument.java index d341b83d..cb34e45b 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/GetAttachmentsFromPDFDocument.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Attachments/GetAttachmentsFromPDFDocument.java @@ -1,43 +1,65 @@ package com.aspose.pdf.examples.AsposePdfExamples.Attachments; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - import com.aspose.pdf.Document; import com.aspose.pdf.FileSpecification; +import com.aspose.pdf.examples.Utils; + +import java.io.IOException; +import java.io.InputStream; public class GetAttachmentsFromPDFDocument { - public static void main(String[] args) { - // Open document - Document pdfDocument = new Document("input.pdf"); - // Get particular embedded file - FileSpecification fileSpecification = pdfDocument.getEmbeddedFiles().get_Item(1); - // Get the file properties - System.out.printf("Name: - " + fileSpecification.getName()); - System.out.printf("\nDescription: - " + fileSpecification.getDescription()); - System.out.printf("\nMime Type: - " + fileSpecification.getMIMEType()); - // Get attachment form PDF file - try { - InputStream input = fileSpecification.getContents(); - File file = new File(fileSpecification.getName()); + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Attachments/getindividualattachment/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example getAttachmentsFromPDFDocument start"); + getAttachmentsFromPDFDocument(dataDir, outputDir); + System.out.println("\r\nExample getAttachmentsFromPDFDocument end"); + } + + private static void getAttachmentsFromPDFDocument(String dataDir, String outputDir) { + // Open document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Get particular embedded file + FileSpecification fileSpecification = pdfDocument.getEmbeddedFiles().get_Item(1); + // Get the file properties + System.out.printf("Name: - " + fileSpecification.getName()); + System.out.printf("\nDescription: - " + fileSpecification.getDescription()); + System.out.printf("\nMime Type: - " + fileSpecification.getMIMEType()); + // Get attachment form PDF file + try { + InputStream input = fileSpecification.getContents(); + System.out.printf("\nSize: - " + input.available()); + + //or extract attachment into path placed in fileSpecification.getName(): + /*File file = new File(fileSpecification.getName()); // Create path for file from pdf file.getParentFile().mkdirs(); // Create and extract file from pdf - java.io.FileOutputStream output = new java.io.FileOutputStream(fileSpecification.getName(), true); - byte[] buffer = new byte[4096]; - int n = 0; - while (-1 != (n = input.read(buffer))) - output.write(buffer, 0, n); - // Close InputStream object - input.close(); - output.close(); - } catch (IOException e) { - e.printStackTrace(); - } - // Close Document object - pdfDocument.dispose(); - } + java.io.FileOutputStream output = new java.io.FileOutputStream(fileSpecification.getName(), true);*/ + + //extract attachment into selectable path: + java.io.FileOutputStream output = new java.io.FileOutputStream(dataDir + "output.txt", true); + + byte[] buffer = new byte[4096]; + int n = 0; + while (-1 != (n = input.read(buffer))) + output.write(buffer, 0, n); + // Close InputStream object + input.close(); + output.close(); + } catch (IOException e) { + e.printStackTrace(); + } + // Close Document object + pdfDocument.dispose(); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/AddBookmarkToPDFDocument.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/AddBookmarkToPDFDocument.java index f8227220..4114f0f8 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/AddBookmarkToPDFDocument.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/AddBookmarkToPDFDocument.java @@ -3,23 +3,39 @@ import com.aspose.pdf.Document; import com.aspose.pdf.GoToAction; import com.aspose.pdf.OutlineItemCollection; +import com.aspose.pdf.examples.Utils; public class AddBookmarkToPDFDocument { - public static void main(String[] args) { - // Open the source PDF document - Document pdfDocument = new Document("input.pdf"); - // Create a bookmark object - OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.getOutlines()); - pdfOutline.setTitle("Test Outline"); - pdfOutline.setItalic(true); - pdfOutline.setBold(true); - // Set the destination page number - pdfOutline.setAction(new GoToAction(pdfDocument.getPages().get_Item(1))); - // Add a bookmark in the document's outline collection. - pdfDocument.getOutlines().add(pdfOutline); - // Save the update document - pdfDocument.save("output.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Bookmarks/addbookmark/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example addBookmarkToPDFDocument start"); + addBookmarkToPDFDocument(dataDir, outputDir); + System.out.println("Example addBookmarkToPDFDocument end"); + } + + private static void addBookmarkToPDFDocument(String dataDir, String outputDir) { + // Open the source PDF document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Create a bookmark object + OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.getOutlines()); + pdfOutline.setTitle("Test Outline"); + pdfOutline.setItalic(true); + pdfOutline.setBold(true); + // Set the destination page number + pdfOutline.setAction(new GoToAction(pdfDocument.getPages().get_Item(1))); + // Add a bookmark in the document's outline collection. + pdfDocument.getOutlines().add(pdfOutline); + // Save the update document + pdfDocument.save(outputDir + "output.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/AddChildBookmarkToPDFDocument.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/AddChildBookmarkToPDFDocument.java index 9ac2850c..db8dcdf8 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/AddChildBookmarkToPDFDocument.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/AddChildBookmarkToPDFDocument.java @@ -3,32 +3,48 @@ import com.aspose.pdf.Document; import com.aspose.pdf.GoToAction; import com.aspose.pdf.OutlineItemCollection; +import com.aspose.pdf.examples.Utils; public class AddChildBookmarkToPDFDocument { - public static void main(String[] args) { - // Open document - Document pdfDocument = new Document("input.pdf"); - // Create a parent bookmark object - OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.getOutlines()); - pdfOutline.setTitle("Parent Outline"); - pdfOutline.setItalic(true); - pdfOutline.setBold(true); - // Set the destination page number - pdfOutline.setDestination(new GoToAction(pdfDocument.getPages().get_Item(2))); - // Create a child bookmark object - OutlineItemCollection pdfChildOutline = new OutlineItemCollection(pdfDocument.getOutlines()); - pdfChildOutline.setTitle("Child Outline"); - pdfChildOutline.setItalic(true); - pdfChildOutline.setBold(true); - // Set the destination page number for child outline - pdfChildOutline.setDestination(new GoToAction(pdfDocument.getPages().get_Item(10))); - // Add child bookmark to parent bookmark's collection - pdfOutline.add(pdfChildOutline); - // Add parent bookmark to the document's outline collection. - pdfDocument.getOutlines().add(pdfOutline); - // Save output - pdfDocument.save("PDF_with_ChildBookmarks.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Bookmarks/addchildbookmark/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example addChildBookmarkToPDFDocument start"); + addChildBookmarkToPDFDocument(dataDir, outputDir); + System.out.println("Example addChildBookmarkToPDFDocument end"); + } + + private static void addChildBookmarkToPDFDocument(String dataDir, String outputDir) { + // Open document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Create a parent bookmark object + OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.getOutlines()); + pdfOutline.setTitle("Parent Outline"); + pdfOutline.setItalic(true); + pdfOutline.setBold(true); + // Set the destination page number + pdfOutline.setDestination(new GoToAction(pdfDocument.getPages().get_Item(2))); + // Create a child bookmark object + OutlineItemCollection pdfChildOutline = new OutlineItemCollection(pdfDocument.getOutlines()); + pdfChildOutline.setTitle("Child Outline"); + pdfChildOutline.setItalic(true); + pdfChildOutline.setBold(true); + // Set the destination page number for child outline + pdfChildOutline.setDestination(new GoToAction(pdfDocument.getPages().get_Item(2))); + // Add child bookmark to parent bookmark's collection + pdfOutline.add(pdfChildOutline); + // Add parent bookmark to the document's outline collection. + pdfDocument.getOutlines().add(pdfOutline); + // Save output + pdfDocument.save(outputDir + "PDF_with_ChildBookmarks.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/BookmarkShouldPointToStartOfPage.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/BookmarkShouldPointToStartOfPage.java index be21129a..bbb803bd 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/BookmarkShouldPointToStartOfPage.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/BookmarkShouldPointToStartOfPage.java @@ -6,49 +6,66 @@ import com.aspose.pdf.FitVExplicitDestination; import com.aspose.pdf.GoToAction; import com.aspose.pdf.OutlineItemCollection; +import com.aspose.pdf.examples.Utils; import com.aspose.pdf.facades.PdfContentEditor; import com.aspose.pdf.facades.ViewerPreference; public class BookmarkShouldPointToStartOfPage { - public static void main(String[] args) { - bookmarkShouldPointToStartOfPage(); - setDestinationWhileCreatingPDF(); - settingViewerPreferences(); - } - - public static void bookmarkShouldPointToStartOfPage() { - String path = "PathToDir"; - Document pdfDocument = new Document(path + "PdfViewerPreference_Changed_out.pdf"); - // Editing existing bookmark - OutlineItemCollection pdfOutline = pdfDocument.getOutlines().get_Item(1); - pdfOutline.setDestination( - // 1st variant new FitVExplicitDestination(pdfDocument.getPages().get_Item(1),0) - // 2nd variant. You can tweak using the bookmark links using different parameters of ExplicitDestinationType - ExplicitDestination.createDestination(pdfDocument.getPages().get_Item(1), ExplicitDestinationType.FitH, new double[] { pdfDocument.getPages().get_Item(1).getMediaBox().getHeight() })); - pdfDocument.save(); - } - - public static void setDestinationWhileCreatingPDF() { - String path = "PathToDir"; - Document pdfDocument = new Document(path + "PdfViewerPreference_Changed_out.pdf"); - OutlineItemCollection pdfOutline_new = new OutlineItemCollection(pdfDocument.getOutlines()); - pdfOutline_new.setTitle("Test bookmark"); - pdfOutline_new.setItalic(true); - pdfOutline_new.setBold(true); - // Set the destination page number and position - pdfOutline_new.setAction(new GoToAction(new FitVExplicitDestination(pdfDocument.getPages().get_Item(2), 0))); - // Add bookmark in the document's outline collection. - pdfDocument.getOutlines().add(pdfOutline_new); - pdfDocument.save(); - } - - public static void settingViewerPreferences() { - String path = "PathToDir"; - PdfContentEditor editor = new PdfContentEditor(); - editor.bindPdf(path + "test.pdf"); - editor.changeViewerPreference(ViewerPreference.PAGE_LAYOUT_SINGLE_PAGE); - editor.save(path + "test_out.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Bookmarks/bookmarkShouldPointToStartOfPage/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example bookmarkShouldPointToStartOfPage start"); + bookmarkShouldPointToStartOfPage(dataDir, outputDir); + System.out.println("Example bookmarkShouldPointToStartOfPage end"); + + System.out.println("============================"); + System.out.println("Example setDestinationWhileCreatingPDF start"); + setDestinationWhileCreatingPDF(dataDir, outputDir); + System.out.println("Example setDestinationWhileCreatingPDF end"); + + System.out.println("============================"); + System.out.println("Example settingViewerPreferences start"); + settingViewerPreferences(dataDir, outputDir); + System.out.println("Example settingViewerPreferences end"); + } + + public static void bookmarkShouldPointToStartOfPage(String dataDir, String outputDir) { + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Editing existing bookmark + OutlineItemCollection pdfOutline = pdfDocument.getOutlines().get_Item(1); + pdfOutline.setDestination( + // 1st variant new FitVExplicitDestination(pdfDocument.getPages().get_Item(1),0) + // 2nd variant. You can tweak using the bookmark links using different parameters of ExplicitDestinationType + ExplicitDestination.createDestination(pdfDocument.getPages().get_Item(1), ExplicitDestinationType.FitH, pdfDocument.getPages().get_Item(1).getMediaBox().getHeight())); + pdfDocument.save(outputDir + "bookmarkShouldPointToStartOfPage.pdf"); + } + + public static void setDestinationWhileCreatingPDF(String dataDir, String outputDir) { + Document pdfDocument = new Document(dataDir + "input.pdf"); + OutlineItemCollection pdfOutline_new = new OutlineItemCollection(pdfDocument.getOutlines()); + pdfOutline_new.setTitle("Test bookmark"); + pdfOutline_new.setItalic(true); + pdfOutline_new.setBold(true); + // Set the destination page number and position + pdfOutline_new.setAction(new GoToAction(new FitVExplicitDestination(pdfDocument.getPages().get_Item(2), 0))); + // Add bookmark in the document's outline collection. + pdfDocument.getOutlines().add(pdfOutline_new); + pdfDocument.save(outputDir + "setDestinationWhileCreatingPDF.pdf"); + } + + public static void settingViewerPreferences(String dataDir, String outputDir) { + PdfContentEditor editor = new PdfContentEditor(); + editor.bindPdf(dataDir + "input.pdf"); + editor.changeViewerPreference(ViewerPreference.PAGE_LAYOUT_SINGLE_PAGE); + editor.save(outputDir + "settingViewerPreferences.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/DeleteBookmarksFromPDFDocument.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/DeleteBookmarksFromPDFDocument.java index 1b195c9d..5c2703e7 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/DeleteBookmarksFromPDFDocument.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/DeleteBookmarksFromPDFDocument.java @@ -1,30 +1,46 @@ package com.aspose.pdf.examples.AsposePdfExamples.Bookmarks; import com.aspose.pdf.Document; +import com.aspose.pdf.examples.Utils; public class DeleteBookmarksFromPDFDocument { - public static void main(String[] args) { - deleteBookmarksFromPDFDocument(); - deleteParticularBookmark(); - } - - public static void deleteBookmarksFromPDFDocument() { - // Open a document - Document pdfDocument = new Document("input.pdf"); - // Delete all bookmarks - pdfDocument.getOutlines().delete(); - // Save output - pdfDocument.save("NoBookmarks.pdf"); - } - - public static void deleteParticularBookmark() { - // Open a document - Document pdfDocument = new Document("source.pdf"); - // Delete a specific bookmarks - pdfDocument.getOutlines().delete("Child Outline"); - // Save output - pdfDocument.save("noBookmark.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Bookmarks/deleteallbookmarks/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example deleteBookmarksFromPDFDocument start"); + deleteBookmarksFromPDFDocument(dataDir, outputDir); + System.out.println("Example deleteBookmarksFromPDFDocument end"); + + System.out.println("============================"); + System.out.println("Example deleteParticularBookmark start"); + deleteParticularBookmark(dataDir, outputDir); + System.out.println("Example deleteParticularBookmark end"); + } + + public static void deleteBookmarksFromPDFDocument(String dataDir, String outputDir) { + // Open a document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Delete all bookmarks + pdfDocument.getOutlines().delete(); + // Save output + pdfDocument.save(outputDir + "deleteBookmarksFromPDFDocument.pdf"); + } + + public static void deleteParticularBookmark(String dataDir, String outputDir) { + // Open a document + Document pdfDocument = new Document(dataDir + "source.pdf"); + // Delete a specific bookmarks + pdfDocument.getOutlines().delete("Child Outline"); + // Save output + pdfDocument.save(outputDir + "deleteParticularBookmark.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/ExpandedBookmarksWhenViewingDocument.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/ExpandedBookmarksWhenViewingDocument.java index 0318fdda..66e9ef66 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/ExpandedBookmarksWhenViewingDocument.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/ExpandedBookmarksWhenViewingDocument.java @@ -2,24 +2,40 @@ import com.aspose.pdf.Document; import com.aspose.pdf.PageMode; +import com.aspose.pdf.examples.Utils; public class ExpandedBookmarksWhenViewingDocument { - public static void main(String[] args) { - // create Document instance - Document doc = new Document("BookmarkIssue_8_1_0.pdf"); - // set page view mode i.e. show thumbnails, full-screen, show attachment - // panel - doc.setPageMode(PageMode.UseOutlines); - // print total count of Bookmarks in PDF file - System.out.println(doc.getOutlines().size()); - // traverse through each Outline item in outlines collection of PDF file - for (int counter = 1; counter <= doc.getOutlines().size(); counter++) { - // set open status for outline item - doc.getOutlines().get_Item(counter).setOpen(true); - } - // save the PDF file - doc.save("Bookmarks_Expanded.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Bookmarks/expandedBookmarksWhenViewingDocument/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example expandedBookmarksWhenViewingDocument start"); + expandedBookmarksWhenViewingDocument(dataDir, outputDir); + System.out.println("Example expandedBookmarksWhenViewingDocument end"); + } + + private static void expandedBookmarksWhenViewingDocument(String dataDir, String outputDir) { + // create Document instance + Document doc = new Document(dataDir + "input.pdf"); + // set page view mode i.e. show thumbnails, full-screen, show attachment + // panel + doc.setPageMode(PageMode.UseOutlines); + // print total count of Bookmarks in PDF file + System.out.println(doc.getOutlines().size()); + // traverse through each Outline item in outlines collection of PDF file + for (int counter = 1; counter <= doc.getOutlines().size(); counter++) { + // set open status for outline item + doc.getOutlines().get_Item(counter).setOpen(true); + } + // save the PDF file + doc.save(outputDir + "Bookmarks_Expanded.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/GetBookmarksFromPDFDocument.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/GetBookmarksFromPDFDocument.java index c1c8e675..3fde7129 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/GetBookmarksFromPDFDocument.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/GetBookmarksFromPDFDocument.java @@ -2,44 +2,60 @@ import com.aspose.pdf.Document; import com.aspose.pdf.OutlineItemCollection; +import com.aspose.pdf.examples.Utils; import com.aspose.pdf.facades.Bookmark; import com.aspose.pdf.facades.Bookmarks; import com.aspose.pdf.facades.PdfBookmarkEditor; public class GetBookmarksFromPDFDocument { - public static void main(String[] args) { - gettingBookmarks(); - gettingBookmarksPageNumber(); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Bookmarks/getchildbookmarks/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); - public static void gettingBookmarks() { - // Open document - Document pdfDocument = new Document("input.pdf"); - // Loop through all the bookmarks - for (OutlineItemCollection outlineItem : (Iterable) pdfDocument.getOutlines()) { - System.out.println("Title :- " + outlineItem.getTitle()); - System.out.println("Is Italic :- " + outlineItem.getItalic()); - System.out.println("Is Bold :- " + outlineItem.getBold()); - System.out.println("Color :- " + outlineItem.getColor()); - } - } + System.out.println("============================"); + System.out.println("Example gettingBookmarks start"); + gettingBookmarks(dataDir, outputDir); + System.out.println("Example gettingBookmarks end"); - public static void gettingBookmarksPageNumber() { - // Create PdfBookmarkEditor - PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor(); - // Open PDF file - bookmarkEditor.bindPdf("input.pdf"); - // Extract bookmarks - Bookmarks bookmarks = bookmarkEditor.extractBookmarks(); - for (Bookmark bookmark : (Iterable) bookmarks) { - String strLevelSeprator = ""; - for (int i = 1; i < bookmark.getLevel(); i++) { - strLevelSeprator += "---- "; - } - System.out.println("Title :- " + strLevelSeprator + bookmark.getTitle()); - System.out.println("Page Number :- " + strLevelSeprator + bookmark.getPageNumber()); - System.out.println("Page Action :- " + strLevelSeprator + bookmark.getAction()); - } - } + System.out.println("============================"); + System.out.println("Example gettingBookmarksPageNumber start"); + gettingBookmarksPageNumber(dataDir, outputDir); + System.out.println("Example gettingBookmarksPageNumber end"); + } + + public static void gettingBookmarks(String dataDir, String outputDir) { + // Open document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Loop through all the bookmarks + for (OutlineItemCollection outlineItem : pdfDocument.getOutlines()) { + System.out.println("Title :- " + outlineItem.getTitle()); + System.out.println("Is Italic :- " + outlineItem.getItalic()); + System.out.println("Is Bold :- " + outlineItem.getBold()); + System.out.println("Color :- " + outlineItem.getColor()); + } + } + + public static void gettingBookmarksPageNumber(String dataDir, String outputDir) { + // Create PdfBookmarkEditor + PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor(); + // Open PDF file + bookmarkEditor.bindPdf(dataDir + "input.pdf"); + // Extract bookmarks + Bookmarks bookmarks = bookmarkEditor.extractBookmarks(); + for (Bookmark bookmark : bookmarks) { + String strLevelSeprator = ""; + for (int i = 1; i < bookmark.getLevel(); i++) { + strLevelSeprator += "---- "; + } + System.out.println("Title :- " + strLevelSeprator + bookmark.getTitle()); + System.out.println("Page Number :- " + strLevelSeprator + bookmark.getPageNumber()); + System.out.println("Page Action :- " + strLevelSeprator + bookmark.getAction()); + } + } } \ No newline at end of file diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/UpdateBookmarksInPDFDocument.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/UpdateBookmarksInPDFDocument.java index 3b9bc213..9c79b551 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/UpdateBookmarksInPDFDocument.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Bookmarks/UpdateBookmarksInPDFDocument.java @@ -3,18 +3,34 @@ import com.aspose.pdf.Document; import com.aspose.pdf.GoToAction; import com.aspose.pdf.OutlineItemCollection; +import com.aspose.pdf.examples.Utils; public class UpdateBookmarksInPDFDocument { - public static void main(String[] args) { - // Open document - Document pdfDocument = new Document("BookmarkInheritZoom.pdf"); - // Get a bookmark object - OutlineItemCollection pdfOutline = pdfDocument.getOutlines().get_Item(1); - // Set the target page as 10 - pdfOutline.setDestination(new GoToAction(pdfDocument.getPages().get_Item(2))); - // Save output - pdfDocument.save("Bookmarkupdated_output.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Bookmarks/updatebookmarks/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example updateBookmarksInPDFDocument start"); + updateBookmarksInPDFDocument(dataDir, outputDir); + System.out.println("Example updateBookmarksInPDFDocument end"); + } + + private static void updateBookmarksInPDFDocument(String dataDir, String outputDir) { + // Open document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Get a bookmark object + OutlineItemCollection pdfOutline = pdfDocument.getOutlines().get_Item(1); + // Set the target page as 10 + pdfOutline.setDestination(new GoToAction(pdfDocument.getPages().get_Item(1))); + // Save output + pdfDocument.save(outputDir + "Bookmarkupdated_output.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertEPUBFileToPDFFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertEPUBFileToPDFFormat.java index 19f21cf5..8004cc79 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertEPUBFileToPDFFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertEPUBFileToPDFFormat.java @@ -2,16 +2,32 @@ import com.aspose.pdf.Document; import com.aspose.pdf.EpubLoadOptions; +import com.aspose.pdf.examples.Utils; public class ConvertEPUBFileToPDFFormat { - public static void main(String[] args) { - // Instantiate LoadOption object using EPUB load option - EpubLoadOptions optionsepub = new EpubLoadOptions(); - // Create Document object - Document docepub = new Document("wasteland.epub", optionsepub); - // Save the resultant PDF document - docepub.save("wasteland.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/epubtopdf/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example convertEPUBFileToPDFFormat start"); + convertEPUBFileToPDFFormat(dataDir, outputDir); + System.out.println("Example convertEPUBFileToPDFFormat end"); + } + + private static void convertEPUBFileToPDFFormat(String dataDir, String outputDir) { + // Instantiate LoadOption object using EPUB load option + EpubLoadOptions optionsEpub = new EpubLoadOptions(); + // Create Document object + Document docEpub = new Document(dataDir + "Sample.epub", optionsEpub); + // Save the resultant PDF document + docEpub.save(outputDir + "wasteland.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertHTMLToPDFFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertHTMLToPDFFormat.java index f5a28655..39c33a13 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertHTMLToPDFFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertHTMLToPDFFormat.java @@ -3,43 +3,91 @@ import com.aspose.pdf.Document; import com.aspose.pdf.HtmlLoadOptions; import com.aspose.pdf.LoadOptions; +import com.aspose.pdf.examples.Utils; public class ConvertHTMLToPDFFormat { - public static void main(String[] args) { - settingToNotPullDownRemoteResourcesDuringConversion(); - convertHTMLFileToPDF(); - } - - public static void convertHTMLFileToPDF() { - // Specify the The base path/url for the html file which serves as images database - String basePath = "pdftest"; - HtmlLoadOptions htmloptions = new HtmlLoadOptions(basePath); - // Load HTML file - Document doc = new Document(basePath + "EmailDemo_updated.html", htmloptions); - // Save HTML file - doc.save("Web+URL_output.pdf"); - } - - public static void settingToNotPullDownRemoteResourcesDuringConversion() { - HtmlLoadOptions options = new HtmlLoadOptions(); - options.CustomLoaderOfExternalResources = new LoadOptions.ResourceLoadingStrategy() { - public LoadOptions.ResourceLoadingResult invoke(String resourceURI) { - // Creating clear template resource for replacing: - LoadOptions.ResourceLoadingResult res = new LoadOptions.ResourceLoadingResult(new byte[] {}); - // Return empty byte array in case i.imgur.com server - if (resourceURI.contains("i.imgur.com")) { - return res; - } else { - // Process resources with default resource loader - res.LoadingCancelled = true; - return res; - } - } - }; - // Do conversion - Document pdfDocument = new Document("in.html", options); - pdfDocument.save("out.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/htmltopdf/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + System.out.println("============================"); + System.out.println("Example renderHTMLwithSVGData start"); + renderHTMLwithSVGData(dataDir, outputDir); + System.out.println("Example renderHTMLwithSVGData end"); + + System.out.println("============================"); + System.out.println("Example convertHTMLFileToPDF start"); + convertHTMLFileToPDF(dataDir, outputDir); + System.out.println("Example convertHTMLFileToPDF end"); + + System.out.println("============================"); + System.out.println("Example renderContentToSamePage start"); + renderContentToSamePage(dataDir, outputDir); + System.out.println("Example renderContentToSamePage end"); + + //settingToNotPullDownRemoteResourcesDuringConversion(); + } + + public static void convertHTMLFileToPDF(String dataDir, String outputDir) { + // Specify the The base path/url for the html file which serves as images database + HtmlLoadOptions htmloptions = new HtmlLoadOptions(dataDir); + // Load HTML file + Document doc = new Document(dataDir + "EmailDemo_updated.html", htmloptions); + // Save HTML file + doc.save(outputDir + "Web+URL_output.pdf"); + } + + public static void renderContentToSamePage(String dataDir, String outputDir) { + // Initialize HTMLLoadSave Options + HtmlLoadOptions options = new HtmlLoadOptions(); + // Set Render to single page property + options.setRenderToSinglePage(true); + // Load document + Document doc = new Document(dataDir + "HTMLToPDF.html", options); + // Save + doc.save(outputDir + "RenderContentToSamePage_out.pdf"); + // ExEnd:RenderContentToSamePage + } + + public static void renderHTMLwithSVGData(String dataDir, String outputDir) { + // Set input file path + String inFile = dataDir + "HTMLSVG.html"; + // Set output file path + String outFile = outputDir + "RenderHTMLwithSVGData_out.pdf"; + // Initialize HtmlLoadOptions + HtmlLoadOptions options = new HtmlLoadOptions(inFile); + // Initialize Document object + Document pdfDocument = new Document(inFile, options); + // save + pdfDocument.save(outFile); + // ExEnd:RenderHTMLwithSVGData + } + + + public static void settingToNotPullDownRemoteResourcesDuringConversion() { + HtmlLoadOptions options = new HtmlLoadOptions(); + options.setCustomLoaderOfExternalResources(new LoadOptions.ResourceLoadingStrategy() { + public LoadOptions.ResourceLoadingResult invoke(String resourceURI) { + // Creating clear template resource for replacing: + LoadOptions.ResourceLoadingResult res = new LoadOptions.ResourceLoadingResult(new byte[]{}); + // Return empty byte array in case i.imgur.com server + if (resourceURI.contains("i.imgur.com")) { + return res; + } else { + // Process resources with default resource loader + res.setLoadingCancelled(true); + return res; + } + } + }); + // Do conversion + Document pdfDocument = new Document("in.html", options); + pdfDocument.save("out/out.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPCLToPDFFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPCLToPDFFormat.java index 8508abc0..17904e5b 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPCLToPDFFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPCLToPDFFormat.java @@ -2,15 +2,30 @@ import com.aspose.pdf.Document; import com.aspose.pdf.PclLoadOptions; +import com.aspose.pdf.examples.Utils; public class ConvertPCLToPDFFormat { - public static void main(String[] args) { - // Instantiate LoadOption object using PCL load option - PclLoadOptions loadoptions = new PclLoadOptions(); - // Create Document object - Document doc = new Document("Document.pcl", loadoptions); - // Save the resultant PDF document - doc.save("test1-converted.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pcltopdf/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + System.out.println("============================"); + System.out.println("Example convertPCLToPDFFormat start"); + convertPCLToPDFFormat(dataDir, outputDir); + System.out.println("Example convertPCLToPDFFormat end"); + } + + private static void convertPCLToPDFFormat(String dataDir, String outputDir) { + // Instantiate LoadOption object using PCL load option + PclLoadOptions loadoptions = new PclLoadOptions(); + // Create Document object + Document doc = new Document(dataDir + "test.pcl", loadoptions); + // Save the resultant PDF document + doc.save(outputDir + "test1-converted.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFFileIntoXPSFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFFileIntoXPSFormat.java index f7a7259b..a69acb57 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFFileIntoXPSFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFFileIntoXPSFormat.java @@ -2,16 +2,50 @@ import com.aspose.pdf.Document; import com.aspose.pdf.XpsSaveOptions; +import com.aspose.pdf.examples.Utils; public class ConvertPDFFileIntoXPSFormat { - public static void main(String[] args) { - // Load PDF document - Document pdfDocument = new Document("input.pdf"); - // Instantiate XPS Save options - XpsSaveOptions saveOptions = new XpsSaveOptions(); - // Save the XPS document - pdfDocument.save("output.xps", saveOptions); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxps/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + System.out.println("============================"); + System.out.println("Example KeepingTextSelectableInConvertedXPS start"); + KeepingTextSelectableInConvertedXPS(dataDir, outputDir); + System.out.println("Example KeepingTextSelectableInConvertedXPS end"); + + System.out.println("============================"); + System.out.println("Example ConvertPDFtoXPS start"); + ConvertPDFtoXPS(dataDir, outputDir); + System.out.println("Example ConvertPDFtoXPS end"); + + } + + public static void ConvertPDFtoXPS(String dataDir, String outputDir) { + // Load PDF document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Instantiate XPS Save options + XpsSaveOptions saveOptions = new XpsSaveOptions(); + // Save the XPS document + pdfDocument.save(outputDir + "ConvertPDFtoXPS_out.xps", saveOptions); + //ExEnd: ConvertPDFToXPS + } + + public static void KeepingTextSelectableInConvertedXPS(String dataDir, String outputDir) { + // load PDF document + Document doc = new Document(dataDir + "Input.pdf"); + // instantiate an object of SvgSaveOptions + XpsSaveOptions saveOptions = new XpsSaveOptions(); + // Allow text selectable in output XPS + saveOptions.setSaveTransparentTexts(true); + // save the output in XPS files + doc.save(outputDir + "KeepingTextSelectableInConvertedXPS_out.xps", saveOptions); + //ExEnd: KeepingTextSelectableInConvertedXPS + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToDOCOrDOCXFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToDOCOrDOCXFormat.java index 0ef94591..8caf192c 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToDOCOrDOCXFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToDOCOrDOCXFormat.java @@ -6,49 +6,67 @@ import com.aspose.pdf.examples.Utils; public class ConvertPDFToDOCOrDOCXFormat { - - private static final String dataDir = Utils.getSharedDataDir(ConvertPDFToDOCOrDOCXFormat.class) + "DocumentConversion/"; - - public static void main(String[] args) { - //savingToDoc(); - savingToDOCX(); - //usingTheDocSaveOptionsClass(); - } - - public static void savingToDoc() { - // Open the source PDF document - Document pdfDocument = new Document(dataDir + "SampleDataTable.pdf"); - // Save the file into Microsoft document format - pdfDocument.save(dataDir + "TableHeightIssue.doc", SaveFormat.Doc); - } - - public static void savingToDOCX() { - // Load source PDF file - Document doc = new Document(dataDir + "input.pdf"); - // Instantiate Doc SaveOptions instance - DocSaveOptions saveOptions = new DocSaveOptions(); - // Set output file format as DOCX - saveOptions.setFormat(DocSaveOptions.DocFormat.DocX); - // Save resultant DOCX file - doc.save(dataDir + "resultant.docx", saveOptions); - } - - public static void usingTheDocSaveOptionsClass() { - // Open a document - // Path of input PDF document - String filePath = dataDir + "source.pdf"; - // Instantiate the Document object - Document document = new Document(filePath); - // Create DocSaveOptions object - DocSaveOptions saveOption = new DocSaveOptions(); - // Set the recognition mode as Flow - saveOption.setMode(DocSaveOptions.RecognitionMode.Flow); - // Set the Horizontal proximity as 2.5 - saveOption.setRelativeHorizontalProximity(2.5f); - // Enable the value to recognize bullets during conversion process - saveOption.setRecognizeBullets(true); - // Save the resultant DOC file - document.save(dataDir + "Resultant.doc", saveOption); - } + + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftodoc/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example savingToDoc start"); + savingToDoc(dataDir, outputDir); + System.out.println("Example savingToDoc end"); + + System.out.println("============================"); + System.out.println("Example savingToDOCX start"); + savingToDOCX(dataDir, outputDir); + System.out.println("Example savingToDOCX end"); + + System.out.println("============================"); + System.out.println("Example usingTheDocSaveOptionsClass start"); + usingTheDocSaveOptionsClass(dataDir, outputDir); + System.out.println("Example usingTheDocSaveOptionsClass end"); + } + + public static void savingToDoc(String dataDir, String outputDir) { + // Open the source PDF document + Document pdfDocument = new Document(dataDir + "input2.pdf"); + // Save the file into Microsoft document format + pdfDocument.save(outputDir + "TableHeightIssue.doc", SaveFormat.Doc); + } + + public static void savingToDOCX(String dataDir, String outputDir) { + // Load source PDF file + Document doc = new Document(dataDir + "input.pdf"); + // Instantiate Doc SaveOptions instance + DocSaveOptions saveOptions = new DocSaveOptions(); + // Set output file format as DOCX + saveOptions.setFormat(DocSaveOptions.DocFormat.DocX); + // Save resultant DOCX file + doc.save(outputDir + "savingToDOCX.docx", saveOptions); + } + + public static void usingTheDocSaveOptionsClass(String dataDir, String outputDir) { + // Open a document + // Path of input PDF document + String filePath = dataDir + "source.pdf"; + // Instantiate the Document object + Document document = new Document(filePath); + // Create DocSaveOptions object + DocSaveOptions saveOption = new DocSaveOptions(); + // Set the recognition mode as Flow + saveOption.setMode(DocSaveOptions.RecognitionMode.Flow); + // Set the Horizontal proximity as 2.5 + saveOption.setRelativeHorizontalProximity(2.5f); + // Enable the value to recognize bullets during conversion process + saveOption.setRecognizeBullets(true); + // Save the resultant DOC file + document.save(outputDir + "usingTheDocSaveOptionsClass.doc", saveOption); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToEPUBFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToEPUBFormat.java index 3d26b453..563c1405 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToEPUBFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToEPUBFormat.java @@ -2,18 +2,34 @@ import com.aspose.pdf.Document; import com.aspose.pdf.EpubSaveOptions; +import com.aspose.pdf.examples.Utils; public class ConvertPDFToEPUBFormat { - public static void main(String[] args) { - // Load PDF document - Document pdfDocument = new Document("BlueBackground.pdf"); - // Instantiate EPUB Save options - EpubSaveOptions options = new EpubSaveOptions(); - // Specify the layout for contents - options.ContentRecognitionMode = EpubSaveOptions.RecognitionMode.Flow; - // Save the EPUB document - pdfDocument.save("BlueBackground.epub", options); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftoepub/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example convertPDFToEPUBFormat start"); + convertPDFToEPUBFormat(dataDir, outputDir); + System.out.println("Example convertPDFToEPUBFormat end"); + } + + private static void convertPDFToEPUBFormat(String dataDir, String outputDir) { + // Load PDF document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Instantiate EPUB Save options + EpubSaveOptions options = new EpubSaveOptions(); + // Specify the layout for contents + options.setContentRecognitionMode(EpubSaveOptions.RecognitionMode.Flow); + // Save the EPUB document + pdfDocument.save(outputDir + "convertPDFToEPUBFormat.epub", options); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToExcelWorkbook.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToExcelWorkbook.java index 9bfae49c..d4f02687 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToExcelWorkbook.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToExcelWorkbook.java @@ -2,16 +2,32 @@ import com.aspose.pdf.Document; import com.aspose.pdf.ExcelSaveOptions; +import com.aspose.pdf.examples.Utils; public class ConvertPDFToExcelWorkbook { - public static void main(String[] args) { - // Load PDF document - Document pdfDocument = new Document("LegacyProduct_test.pdf"); - // Instantiate ExcelSave Option object - ExcelSaveOptions excelsave = new ExcelSaveOptions(); - // Save the output to XLS format - pdfDocument.save("ConvertedFile.xls", excelsave); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxls/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example convertPDFToExcelWorkbook start"); + convertPDFToExcelWorkbook(dataDir, outputDir); + System.out.println("Example convertPDFToExcelWorkbook end"); + } + + private static void convertPDFToExcelWorkbook(String dataDir, String outputDir) { + // Load PDF document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Instantiate ExcelSave Option object + ExcelSaveOptions excelsave = new ExcelSaveOptions(); + // Save the output to XLS format + pdfDocument.save(outputDir + "ConvertedFile.xls", excelsave); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToMobiXML.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToMobiXML.java new file mode 100644 index 00000000..768c7fbf --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToMobiXML.java @@ -0,0 +1,31 @@ +package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; + +import com.aspose.pdf.Document; +import com.aspose.pdf.SaveFormat; +import com.aspose.pdf.examples.Utils; + +public class ConvertPDFToMobiXML { + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftomobixml/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example convertPDFToMobiXML start"); + convertPDFToMobiXML(dataDir, outputDir); + System.out.println("Example convertPDFToMobiXML end"); + } + + private static void convertPDFToMobiXML(String dataDir, String outputDir) { + // instantiate Document object + Document doc = new Document(dataDir + "input.pdf"); + // save the output in XML format + doc.save(outputDir + "resultant.xml", SaveFormat.MobiXml); + } + +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToPDFAFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToPDFAFormat.java index d456de0b..7094f4ab 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToPDFAFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToPDFAFormat.java @@ -4,71 +4,99 @@ import com.aspose.pdf.Document; import com.aspose.pdf.FileSpecification; import com.aspose.pdf.PdfFormat; +import com.aspose.pdf.examples.Utils; public class ConvertPDFToPDFAFormat { - public static void main(String[] args) { - pdfTopdfA1bConversion(); - pdfTopdfA3bConversion(); - pdfTopdfA3aConversion(); - pdfTopdfA2aConversion(); - createPDFA3AndAttachXMLFile(); - } - - public static void pdfTopdfA1bConversion() { - String myDir = "pathToDir"; - // Open document - Document pdfDocument = new Document(myDir + "input.pdf"); - // Convert to PDF/A compliant document - pdfDocument.validate("Validation_log.xml", PdfFormat.PDF_A_1B); - pdfDocument.convert("Conversion_log.xml", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete); - // Save updated document - pdfDocument.save(myDir + "output.pdf"); - } - - public static void pdfTopdfA3bConversion() { - String myDir = "pathToDir"; - // Open document - Document doc = new Document(myDir + "input.pdf"); - // Convert to PDF/A3 compliant document - doc.convert("file.log", PdfFormat.PDF_A_3B, ConvertErrorAction.Delete); - // Save resultant document - doc.save(myDir + "output.pdf"); - } - - public static void pdfTopdfA3aConversion() { - String myDir = "pathToDir"; - // Open document - Document doc = new Document(myDir + "input.pdf"); - // Convert to PDF/A3 compliant document - doc.convert("file.log", PdfFormat.PDF_A_3A, ConvertErrorAction.Delete); - // Save resultant document - doc.save(myDir + "output.pdf"); - } - - public static void pdfTopdfA2aConversion() { - String myDir = "pathToDir"; - // Open document - Document doc = new Document(myDir + "input.pdf"); - // Convert to PDF/A2_a compliant document - doc.convert("file.log", PdfFormat.PDF_A_2A, ConvertErrorAction.Delete); - // Save resultant document - doc.save(myDir + "output.pdf"); - } - - public static void createPDFA3AndAttachXMLFile() { - String myDir = "pathToDir"; - // instantiate Document instance - Document doc = new Document(); - // add page to PDF file - doc.getPages().add(); - // load XML file - FileSpecification fileSpecification = new FileSpecification(myDir + "attachment.xml", "Sample xml file"); - // Add attachment to document's attachment collection - doc.getEmbeddedFiles().add(fileSpecification); - // perform PDF/A_3a conversion - doc.convert(myDir + "log.xml", PdfFormat.PDF_A_3A/* or PDF_A_3B */, ConvertErrorAction.Delete); - // save final PDF file - doc.save(myDir + "attached_PDFA_3A.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftopdfa/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example pdfTopdfA1bConversion start"); + pdfTopdfA1bConversion(dataDir, outputDir); + System.out.println("Example pdfTopdfA1bConversion end"); + + System.out.println("============================"); + System.out.println("Example pdfTopdfA3bConversion start"); + pdfTopdfA3bConversion(dataDir, outputDir); + System.out.println("Example pdfTopdfA3bConversion end"); + + System.out.println("============================"); + System.out.println("Example pdfTopdfA3aConversion start"); + pdfTopdfA3aConversion(dataDir, outputDir); + System.out.println("Example pdfTopdfA3aConversion end"); + + System.out.println("============================"); + System.out.println("Example pdfTopdfA2aConversion start"); + pdfTopdfA2aConversion(dataDir, outputDir); + System.out.println("Example pdfTopdfA2aConversion end"); + + System.out.println("============================"); + System.out.println("Example createPDFA3AndAttachXMLFile start"); + createPDFA3AndAttachXMLFile(dataDir, outputDir); + System.out.println("Example createPDFA3AndAttachXMLFile end"); + } + + public static void pdfTopdfA1bConversion(String dataDir, String outputDir) { + + // Open document + Document pdfDocument = new Document(dataDir + "input.pdf"); + // Convert to PDF/A compliant document + pdfDocument.validate(outputDir + "pdfTopdfA1bConversion_Validation_log.xml", PdfFormat.PDF_A_1B); + pdfDocument.convert(outputDir + "pdfTopdfA1bConversion_Conversion_log.xml", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete); + // Save updated document + pdfDocument.save(outputDir + "pdfTopdfA1bConversion.pdf"); + } + + public static void pdfTopdfA3bConversion(String dataDir, String outputDir) { + + // Open document + Document doc = new Document(dataDir + "input.pdf"); + // Convert to PDF/A3 compliant document + doc.convert(outputDir + "pdfTopdfA3bConversion.log", PdfFormat.PDF_A_3B, ConvertErrorAction.Delete); + // Save resultant document + doc.save(outputDir + "pdfTopdfA3bConversion.pdf"); + } + + public static void pdfTopdfA3aConversion(String dataDir, String outputDir) { + + // Open document + Document doc = new Document(dataDir + "input.pdf"); + // Convert to PDF/A3 compliant document + doc.convert(outputDir + "pdfTopdfA3aConversion.log", PdfFormat.PDF_A_3A, ConvertErrorAction.Delete); + // Save resultant document + doc.save(outputDir + "pdfTopdfA3aConversion.pdf"); + } + + public static void pdfTopdfA2aConversion(String dataDir, String outputDir) { + + // Open document + Document doc = new Document(dataDir + "input.pdf"); + // Convert to PDF/A2_a compliant document + doc.convert(outputDir + "pdfTopdfA2aConversion.log", PdfFormat.PDF_A_2A, ConvertErrorAction.Delete); + // Save resultant document + doc.save(outputDir + "pdfTopdfA2aConversion.pdf"); + } + + public static void createPDFA3AndAttachXMLFile(String dataDir, String outputDir) { + + // instantiate Document instance + Document doc = new Document(); + // add page to PDF file + doc.getPages().add(); + // load XML file + FileSpecification fileSpecification = new FileSpecification(dataDir + "attachment.xml", "Sample xml file"); + // Add attachment to document's attachment collection + doc.getEmbeddedFiles().add(fileSpecification); + // perform PDF/A_3a conversion + doc.convert(outputDir + "createPDFA3AndAttachXMLFile.xml", PdfFormat.PDF_A_3A/* or PDF_A_3B */, ConvertErrorAction.Delete); + // save final PDF file + doc.save(outputDir + "createPDFA3AndAttachXMLFile.pdf"); + } } \ No newline at end of file diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToPPTX.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToPPTX.java index fc02ee74..cad269f2 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToPPTX.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToPPTX.java @@ -2,16 +2,32 @@ import com.aspose.pdf.Document; import com.aspose.pdf.PptxSaveOptions; +import com.aspose.pdf.examples.Utils; public class ConvertPDFToPPTX { - public static void main(String[] args) { - // Load PDF document - Document doc = new Document("input.pdf"); - // Instantiate PptxSaveOptions instance - PptxSaveOptions pptx_save = new PptxSaveOptions(); - // Save the output in PPTX format - doc.save("output.pptx", pptx_save); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftopptx/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example convertPDFToPPTX start"); + convertPDFToPPTX(dataDir, outputDir); + System.out.println("Example convertPDFToPPTX end"); + } + + private static void convertPDFToPPTX(String dataDir, String outputDir) { + // Load PDF document + Document doc = new Document(dataDir + "input.pdf"); + // Instantiate PptxSaveOptions instance + PptxSaveOptions pptx_save = new PptxSaveOptions(); + // Save the output in PPTX format + doc.save(outputDir + "output.pptx", pptx_save); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToSVGFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToSVGFormat.java index de2a520a..11ca3e43 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToSVGFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToSVGFormat.java @@ -2,20 +2,35 @@ import com.aspose.pdf.Document; import com.aspose.pdf.SvgSaveOptions; +import com.aspose.pdf.examples.Utils; public class ConvertPDFToSVGFormat { - public static void main(String[] args) { - // load PDF document - Document doc = new Document("Input.pdf"); - // instantiate an object of SvgSaveOptions - SvgSaveOptions saveOptions = new SvgSaveOptions(); - // do not compress SVG image to Zip archive - saveOptions.CompressOutputToZipArchive = false; - // resultant file name - String outFileName = "Output.svg"; - // save the output in SVG files - doc.save(outFileName, saveOptions); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftosvg/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + System.out.println("============================"); + System.out.println("Example convertPDFToSVGFormat start"); + convertPDFToSVGFormat(dataDir, outputDir); + System.out.println("Example convertPDFToSVGFormat end"); + } + + private static void convertPDFToSVGFormat(String dataDir, String outputDir) { + // load PDF document + Document doc = new Document(dataDir + "Input.pdf"); + // instantiate an object of SvgSaveOptions + SvgSaveOptions saveOptions = new SvgSaveOptions(); + // do not compress SVG image to Zip archive + saveOptions.setCompressOutputToZipArchive(false); + // resultant file name + String outFileName = outputDir + "Output.svg"; + // save the output in SVG files + doc.save(outFileName, saveOptions); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToXML.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToXML.java index b84938ae..29ebf52a 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToXML.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFToXML.java @@ -2,14 +2,31 @@ import com.aspose.pdf.Document; import com.aspose.pdf.SaveFormat; +import com.aspose.pdf.examples.Utils; public class ConvertPDFToXML { - public static void main(String[] args) { - // instantiate Document object - Document doc = new Document("input.pdf"); - // save the output in XML format - doc.save("resultant.xml", SaveFormat.Xml); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxml/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example convertPDFToXML start"); + convertPDFToXML(dataDir, outputDir); + System.out.println("Example convertPDFToXML end"); + } + + private static void convertPDFToXML(String dataDir, String outputDir) { + // instantiate Document object + Document doc = new Document(dataDir + "input.pdf"); + + // save the output in XML format + doc.save(outputDir + "resultant.xml", SaveFormat.Xml); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFtoXLSX.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFtoXLSX.java new file mode 100644 index 00000000..76eb0cdb --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPDFtoXLSX.java @@ -0,0 +1,33 @@ +package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; + +import com.aspose.pdf.Document; +import com.aspose.pdf.ExcelSaveOptions; +import com.aspose.pdf.examples.Utils; + +public class ConvertPDFtoXLSX { + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxlsx/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example convertPDFtoXLSX start"); + convertPDFtoXLSX(dataDir, outputDir); + System.out.println("Example convertPDFtoXLSX end"); + } + + private static void convertPDFtoXLSX(String dataDir, String outputDir) { + Document doc = new Document(dataDir + "input.pdf"); + // Initialize ExcelSaveOptions + ExcelSaveOptions options = new ExcelSaveOptions(); + // Set output format + options.setFormat(ExcelSaveOptions.ExcelFormat.XLSX); + // Save output file + doc.save(outputDir + "ouput.xlsx", options); + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPostScriptFileToPDFFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPostScriptFileToPDFFormat.java index 322a2dc3..43777798 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPostScriptFileToPDFFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertPostScriptFileToPDFFormat.java @@ -1,16 +1,31 @@ package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; import com.aspose.pdf.Document; -import com.aspose.pdf.EpubLoadOptions; +import com.aspose.pdf.examples.Utils; public class ConvertPostScriptFileToPDFFormat { - public static void main(String[] args) { - // Create a new instance of PsLoadOptions - com.aspose.pdf.LoadOptions options = new com.aspose.pdf.PsLoadOptions(); - // Open .ps document with created load options - Document pdfDocument = new Document("input.ps", options); - // Save document - pdfDocument.save("PSToPDF_out.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pstopdf/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example convertPostScriptFileToPDFFormat start"); + convertPostScriptFileToPDFFormat(dataDir, outputDir); + System.out.println("Example convertPostScriptFileToPDFFormat end"); + } + + private static void convertPostScriptFileToPDFFormat(String dataDir, String outputDir) { + // Create a new instance of PsLoadOptions + com.aspose.pdf.LoadOptions options = new com.aspose.pdf.PsLoadOptions(); + // Open .ps document with created load options + Document pdfDocument = new Document(dataDir + "input.ps", options); + // Save document + pdfDocument.save(dataDir + "/outPSToPDF_out.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertSVGFileToPDFFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertSVGFileToPDFFormat.java index d0f17c48..8da72879 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertSVGFileToPDFFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertSVGFileToPDFFormat.java @@ -3,17 +3,33 @@ import com.aspose.pdf.Document; import com.aspose.pdf.LoadOptions; import com.aspose.pdf.SvgLoadOptions; +import com.aspose.pdf.examples.Utils; public class ConvertSVGFileToPDFFormat { - public static void main(String[] args) { - String file = "Document.svg"; - // Instantiate LoadOption object using SVG load option - LoadOptions options = new SvgLoadOptions(); - // Create Document object - Document document = new Document(file, options); - // Save the resultant PDF document - document.save("Result.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/svgtopdf/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example convertSVGFileToPDFFormat start"); + convertSVGFileToPDFFormat(dataDir, outputDir); + System.out.println("Example convertSVGFileToPDFFormat end"); + } + + private static void convertSVGFileToPDFFormat(String dataDir, String outputDir) { + String file = dataDir + "Example.svg"; + // Instantiate LoadOption object using SVG load option + LoadOptions options = new SvgLoadOptions(); + // Create Document object + Document document = new Document(file, options); + // Save the resultant PDF document + document.save(outputDir + "Result.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertTextFileToPDFFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertTextFileToPDFFormat.java index dea7c98d..89964ea9 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertTextFileToPDFFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertTextFileToPDFFormat.java @@ -1,55 +1,75 @@ package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; -import java.io.FileNotFoundException; - import com.aspose.pdf.Document; import com.aspose.pdf.Page; import com.aspose.pdf.TextFragment; +import com.aspose.pdf.examples.Utils; + +import java.io.FileNotFoundException; public class ConvertTextFileToPDFFormat { + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/texttopdf/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example convertTextFileToPDFFormat start"); + convertTextFileToPDFFormat(dataDir, outputDir); + System.out.println("Example convertTextFileToPDFFormat end"); + } - public static void main(String[] args) throws FileNotFoundException { - // Source PDF file - java.io.File file = new java.io.File("AsposeDocument.txt"); - java.io.FileInputStream fis = new java.io.FileInputStream(file); - // System.out.println(file.exists() + "!!"); - // InputStream in = resource.openStream(); - java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream(); - byte[] buf = new byte[1024]; - try { - for (int readNum; (readNum = fis.read(buf)) != -1;) { - bos.write(buf, 0, readNum); // no doubt here is 0 - // Writes len bytes from the specified byte array starting at offset off to this byte array output stream. - System.out.println("read " + readNum + " bytes,"); - } - } catch (java.io.IOException ex) { - } - byte[] bytes = bos.toByteArray(); - java.io.ByteArrayInputStream srcStream = new java.io.ByteArrayInputStream(bytes); - java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(srcStream)); - String line; - StringBuilder builder = new StringBuilder(5024); - try { - while ((line = reader.readLine()) != null) { - builder.append(line); - } - } catch (java.io.IOException e) { - } finally { - try { - reader.close(); - } catch (java.io.IOException e) { - } - // Instantiate a Document object by calling its empty constructor - Document doc = new Document(); - // Add a new page in Pages collection of Document - Page page = doc.getPages().add(); - // Create an instance of TextFragmet and pass the text from reader object to its constructor as argument - TextFragment text = new TextFragment(builder.toString()); - // text.TextState.Font = FontRepository.FindFont("Arial Unicode MS"); - // Add a new text paragraph in paragraphs collection and pass the TextFragment object - page.getParagraphs().add(text); - // Save resultant PDF file - doc.save("TExtFile_TexttoPDF.pdf"); - } - } + public static void convertTextFileToPDFFormat(String dataDir, String outputDir) { + try { + // Source PDF file + java.io.File file = new java.io.File(dataDir + "test.txt"); + java.io.FileInputStream fis = new java.io.FileInputStream(file); + // System.out.println(file.exists() + "!!"); + // InputStream in = resource.openStream(); + java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream(); + byte[] buf = new byte[1024]; + try { + for (int readNum; (readNum = fis.read(buf)) != -1; ) { + bos.write(buf, 0, readNum); // no doubt here is 0 + // Writes len bytes from the specified byte array starting at offset off to this byte array output stream. + System.out.println("read " + readNum + " bytes,"); + } + } catch (java.io.IOException ex) { + } + byte[] bytes = bos.toByteArray(); + java.io.ByteArrayInputStream srcStream = new java.io.ByteArrayInputStream(bytes); + java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(srcStream)); + String line; + StringBuilder builder = new StringBuilder(5024); + try { + while ((line = reader.readLine()) != null) { + builder.append(line); + builder.append("\r\n"); + } + } catch (java.io.IOException e) { + } finally { + try { + reader.close(); + } catch (java.io.IOException e) { + } + // Instantiate a Document object by calling its empty constructor + Document doc = new Document(); + // Add a new page in Pages collection of Document + Page page = doc.getPages().add(); + // Create an instance of TextFragmet and pass the text from reader object to its constructor as argument + TextFragment text = new TextFragment(builder.toString()); + // text.TextState.Font = FontRepository.FindFont("Arial Unicode MS"); + // Add a new text paragraph in paragraphs collection and pass the TextFragment object + page.getParagraphs().add(text); + // Save resultant PDF file + doc.save(outputDir + "TExtFile_TexttoPDF.pdf"); + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXMLFileToPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXMLFileToPDF.java index a608545a..47bafff8 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXMLFileToPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXMLFileToPDF.java @@ -3,24 +3,40 @@ import com.aspose.pdf.Document; import com.aspose.pdf.Page; import com.aspose.pdf.TextSegment; +import com.aspose.pdf.examples.Utils; public class ConvertXMLFileToPDF { - public static void main(String[] args) { - // instantiate Document object - Document doc = new Document(); - // bind source XML file - doc.bindXml("Source.xml"); - // get reference of page object from XML - Page page = (Page) doc.getObjectById("mainSection"); - // get reference of first TextSegment with ID boldHtml - TextSegment segment = (TextSegment) doc.getObjectById("boldHtml"); - // get reference of second TextSegment with ID strongHtml - segment = (TextSegment) doc.getObjectById("strongHtml"); - // update TextSegement text - segment.setText("TestSegment"); - // save resultant PDF file - doc.save("Resultant.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/xmltopdf/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example convertXMLFileToPDF start"); + convertXMLFileToPDF(dataDir, outputDir); + System.out.println("Example convertXMLFileToPDF end"); + } + + public static void convertXMLFileToPDF(String dataDir, String outputDir) { + // instantiate Document object + Document doc = new Document(); + // bind source XML file + doc.bindXml(dataDir + "Source.xml"); + // get reference of page object from XML + Page page = (Page) doc.getObjectById("mainSection"); + // get reference of first TextSegment with ID boldHtml + TextSegment segment = (TextSegment) doc.getObjectById("boldHtml"); + // get reference of second TextSegment with ID strongHtml + segment = (TextSegment) doc.getObjectById("strongHtml"); + // update TextSegement text + segment.setText("TestSegment"); + // save resultant PDF file + doc.save(outputDir + "Resultant.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXPSFileToPDFFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXPSFileToPDFFormat.java index 6b0249a7..d96842a9 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXPSFileToPDFFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXPSFileToPDFFormat.java @@ -3,16 +3,32 @@ import com.aspose.pdf.Document; import com.aspose.pdf.LoadOptions; import com.aspose.pdf.XpsLoadOptions; +import com.aspose.pdf.examples.Utils; public class ConvertXPSFileToPDFFormat { - public static void main(String[] args) { - // Instantiate LoadOption object using XPS load option - LoadOptions options = new XpsLoadOptions(); - // Create document object - Document document = new Document("printoutput.xps", options); - // Save the resultant PDF document - document.save("resultant.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/xpstopdf/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example ConvertXPSFileToPDFFormat start"); + ConvertXPSFileToPDFFormat(dataDir, outputDir); + System.out.println("Example ConvertXPSFileToPDFFormat end"); + } + + public static void ConvertXPSFileToPDFFormat(String dataDir, String outputDir) { + // Instantiate LoadOption object using XPS load option + LoadOptions options = new XpsLoadOptions(); + // Create document object + Document document = new Document(dataDir + "test.xps", options); + // Save the resultant PDF document + document.save(outputDir + "resultant.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXSLFOToPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXSLFOToPDF.java index 4e132a38..49be58ae 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXSLFOToPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ConvertXSLFOToPDF.java @@ -2,16 +2,32 @@ import com.aspose.pdf.Document; import com.aspose.pdf.XslFoLoadOptions; +import com.aspose.pdf.examples.Utils; public class ConvertXSLFOToPDF { - public static void main(String[] args) { - // Instantiate XSLFO load options instance - XslFoLoadOptions xslLoadOptions = new XslFoLoadOptions(); - // Open document - Document doc = new Document("samplefile.fo", xslLoadOptions); - // Save PDF document - doc.save("XSL_FO.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/xslfotopdf/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example ConvertXSLFOToPDF start"); + ConvertXSLFOToPDF(dataDir, outputDir); + System.out.println("Example ConvertXSLFOToPDF end"); + } + + public static void ConvertXSLFOToPDF(String dataDir, String outputDir) { + // Instantiate XSLFO load options instance + XslFoLoadOptions xslLoadOptions = new XslFoLoadOptions(); + // Open document + Document doc = new Document(dataDir + "test.fo", xslLoadOptions); + // Save PDF document + doc.save(outputDir + "XSL_FO.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/CreatePDFwithTaggedImage.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/CreatePDFwithTaggedImage.java new file mode 100644 index 00000000..acfd3ba8 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/CreatePDFwithTaggedImage.java @@ -0,0 +1,45 @@ +package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.IllustrationElement; + +public class CreatePDFwithTaggedImage { + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdfGenerator/CreatePDFwithTaggedImage/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example createPDFwithTaggedImage start"); + createPDFwithTaggedImage(dataDir, outputDir); + System.out.println("Example createPDFwithTaggedImage end"); + } + + public static void createPDFwithTaggedImage(String dataDir, String outputDir) { + // ExStart:CreatePDFWithTaggedImage + Document document = new Document(); + ITaggedContent taggedContent = document.getTaggedContent(); + + taggedContent.setTitle(dataDir + "CreatePDFwithTaggedImage"); + taggedContent.setLanguage("en-US"); + + IllustrationElement figure1 = taggedContent.createFigureElement(); + taggedContent.getRootElement().appendChild(figure1); + figure1.setAlternativeText("Aspose Logo"); + figure1.setTitle("Image 1"); + figure1.setTag("Fig"); + // Add image with resolution 300 DPI (by default) + figure1.setImage(dataDir + "aspose-logo.jpg"); + // Save PDF Document + document.save(outputDir + "PDFwithTaggedImage.pdf"); + // ExEnd:CreatePDFWithTaggedImage + } + +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/CreatePDFwithTaggedText.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/CreatePDFwithTaggedText.java new file mode 100644 index 00000000..d9373764 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/CreatePDFwithTaggedText.java @@ -0,0 +1,60 @@ +package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.HeaderElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.ParagraphElement; + + +public class CreatePDFwithTaggedText { + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdfGenerator/CreatePDFwithTaggedText/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example createPDFwithTaggedText start"); + createPDFwithTaggedText(dataDir, outputDir); + System.out.println("Example createPDFwithTaggedText end"); + } + + public static void createPDFwithTaggedText(String dataDir, String outputDir) { + // Create Pdf Document + Document document = new Document(); + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Create Text Block-Level Structure Elements + HeaderElement headerElement = taggedContent.createHeaderElement(); + headerElement.setActualText("Heading 1"); + ParagraphElement paragraphElement1 = taggedContent.createParagraphElement(); + paragraphElement1.setActualText("test1"); + ParagraphElement paragraphElement2 = taggedContent.createParagraphElement(); + paragraphElement2.setActualText("test 2"); + ParagraphElement paragraphElement3 = taggedContent.createParagraphElement(); + paragraphElement3.setActualText("test 3"); + ParagraphElement paragraphElement4 = taggedContent.createParagraphElement(); + paragraphElement4.setActualText("test 4"); + ParagraphElement paragraphElement5 = taggedContent.createParagraphElement(); + paragraphElement5.setActualText("test 5"); + ParagraphElement paragraphElement6 = taggedContent.createParagraphElement(); + paragraphElement6.setActualText("test 6"); + ParagraphElement paragraphElement7 = taggedContent.createParagraphElement(); + paragraphElement7.setActualText("test 7"); + + // Save PDF Document + document.save(outputDir + "PDFwithTaggedText.pdf"); + // ExEnd:CreatePDFwithTaggedImage + } + +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/DefaultFontWhenSpecificFontMissing.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/DefaultFontWhenSpecificFontMissing.java deleted file mode 100644 index d757c113..00000000 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/DefaultFontWhenSpecificFontMissing.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; - -import com.aspose.pdf.Document; -import com.aspose.pdf.Font; -import com.aspose.pdf.FontRepository; -import com.aspose.pdf.HtmlSaveOptions; -import com.aspose.pdf.text.CustomFontSubstitutionBase; - -public class DefaultFontWhenSpecificFontMissing { - - public static void main(String[] args) { - String myDir = "PathToDir"; - Document pdf = new Document(myDir + "Redis.pdf"); - // configure font substitution - CustomSubst1 subst1 = new CustomSubst1(); - FontRepository.getSubstitutions().add(subst1); - // Configure notifier to console - pdf.FontSubstitution.add(new Document.FontSubstitutionHandler() { - public void invoke(Font font, Font newFont) { - // print substituted FontNames into console - System.out.println("Warning: Font " + font.getFontName() + " was substituted with another font -> " + newFont.getFontName()); - } - }); - HtmlSaveOptions htmlSaveOps = new HtmlSaveOptions(); - pdf.save(myDir + "Redis_1150_substitutedWithMSGothic_release.html", htmlSaveOps); - } - /** - * The class to implement font substitution - */ - private static class CustomSubst1 extends CustomFontSubstitutionBase { - public boolean trySubstitute(OriginalFontSpecification originalFontSpecification, /* out */com.aspose.pdf.Font[] substitutionFont) { - // 1. substitute Arial font with TimesNewRoman font - // if - // ("Arial".equals(originalFontSpecification.getOriginalFontName())) - // { - // substitutionFont[0] = - // FontRepository.findFont("TimesNewRoman"); - // return true; - // } - // else - // return super.trySubstitute(originalFontSpecification, /*out*/ - // substitutionFont); - // 2. or substitute all the fonts with the MSGothic font - substitutionFont[0] = FontRepository.findFont("MSGothic"); - return true; - } - } -} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/EscapeHTMLTagsAndSpecialCharacters.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/EscapeHTMLTagsAndSpecialCharacters.java index 4f4d933d..723be613 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/EscapeHTMLTagsAndSpecialCharacters.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/EscapeHTMLTagsAndSpecialCharacters.java @@ -2,22 +2,38 @@ import com.aspose.pdf.Document; import com.aspose.pdf.Page; +import com.aspose.pdf.examples.Utils; public class EscapeHTMLTagsAndSpecialCharacters { - public static void main(String[] args) { - // input HTML - String HTML = "< b >BIG TEXT< /b>< ol>SOME VALUE< /ol>< li >item1< /li >< li >item2 & 3 < /li >< /ol >"; - // CSS for input HTML contents - String CSS = " *{font-weight : normal !important ; margin :0 !important ; padding:0 !important ; list-style-type:none !important}"; - // instantiate Document instance - Document doc = new Document(); - // add page to pages collection of Document object - Page page = doc.getPages().add(); - // add HTMLFragment to paragraphs collection of PDF page - page.getParagraphs().add(new com.aspose.pdf.HtmlFragment(CSS + HTML)); - // save resultant PDF file - doc.save("output.pdf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdfGenerator/escapeHTMLTagsAndSpecialCharacters/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example escapeHTMLTagsAndSpecialCharacters start"); + escapeHTMLTagsAndSpecialCharacters(dataDir, outputDir); + System.out.println("Example escapeHTMLTagsAndSpecialCharacters end"); + } + + public static void escapeHTMLTagsAndSpecialCharacters(String dataDir, String outputDir) { + // input HTML + String HTML = "< b >BIG TEXT< /b>< ol>SOME VALUE< /ol>< li >item1< /li >< li >item2 & 3 < /li >< /ol >"; + // CSS for input HTML contents + String CSS = " *{font-weight : normal !important ; margin :0 !important ; padding:0 !important ; list-style-type:none !important}"; + // instantiate Document instance + Document doc = new Document(); + // add page to pages collection of Document object + Page page = doc.getPages().add(); + // add HTMLFragment to paragraphs collection of PDF page + page.getParagraphs().add(new com.aspose.pdf.HtmlFragment(CSS + HTML)); + // save resultant PDF file + doc.save(outputDir + "escapeHTMLTagsAndSpecialCharacters.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/GetWarningForFontSubstitution.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/GetWarningForFontSubstitution.java deleted file mode 100644 index 516a718b..00000000 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/GetWarningForFontSubstitution.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; - -import java.util.HashMap; -import java.util.Map; - -import com.aspose.pdf.Document; -import com.aspose.pdf.Font; -import com.aspose.pdf.HtmlSaveOptions; - -public class GetWarningForFontSubstitution { - - public static void main(String[] args) { - // Load existing PDf file - Document pdfDoc = new Document("input.pdf"); - final Map names = new HashMap(); - pdfDoc.FontSubstitution.add(new Document.FontSubstitutionHandler() { - public void invoke(Font font, Font newFont) { - // add substituted FontNames into map. - names.put(font.getFontName(), newFont.getFontName()); - // or print the message into console - System.out.println("Warning: Font " + font.getFontName() + " was substituted with another font -> " + newFont.getFontName()); - } - }); - // instantiate HTMLSave option to save output in HTML - HtmlSaveOptions htmlSaveOps = new HtmlSaveOptions(); - // save resultant file - pdfDoc.save("output.html", htmlSaveOps); - } - -} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToEMF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToEMF.java index 0795e277..5045391d 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToEMF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToEMF.java @@ -3,16 +3,32 @@ import com.aspose.pdf.Document; import com.aspose.pdf.devices.EmfDevice; import com.aspose.pdf.devices.Resolution; +import com.aspose.pdf.examples.Utils; public class PDFToEMF { - public static void main(String[] args) { - // instantiate EmfDevice object - EmfDevice device = new EmfDevice(new Resolution(96)); - // load existing PDF file - Document doc = new Document("Input.pdf"); - // save first page of PDF file as Emf image - device.process(doc.getPages().get_Item(1), "output.emf"); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftoemf/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example pdftoemf start"); + pdftoemf(dataDir, outputDir); + System.out.println("Example pdftoemf end"); + } + + public static void pdftoemf(String dataDir, String outputDir) { + // instantiate EmfDevice object + EmfDevice device = new EmfDevice(new Resolution(96)); + // load existing PDF file + Document doc = new Document(dataDir + "Input.pdf"); + // save first page of PDF file as Emf image + device.process(doc.getPages().get_Item(1), outputDir + "output.emf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLAllResourceEmbeddedInSingleResultantStream.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLAllResourceEmbeddedInSingleResultantStream.java index 35706fa0..a49ecdb1 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLAllResourceEmbeddedInSingleResultantStream.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLAllResourceEmbeddedInSingleResultantStream.java @@ -1,52 +1,68 @@ package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; - import com.aspose.pdf.Document; import com.aspose.pdf.HtmlSaveOptions; import com.aspose.pdf.LettersPositioningMethods; +import com.aspose.pdf.examples.Utils; + +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; public class PDFToHTMLAllResourceEmbeddedInSingleResultantStream { - public static void main(String[] args) { - Document doc = new Document("Input.pdf"); - // tune conversion parameters - HtmlSaveOptions newOptions = new HtmlSaveOptions(); - newOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground; - newOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats; - newOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml; - newOptions.LettersPositioningMethod = LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss; - newOptions.setSplitIntoPages(false);// force write HTMLs of all pages into one output document - newOptions.CustomHtmlSavingStrategy = new HtmlSaveOptions.HtmlPageMarkupSavingStrategy() { - public void invoke(HtmlSaveOptions.HtmlPageMarkupSavingInfo htmlSavingInfo) { - try { - // TODO Auto-generated method stub - byte[] resultHtmlAsBytes = new byte[(int) htmlSavingInfo.ContentStream.available()]; - htmlSavingInfo.ContentStream.read(resultHtmlAsBytes, 0, resultHtmlAsBytes.length); - // here You can use any writable stream, file stream is taken just as example - FileOutputStream fos; - try { - fos = new FileOutputStream("PDFtoHTML.html"); - fos.write(resultHtmlAsBytes); - fos.close(); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } catch (IOException ex) { - Logger.getLogger(PDFToHTMLAllResourceEmbeddedInSingleResultantStream.class.getName()).log(Level.SEVERE, null, ex); - } - } - }; - // we can use some non-existing file name all real saving will be done in CustomerHtmlSavingStrategy - String outHtmlFile = "SomeUnexistingFile.html"; - doc.save(outHtmlFile, newOptions); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example allResourceEmbeddedInSingleResultantStream start"); + allResourceEmbeddedInSingleResultantStream(dataDir, outputDir); + System.out.println("Example allResourceEmbeddedInSingleResultantStream end"); + } + + public static void allResourceEmbeddedInSingleResultantStream(String dataDir, String outputDir) { + Document doc = new Document(dataDir + "input.pdf"); + // tune conversion parameters + HtmlSaveOptions newOptions = new HtmlSaveOptions(); + newOptions.setRasterImagesSavingMode(HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground); + newOptions.setFontSavingMode(HtmlSaveOptions.FontSavingModes.SaveInAllFormats); + newOptions.setPartsEmbeddingMode(HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml); + newOptions.setLettersPositioningMethod(LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss); + newOptions.setSplitIntoPages(false);// force write HTMLs of all pages into one output document + newOptions.setCustomHtmlSavingStrategy(new HtmlSaveOptions.HtmlPageMarkupSavingStrategy() { + public void invoke(HtmlSaveOptions.HtmlPageMarkupSavingInfo htmlSavingInfo) { + try { + // TODO Auto-generated method stub + byte[] resultHtmlAsBytes = new byte[(int) htmlSavingInfo.getContentStream().available()]; + htmlSavingInfo.getContentStream().read(resultHtmlAsBytes, 0, resultHtmlAsBytes.length); + // here You can use any writable stream, file stream is taken just as example + FileOutputStream fos; + try { + fos = new FileOutputStream(outputDir + "allResourceEmbeddedInSingleResultantStream.html"); + fos.write(resultHtmlAsBytes); + fos.close(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } catch (IOException ex) { + Logger.getLogger(PDFToHTMLAllResourceEmbeddedInSingleResultantStream.class.getName()).log(Level.SEVERE, null, ex); + } + } + }); + // we can use some non-existing file name all real saving will be done in CustomerHtmlSavingStrategy + String outHtmlFile = outputDir + "ThisFileWillNotAppearOnDisk.html"; + doc.save(outHtmlFile, newOptions); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLAvoidSavingImagesInSVGFormat.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLAvoidSavingImagesInSVGFormat.java index bf6f2688..dd265ead 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLAvoidSavingImagesInSVGFormat.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLAvoidSavingImagesInSVGFormat.java @@ -2,20 +2,36 @@ import com.aspose.pdf.Document; import com.aspose.pdf.HtmlSaveOptions; +import com.aspose.pdf.examples.Utils; public class PDFToHTMLAvoidSavingImagesInSVGFormat { - public static void main(String[] args) { - // Open source PDF document - Document pdfDocument = new Document("input.pdf"); - String outHtmlFile = "resultant.html"; - // Create HtmlSaveOption with tested feature - HtmlSaveOptions saveOptions = new HtmlSaveOptions(); - saveOptions.setFixedLayout(true); - // save images in PNG format instead of SVG - saveOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground; - // save output as HTML - pdfDocument.save(outHtmlFile, saveOptions); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example avoidSavingImagesInSVGFormat start"); + avoidSavingImagesInSVGFormat(dataDir, outputDir); + System.out.println("Example avoidSavingImagesInSVGFormat end"); + } + + public static void avoidSavingImagesInSVGFormat(String dataDir, String outputDir) { + // Open source PDF document + Document pdfDocument = new Document(dataDir + "input.pdf"); + String outHtmlFile = outputDir + "avoidSavingImagesInSVGFormat.html"; + // Create HtmlSaveOption with tested feature + HtmlSaveOptions saveOptions = new HtmlSaveOptions(); + saveOptions.setFixedLayout(true); + // save images in PNG format instead of SVG + saveOptions.setRasterImagesSavingMode(HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground); + // save output as HTML + pdfDocument.save(outHtmlFile, saveOptions); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLGetWarningForFontSubstitution.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLGetWarningForFontSubstitution.java new file mode 100644 index 00000000..de8777ba --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLGetWarningForFontSubstitution.java @@ -0,0 +1,46 @@ +package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; + +import com.aspose.pdf.Document; +import com.aspose.pdf.Font; +import com.aspose.pdf.HtmlSaveOptions; +import com.aspose.pdf.examples.Utils; + +import java.util.HashMap; +import java.util.Map; + +public class PDFToHTMLGetWarningForFontSubstitution { + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example getWarningForFontSubstitution start"); + getWarningForFontSubstitution(dataDir, outputDir); + System.out.println("Example getWarningForFontSubstitution end"); + } + + public static void getWarningForFontSubstitution(String dataDir, String outputDir) { + // Load existing PDf file + Document pdfDoc = new Document(dataDir + "input1.pdf"); + final Map names = new HashMap(); + pdfDoc.FontSubstitution.add(new Document.FontSubstitutionHandler() { + public void invoke(Font font, Font newFont) { + // add substituted FontNames into map. + names.put(font.getFontName(), newFont.getFontName()); + // or print the message into console + System.out.println("Warning: Font " + font.getFontName() + " was substituted with another font -> " + newFont.getFontName()); + } + }); + // instantiate HTMLSave option to save output in HTML + HtmlSaveOptions htmlSaveOps = new HtmlSaveOptions(); + // save resultant file + pdfDoc.save(outputDir + "getWarningForFontSubstitution.html", htmlSaveOps); + } + +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLRenderPDFDataLayersAsSeparateHTMLLayerElement.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLRenderPDFDataLayersAsSeparateHTMLLayerElement.java index 8142a80f..2a9bb34d 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLRenderPDFDataLayersAsSeparateHTMLLayerElement.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLRenderPDFDataLayersAsSeparateHTMLLayerElement.java @@ -6,17 +6,30 @@ public class PDFToHTMLRenderPDFDataLayersAsSeparateHTMLLayerElement { - public static void main(String[] args) { - // The path to the resource directory. - String dataDir = Utils.getSharedDataDir(PDFToHTMLRenderPDFDataLayersAsSeparateHTMLLayerElement.class) + "PDFToHTML/"; - // Open the PDF file - Document doc = new Document(dataDir + "input.pdf"); - // Instantiate HTML SaveOptions object - HtmlSaveOptions htmlOptions = new HtmlSaveOptions(); - // Specify to render PDF document layers separately in output HTML - htmlOptions.setConvertMarkedContentToLayers(true); - // Save the document - doc.save(dataDir + "output.html", htmlOptions); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example renderPDFDataLayersAsSeparateHTMLLayerElement start"); + renderPDFDataLayersAsSeparateHTMLLayerElement(dataDir, outputDir); + System.out.println("Example renderPDFDataLayersAsSeparateHTMLLayerElement end"); + } + + public static void renderPDFDataLayersAsSeparateHTMLLayerElement(String dataDir, String outputDir) { + // Open the PDF file + Document doc = new Document(dataDir + "input2.pdf"); + // Instantiate HTML SaveOptions object + HtmlSaveOptions htmlOptions = new HtmlSaveOptions(); + // Specify to render PDF document layers separately in output HTML + htmlOptions.setConvertMarkedContentToLayers(true); + // Save the document + doc.save(outputDir + "renderPDFDataLayersAsSeparateHTMLLayerElement.html", htmlOptions); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSingleHTMLWithAllResourcesEmbedded.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSingleHTMLWithAllResourcesEmbedded.java index 5daeb702..97174731 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSingleHTMLWithAllResourcesEmbedded.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSingleHTMLWithAllResourcesEmbedded.java @@ -3,24 +3,40 @@ import com.aspose.pdf.Document; import com.aspose.pdf.HtmlSaveOptions; import com.aspose.pdf.LettersPositioningMethods; +import com.aspose.pdf.examples.Utils; public class PDFToHTMLSingleHTMLWithAllResourcesEmbedded { - public static void main(String[] args) { - // Load source PDF file - Document doc = new Document("input.pdf"); - // Instantiate HTML Save options object - HtmlSaveOptions newOptions = new HtmlSaveOptions(); - // Enable option to embed all resources inside the HTML - newOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml; - // This is just optimization for IE and can be omitted - newOptions.LettersPositioningMethod = LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss; - newOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground; - newOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats; - // Output file path - String outHtmlFile = "Single_output.html"; - // Save the output file - doc.save(outHtmlFile, newOptions); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example singleHTMLWithAllResourcesEmbedded start"); + singleHTMLWithAllResourcesEmbedded(dataDir, outputDir); + System.out.println("Example singleHTMLWithAllResourcesEmbedded end"); + } + + public static void singleHTMLWithAllResourcesEmbedded(String dataDir, String outputDir) { + // Load source PDF file + Document doc = new Document(dataDir + "input.pdf"); + // Instantiate HTML Save options object + HtmlSaveOptions newOptions = new HtmlSaveOptions(); + // Enable option to embed all resources inside the HTML + newOptions.setPartsEmbeddingMode(HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml); + // This is just optimization for IE and can be omitted + newOptions.setLettersPositioningMethod(LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss); + newOptions.setRasterImagesSavingMode(HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground); + newOptions.setFontSavingMode(HtmlSaveOptions.FontSavingModes.SaveInAllFormats); + // Output file path + String outHtmlFile = outputDir + "Single_output.html"; + // Save the output file + doc.save(outHtmlFile, newOptions); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSpecifyImagesFolder.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSpecifyImagesFolder.java index be38cbb7..f5f0a6e9 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSpecifyImagesFolder.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSpecifyImagesFolder.java @@ -2,17 +2,34 @@ import com.aspose.pdf.Document; import com.aspose.pdf.HtmlSaveOptions; +import com.aspose.pdf.examples.Utils; public class PDFToHTMLSpecifyImagesFolder { - public static void main(String[] args) { - // Load PDF document - Document pdfDocument = new Document("input.pdf"); - // Instantiate HtmlSaveOptions instance - HtmlSaveOptions saveOptions = new HtmlSaveOptions(); - // Specify the folder to save images during conversion process - // Save the resultant HTML file - pdfDocument.save("resultant.html", saveOptions); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example specifyImagesFolder start"); + specifyImagesFolder(dataDir, outputDir); + System.out.println("Example specifyImagesFolder end"); + } + + public static void specifyImagesFolder(String dataDir, String outputDir) { + // Load PDF document + Document pdfDocument = new Document(dataDir + "SampleDataTable.pdf"); + // Instantiate HtmlSaveOptions instance + HtmlSaveOptions saveOptions = new HtmlSaveOptions(); + // Specify the folder (that exist) to save images during conversion process + saveOptions.setSpecialFolderForAllImages(outputDir + "imageFolder/"); + // Save the resultant HTML file + pdfDocument.save(outputDir + "resultant.html", saveOptions); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSplittingOutputToMultipageHTML.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSplittingOutputToMultipageHTML.java index eb5ababf..18ca2303 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSplittingOutputToMultipageHTML.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLSplittingOutputToMultipageHTML.java @@ -2,18 +2,34 @@ import com.aspose.pdf.Document; import com.aspose.pdf.HtmlSaveOptions; +import com.aspose.pdf.examples.Utils; public class PDFToHTMLSplittingOutputToMultipageHTML { - public static void main(String[] args) { - // Load PDF document - Document doc = new Document("source.pdf"); - // Instantiate HtmlSaveOptions instance - HtmlSaveOptions html = new HtmlSaveOptions(); - // Specify the folder to save images during conversion process - html.setSplitIntoPages(true); - // Save the resultant HTML file - doc.save("resultant.html", html); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example splittingOutputToMultipageHTML start"); + splittingOutputToMultipageHTML(dataDir, outputDir); + System.out.println("Example splittingOutputToMultipageHTML end"); + } + + public static void splittingOutputToMultipageHTML(String dataDir, String outputDir) { + // Load PDF document + Document doc = new Document(dataDir + "input.pdf"); + // Instantiate HtmlSaveOptions instance + HtmlSaveOptions html = new HtmlSaveOptions(); + // Specify the folder to save images during conversion process + html.setSplitIntoPages(true); + // Save the resultant HTML file + doc.save(outputDir + "splittingOutputToMultipageHTML.html", html); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLWithFontSubstitution.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLWithFontSubstitution.java new file mode 100644 index 00000000..73e713e3 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFToHTMLWithFontSubstitution.java @@ -0,0 +1,62 @@ +package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; + +import com.aspose.pdf.Document; +import com.aspose.pdf.Font; +import com.aspose.pdf.FontRepository; +import com.aspose.pdf.HtmlSaveOptions; +import com.aspose.pdf.examples.Utils; +import com.aspose.pdf.text.CustomFontSubstitutionBase; + +public class PDFToHTMLWithFontSubstitution { + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example pdfToHTMLWithFontSubstitution start"); + pdfToHTMLWithFontSubstitution(dataDir, outputDir); + System.out.println("Example pdfToHTMLWithFontSubstitution end"); + } + + public static void pdfToHTMLWithFontSubstitution(String dataDir, String outputDir) { + Document pdf = new Document(dataDir + "input1.pdf"); + // configure font substitution + CustomSubst1 subst1 = new CustomSubst1(); + FontRepository.getSubstitutions().add(subst1); + // Configure notifier to console + pdf.FontSubstitution.add(new Document.FontSubstitutionHandler() { + public void invoke(Font font, Font newFont) { + // print substituted FontNames into console + System.out.println("Warning: Font " + font.getFontName() + " was substituted with another font -> " + newFont.getFontName()); + } + }); + HtmlSaveOptions htmlSaveOps = new HtmlSaveOptions(); + pdf.save(outputDir + "pdfToHTMLWithFontSubstitution.html", htmlSaveOps); + } + + /** + * The class to implement font substitution + */ + private static class CustomSubst1 extends CustomFontSubstitutionBase { + public boolean trySubstitute(OriginalFontSpecification originalFontSpecification, /* out */com.aspose.pdf.Font[] substitutionFont) { + // 1. substitute Arial font with TimesNewRoman font +// if +// ("Arial".equals(originalFontSpecification.getOriginalFontName())) { +// substitutionFont[0] = +// FontRepository.findFont("TimesNewRoman"); +// return true; +// } else +// return super.trySubstitute(originalFontSpecification, /*out*/ +// substitutionFont); + // 2. or substitute all the fonts with the MSGothic font + substitutionFont[0] = FontRepository.findFont("MSGothic"); + return true; + } + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFtoHTMLExcludeFontResources.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFtoHTMLExcludeFontResources.java new file mode 100644 index 00000000..8c6ed978 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/PDFtoHTMLExcludeFontResources.java @@ -0,0 +1,70 @@ +package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; + +import com.aspose.pdf.Document; +import com.aspose.pdf.HtmlSaveOptions; +import com.aspose.pdf.LettersPositioningMethods; +import com.aspose.pdf.examples.Utils; + +public class PDFtoHTMLExcludeFontResources { + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================"); + System.out.println("Example PDFtoHTMLExcludingFontResources start"); + PDFtoHTMLExcludingFontResources(dataDir, outputDir); + System.out.println("Example PDFtoHTMLExcludingFontResources end"); + + System.out.println("Example PDFtoHTMLExcludeFontResourcesWithAdditionalOptions start"); + PDFtoHTMLExcludeFontResourcesWithAdditionalOptions(dataDir, outputDir); + System.out.println("Example PDFtoHTMLExcludeFontResourcesWithAdditionalOptions end"); + } + + private static void PDFtoHTMLExcludingFontResources(String dataDir, String outputDir) { + + String inFile = dataDir + "ExcludeFont.pdf"; + String outMainHtmlFile = outputDir + "ExcludeFontResources.html"; + // Initialize htmlOptions + HtmlSaveOptions htmlOptions = new HtmlSaveOptions(); + + htmlOptions.setExcludeFontNameList(new String[]{"Arial", "Calibri"}); + htmlOptions.setDefaultFontName("Arial Black"); + + Document pdfDocument = new Document(inFile); + // Save + pdfDocument.save(outMainHtmlFile, htmlOptions); + // ExEnd:ExcludeFontResources + } + + //Added two options in HtmlSaveOptions: + //htmlOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.DontSave; - is for prevent exporting all the fonts + //htmlOptions.ExcludeFontNameList = (new String[] { "ArialMT", "SymbolMT" }); - is for prevent exporting specific fonts, please specify font names without hash + //In this example, Aspose.PDF tried to replace embedded fonts from PDF 'LJMWCD+ArialMT', 'KPACHB+SymbolMT' with system fonts 'ArialMT', 'SymbolMT' and specify them in HTML. + private static void PDFtoHTMLExcludeFontResourcesWithAdditionalOptions(String dataDir, String outputDir) { + HtmlSaveOptions htmlOptions = new HtmlSaveOptions(); + htmlOptions.setExplicitListOfSavedPages(new int[]{1}); + htmlOptions.setFixedLayout(true); + htmlOptions.setCompressSvgGraphicsIfAny(false); + htmlOptions.setSaveTransparentTexts(true); + htmlOptions.setSaveShadowedTextsAsTransparentTexts(true); + htmlOptions.setExcludeFontNameList((new String[]{"ArialMT", "SymbolMT"})); +// htmlOptions.setFontSavingMode(HtmlSaveOptions.FontSavingModes.DontSave); + htmlOptions.setDefaultFontName("Comic Sans MS"); + htmlOptions.setUseZOrder(true); + htmlOptions.setLettersPositioningMethod(LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss); + htmlOptions.setPartsEmbeddingMode(HtmlSaveOptions.PartsEmbeddingModes.NoEmbedding); + htmlOptions.setRasterImagesSavingMode(HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground); + htmlOptions.setSplitIntoPages(false); + + Document pdfDocument = new Document(dataDir + "ExcludeFontResourcesWithAdditionalOptions.pdf"); + pdfDocument.save(outputDir + "ExcludeFontResourcesWithAdditionalOptions.html", htmlOptions); + //ExEnd:PDFtoHTMLExcludeFontResourcesWithAdditionalOptions + } + +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ValidatePDFUAStandards.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ValidatePDFUAStandards.java new file mode 100644 index 00000000..966269f7 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentConversion/ValidatePDFUAStandards.java @@ -0,0 +1,35 @@ +package com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion; + +import com.aspose.pdf.examples.Utils; + +public class ValidatePDFUAStandards { + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Conversion/PDFUAStandards/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================1"); + System.out.println("Example validatePDFUAStandards start"); + validatePDFUAStandards(dataDir, outputDir); + System.out.println("Example validatePDFUAStandards end"); + } + + public static void validatePDFUAStandards(String dataDir, String outputDir) { + + // Load existing PDF document + com.aspose.pdf.Document doc = new com.aspose.pdf.Document(dataDir + "input.pdf"); + // Validate PDF/UA Standards + boolean validate = doc.validate(outputDir + "logfile.xml", com.aspose.pdf.PdfFormat.PDF_UA_1); + if (validate) + System.out.println("Document is compliant with PDF_UA_1"); + else + System.out.println("Document is not compliant with PDF_UA_1"); + doc.close(); + } + +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddLayersToPDFFile.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddLayersToPDFFile.java index 28a38bde..265b2d34 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddLayersToPDFFile.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddLayersToPDFFile.java @@ -1,38 +1,37 @@ package com.aspose.pdf.examples.AsposePdfExamples.DocumentObject; -import java.util.ArrayList; - import com.aspose.pdf.Document; import com.aspose.pdf.Layer; -import com.aspose.pdf.Operator; import com.aspose.pdf.Page; +import java.util.ArrayList; + public class AddLayersToPDFFile { - public static void main(String[] args) { + public static void main(String[] args) { - Document doc = new Document(); - Page page = doc.getPages().add(); - Layer layer = new Layer("oc1", "Red Line"); - layer.getContents().add(new Operator.SetRGBColorStroke(1, 0, 0)); - layer.getContents().add(new Operator.MoveTo(500, 700)); - layer.getContents().add(new Operator.LineTo(400, 700)); - layer.getContents().add(new Operator.Stroke()); - page.setLayers(new ArrayList()); - page.getLayers().add(layer); - layer = new Layer("oc2", "Green Line"); - layer.getContents().add(new Operator.SetRGBColorStroke(0, 1, 0)); - layer.getContents().add(new Operator.MoveTo(500, 750)); - layer.getContents().add(new Operator.LineTo(400, 750)); - layer.getContents().add(new Operator.Stroke()); - page.getLayers().add(layer); - layer = new Layer("oc3", "Blue Line"); - layer.getContents().add(new Operator.SetRGBColorStroke(0, 0, 1)); - layer.getContents().add(new Operator.MoveTo(500, 800)); - layer.getContents().add(new Operator.LineTo(400, 800)); - layer.getContents().add(new Operator.Stroke()); - page.getLayers().add(layer); - doc.save("output.pdf"); - } + Document doc = new Document(); + Page page = doc.getPages().add(); + Layer layer = new Layer("oc1", "Red Line"); + layer.getContents().add(new com.aspose.pdf.operators.SetRGBColorStroke(1, 0, 0)); + layer.getContents().add(new com.aspose.pdf.operators.MoveTo(500, 700)); + layer.getContents().add(new com.aspose.pdf.operators.LineTo(400, 700)); + layer.getContents().add(new com.aspose.pdf.operators.Stroke()); + page.setLayers(new ArrayList()); + page.getLayers().add(layer); + layer = new Layer("oc2", "Green Line"); + layer.getContents().add(new com.aspose.pdf.operators.SetRGBColorStroke(0, 1, 0)); + layer.getContents().add(new com.aspose.pdf.operators.MoveTo(500, 750)); + layer.getContents().add(new com.aspose.pdf.operators.LineTo(400, 750)); + layer.getContents().add(new com.aspose.pdf.operators.Stroke()); + page.getLayers().add(layer); + layer = new Layer("oc3", "Blue Line"); + layer.getContents().add(new com.aspose.pdf.operators.SetRGBColorStroke(0, 0, 1)); + layer.getContents().add(new com.aspose.pdf.operators.MoveTo(500, 800)); + layer.getContents().add(new com.aspose.pdf.operators.LineTo(400, 800)); + layer.getContents().add(new com.aspose.pdf.operators.Stroke()); + page.getLayers().add(layer); + doc.save("output.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddTOCToExistingPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddTOCToExistingPDF.java index 5c547fa5..831cc7a9 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddTOCToExistingPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddTOCToExistingPDF.java @@ -10,41 +10,41 @@ public class AddTOCToExistingPDF { - public static void main(String[] args) { - // Load an existing PDF files - Document doc = new Document("source.pdf"); - // Get access to first page of PDF file - Page tocPage = doc.getPages().insert(1); - // Create object to represent TOC information - TocInfo tocInfo = new TocInfo(); - TextFragment title = new TextFragment("Table Of Contents"); - title.getTextState().setFontSize(20); - title.getTextState().setFontStyle(FontStyles.Bold); - // Set the title for TOC - tocInfo.setTitle(title); - tocPage.setTocInfo(tocInfo); - // Create string objects which will be used as TOC elements - String[] titles = new String[4]; - titles[0] = "First page"; - titles[1] = "Second page"; - titles[2] = "Third page"; - titles[3] = "Fourth page"; - for (int i = 0; i < 4; i++) { - // Create Heading object - Heading heading2 = new Heading(1); - TextSegment segment2 = new TextSegment(); - heading2.setTocPage(tocPage); - heading2.getSegments().add(segment2); - // Specify the destination page for heading object - heading2.setDestinationPage(doc.getPages().get_Item(i + 2)); - // Destination page - heading2.setTop(doc.getPages().get_Item(i + 2).getRect().getHeight()); - // Destination coordinate - segment2.setText(titles[i]); - // Add heading to page containing TOC - tocPage.getParagraphs().add(heading2); - } - // Save the updated document - doc.save("TOC_Output_Java.pdf"); - } + public static void main(String[] args) { + // Load an existing PDF files + Document doc = new Document("source.pdf"); + // Get access to first page of PDF file + Page tocPage = doc.getPages().insert(1); + // Create object to represent TOC information + TocInfo tocInfo = new TocInfo(); + TextFragment title = new TextFragment("Table Of Contents"); + title.getTextState().setFontSize(20); + title.getTextState().setFontStyle(FontStyles.Bold); + // Set the title for TOC + tocInfo.setTitle(title); + tocPage.setTocInfo(tocInfo); + // Create string objects which will be used as TOC elements + String[] titles = new String[4]; + titles[0] = "First page"; + titles[1] = "Second page"; + titles[2] = "Third page"; + titles[3] = "Fourth page"; + for (int i = 0; i < 4; i++) { + // Create Heading object + Heading heading2 = new Heading(1); + TextSegment segment2 = new TextSegment(); + heading2.setTocPage(tocPage); + heading2.getSegments().add(segment2); + // Specify the destination page for heading object + heading2.setDestinationPage(doc.getPages().get_Item(i + 2)); + // Destination page + heading2.setTop(doc.getPages().get_Item(i + 2).getRect().getHeight()); + // Destination coordinate + segment2.setText(titles[i]); + // Add heading to page containing TOC + tocPage.getParagraphs().add(heading2); + } + // Save the updated document + doc.save("TOC_Output_Java.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddingJavaScriptDOM.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddingJavaScriptDOM.java index 07215c97..e9de8480 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddingJavaScriptDOM.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/AddingJavaScriptDOM.java @@ -1,49 +1,80 @@ package com.aspose.pdf.examples.AsposePdfExamples.DocumentObject; import com.aspose.pdf.Document; +import com.aspose.pdf.Field; import com.aspose.pdf.JavascriptAction; +import com.aspose.pdf.Page; +import com.aspose.pdf.TeXFragment; import com.aspose.pdf.TextBoxField; +import com.aspose.pdf.examples.Utils; public class AddingJavaScriptDOM { - public static void main(String[] args) { - addingJavaScriptDOM(); - afterPrintingAndSaving(); - addFormattingCodeAndValueValidation(); - } - - public static void addingJavaScriptDOM() { - // Open a PDF Document - Document doc = new Document("inuput.pdf"); - // Adding JavaScript at Document Level - // Instantiate JavascriptAction with desired JavaScript statement - JavascriptAction javaScript = new JavascriptAction("this.print({bUI:true,bSilent:false,bShrinkToFit:true});"); - // Assign JavascriptAction object to desired action of Document - doc.setOpenAction(javaScript); - // Adding JavaScript at Page Level - doc.getPages().get_Item(2).getActions().setOnOpen(new JavascriptAction("app.alert('page 2 is opened')")); - doc.getPages().get_Item(2).getActions().setOnClose(new JavascriptAction("app.alert('page 2 is closed')")); - // Save PDF Document - doc.save("JavaScript-Added.pdf"); - } - - public static void addFormattingCodeAndValueValidation() { - String path = "pathTodir"; - Document doc = new Document(path + "PdfWithAcroForm.pdf"); - TextBoxField text = (TextBoxField) doc.getForm().get_Item("textField"); - text.getAnnotationActions().setOnFormat(new JavascriptAction("AFNumber_Format(2, 0, 0, \"\", true);")); - text.getAnnotationActions().setOnModifyCharacter(new JavascriptAction("AFNumber_Keystroke(2, 0, 0, \"\", true);")); - text.getAnnotationActions().setOnValidate(new JavascriptAction("AFRange_Validate(true, 1, true, 100);")); - text.setValue("100"); - doc.save(path + "formatted.pdf"); - } - - public static void afterPrintingAndSaving() { - // Open a PDF Document - Document document = new Document("inuput.pdf"); - // Printing - document.getActions().setAfterPrinting(new JavascriptAction("app.alert('File was printed')")); - // Saving - document.getActions().setAfterSaving(new JavascriptAction("app.alert('File was Saved')")); - } + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/AddingJavaScriptDOM/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================1"); + System.out.println("Example addingJavaScriptDOM start"); + addingJavaScriptDOM(dataDir, outputDir); + System.out.println("Example addingJavaScriptDOM end"); + + System.out.println("Example afterPrintingAndSaving start"); + afterPrintingAndSaving(dataDir, outputDir); + System.out.println("Example afterPrintingAndSaving end"); + + System.out.println("Example addFormattingCodeAndValueValidation start"); + addFormattingCodeAndValueValidation(dataDir, outputDir); + System.out.println("Example addFormattingCodeAndValueValidation end"); + + } + + public static void addingJavaScriptDOM(String dataDir, String outputDir) { + // Open a PDF Document + Document doc = new Document(); + doc.getPages().add(); + Page p = doc.getPages().add(); + p.getParagraphs().add(new TeXFragment("example")); + // Adding JavaScript at Document Level + // Instantiate JavascriptAction with desired JavaScript statement + JavascriptAction javaScript = new JavascriptAction("this.print({bUI:true,bSilent:false,bShrinkToFit:true});"); + // Assign JavascriptAction object to desired action of Document + doc.setOpenAction(javaScript); + // Adding JavaScript at Page Level + doc.getPages().get_Item(2).getActions().setOnOpen(new JavascriptAction("app.alert('page 2 is opened')")); + doc.getPages().get_Item(2).getActions().setOnClose(new JavascriptAction("app.alert('page 2 is closed')")); + // Save PDF Document + doc.save(dataDir + "out/addingJavaScriptDOM.pdf"); + } + + public static void addFormattingCodeAndValueValidation(String dataDir, String outputDir) { + Document doc = new Document(); + Page page = doc.getPages().add(); + TextBoxField text1 = new TextBoxField(page, + new com.aspose.pdf.Rectangle(100, 650, 294, 700)); + text1.setPartialName("textField"); + doc.getForm().add(text1); + TextBoxField text = (TextBoxField) doc.getForm().get_Item("textField"); + text.getAnnotationActions().setOnFormat(new JavascriptAction("AFNumber_Format(2, 0, 0, \"\", true);")); + text.getAnnotationActions().setOnModifyCharacter(new JavascriptAction("AFNumber_Keystroke(2, 0, 0, \"\", true);")); + text.getAnnotationActions().setOnValidate(new JavascriptAction("AFRange_Validate(true, 1, true, 100);")); + text.setValue("100"); + doc.save(outputDir + "addFormattingCodeAndValueValidation.pdf"); + } + + public static void afterPrintingAndSaving(String dataDir, String outputDir) { + // Open a PDF Document + Document doc = new Document(); + doc.getPages().add(); + // Printing + doc.getActions().setAfterPrinting(new JavascriptAction("app.alert('File was printed')")); + // Saving + doc.getActions().setAfterSaving(new JavascriptAction("app.alert('File was Saved')")); + doc.save(outputDir + "afterPrintingAndSaving.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/ConvertPDFFromRGBColorspaceToGrayscale.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/ConvertPDFFromRGBColorspaceToGrayscale.java index 9494795e..5898f530 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/ConvertPDFFromRGBColorspaceToGrayscale.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/ConvertPDFFromRGBColorspaceToGrayscale.java @@ -6,14 +6,14 @@ public class ConvertPDFFromRGBColorspaceToGrayscale { - public static void main(String[] args) { - Document document = new Document("input.pdf"); - RgbToDeviceGrayConversionStrategy strategy = new RgbToDeviceGrayConversionStrategy(); - for (int idxPage = 1; idxPage <= document.getPages().size(); idxPage++) { - Page page = document.getPages().get_Item(idxPage); - strategy.convert(page); - } - document.save("output.pdf"); - } + public static void main(String[] args) { + Document document = new Document("input.pdf"); + RgbToDeviceGrayConversionStrategy strategy = new RgbToDeviceGrayConversionStrategy(); + for (int idxPage = 1; idxPage <= document.getPages().size(); idxPage++) { + Page page = document.getPages().get_Item(idxPage); + strategy.convert(page); + } + document.save("output.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/ConvertingNonSearchablePDFToSearchablePDFDocument.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/ConvertingNonSearchablePDFToSearchablePDFDocument.java index be734639..2e4c3bc1 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/ConvertingNonSearchablePDFToSearchablePDFDocument.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/ConvertingNonSearchablePDFToSearchablePDFDocument.java @@ -1,72 +1,71 @@ package com.aspose.pdf.examples.AsposePdfExamples.DocumentObject; +import com.aspose.pdf.Document; +import com.aspose.pdf.Document.CallBackGetHocr; + +import javax.imageio.ImageIO; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Scanner; -import javax.imageio.ImageIO; - -import com.aspose.pdf.Document; -import com.aspose.pdf.Document.CallBackGetHocr; - public class ConvertingNonSearchablePDFToSearchablePDFDocument { - public static void main(String[] args) { - final String myDir = "PathToDir"; - Document doc = new Document(myDir + "outFile.pdf"); - // Create callBack - logic recognize text for pdf images. Use outer OCR supports HOCR standard(http://en.wikipedia.org/wiki/HOCR). - // We have used free google tesseract OCR(http://en.wikipedia.org/wiki/Tesseract_%28software%29) - CallBackGetHocr cbgh = new CallBackGetHocr() { - @Override - public String invoke(java.awt.image.BufferedImage img) { - File outputfile = new File(myDir + "test.jpg"); - try { - ImageIO.write(img, "jpg", outputfile); - } catch (IOException e1) { - e1.printStackTrace(); - } - try { - java.lang.Process process = Runtime.getRuntime().exec("tesseract" + " " + myDir + "test.jpg" + " " + myDir + "out hocr"); - System.out.println("tesseract" + " " + myDir + "test.jpg" + " " + myDir + "out hocr"); - process.waitFor(); + public static void main(String[] args) { + final String myDir = "PathToDir"; + Document doc = new Document(myDir + "outFile.pdf"); + // Create callBack - logic recognize text for pdf images. Use outer OCR supports HOCR standard(http://en.wikipedia.org/wiki/HOCR). + // We have used free google tesseract OCR(http://en.wikipedia.org/wiki/Tesseract_%28software%29) + CallBackGetHocr cbgh = new CallBackGetHocr() { + @Override + public String invoke(java.awt.image.BufferedImage img) { + File outputfile = new File(myDir + "test.jpg"); + try { + ImageIO.write(img, "jpg", outputfile); + } catch (IOException e1) { + e1.printStackTrace(); + } + try { + java.lang.Process process = Runtime.getRuntime().exec("tesseract" + " " + myDir + "test.jpg" + " " + myDir + "out hocr"); + System.out.println("tesseract" + " " + myDir + "test.jpg" + " " + myDir + "out hocr"); + process.waitFor(); - } catch (IOException e) { - e.printStackTrace(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - // reading out.html to string - File file = new File(myDir + "out.html"); - StringBuilder fileContents = new StringBuilder((int) file.length()); - Scanner scanner = null; - try { - scanner = new Scanner(file); - String lineSeparator = System.getProperty("line.separator"); - while (scanner.hasNextLine()) { - fileContents.append(scanner.nextLine() + lineSeparator); - } - } catch (FileNotFoundException e) { - e.printStackTrace(); - } finally { - if (scanner != null) - scanner.close(); - } - // deleting temp files - File fileOut = new File(myDir + "out.html"); - if (fileOut.exists()) { - fileOut.delete(); - } - File fileTest = new File(myDir + "test.jpg"); - if (fileTest.exists()) { - fileTest.delete(); - } - return fileContents.toString(); - } - }; - // End callBack + } catch (IOException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + // reading out.html to string + File file = new File(myDir + "out.html"); + StringBuilder fileContents = new StringBuilder((int) file.length()); + Scanner scanner = null; + try { + scanner = new Scanner(file); + String lineSeparator = System.getProperty("line.separator"); + while (scanner.hasNextLine()) { + fileContents.append(scanner.nextLine() + lineSeparator); + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } finally { + if (scanner != null) + scanner.close(); + } + // deleting temp files + File fileOut = new File(myDir + "out.html"); + if (fileOut.exists()) { + fileOut.delete(); + } + File fileTest = new File(myDir + "test.jpg"); + if (fileTest.exists()) { + fileTest.delete(); + } + return fileContents.toString(); + } + }; + // End callBack - doc.convert(cbgh); - doc.save(myDir + "output971.pdf"); - } + doc.convert(cbgh); + doc.save(myDir + "output971.pdf"); + } } \ No newline at end of file diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/GetAllFonts.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/GetAllFonts.java new file mode 100644 index 00000000..a7340c86 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/GetAllFonts.java @@ -0,0 +1,14 @@ +package com.aspose.pdf.examples.AsposePdfExamples.DocumentObject; +import com.aspose.pdf.*; +public class GetAllFonts { + public static void main(String[] args) { + // Initialize new document object + Document doc = new Document("input.pdf"); + // Get all fonts from document + com.aspose.pdf.Font[] fonts = doc.getFontUtilities().getAllFonts(); + for (com.aspose.pdf.Font f : fonts) + { + System.out.println(f.getFontName()); + } + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/GetDocumentWindowAndPageDisplayProperties.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/GetDocumentWindowAndPageDisplayProperties.java index c3459f5b..129ac00c 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/GetDocumentWindowAndPageDisplayProperties.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/GetDocumentWindowAndPageDisplayProperties.java @@ -9,20 +9,20 @@ public static void main(String[] args) { Document pdfDocument = new Document("Original.pdf"); // Get different document properties // Position of document's window - Default: false - System.out.printf("CenterWindow :- " + pdfDocument.getCenterWindow()); + System.out.printf("CenterWindow :- " + pdfDocument.isCenterWindow()); // Predominant reading order; determine the position of page when displayed side by side - Default: L2R System.out.printf("Direction :- " + pdfDocument.getDirection()); // Whether window's title bar should display document title. // If false, title bar displays PDF file name - Default: false - System.out.printf("DisplayDocTitle :- " + pdfDocument.getDisplayDocTitle()); + System.out.printf("DisplayDocTitle :- " + pdfDocument.isDisplayDocTitle()); // Whether to resize the document's window to fit the size of first displayed page - Default: false - System.out.printf("FitWindow :- " + pdfDocument.getFitWindow()); + System.out.printf("FitWindow :- " + pdfDocument.isFitWindow()); // Whether to hide menu bar of the viewer application - Default: false - System.out.printf("HideMenuBar :-" + pdfDocument.getHideMenubar()); + System.out.printf("HideMenuBar :-" + pdfDocument.isHideMenubar()); // Whether to hide tool bar of the viewer application - Default: false - System.out.printf("HideToolBar :-" + pdfDocument.getHideToolBar()); + System.out.printf("HideToolBar :-" + pdfDocument.isHideToolBar()); // Whether to hide UI elements like scroll bars and leaving only the page contents displayed - Default: false - System.out.printf("HideWindowUI :-" + pdfDocument.getHideWindowUI()); + System.out.printf("HideWindowUI :-" + pdfDocument.isHideWindowUI()); // The document's page mode. How to display document on exiting full-screen mode. System.out.printf("NonFullScreenPageMode :-" + pdfDocument.getNonFullScreenPageMode()); // The page layout i.e. single page, one column diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/HelloWorld.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/HelloWorld.java new file mode 100644 index 00000000..2e86f5aa --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/HelloWorld.java @@ -0,0 +1,26 @@ +package com.aspose.pdf.examples.AsposePdfExamples.DocumentObject; + +import com.aspose.pdf.Document; +import com.aspose.pdf.Page; +import com.aspose.pdf.TextFragment; + +public class HelloWorld { + + public static void main(String[] args) { + // TODO Auto-generated method stub + //ExStart: HelloWorld + // Initialize document object + Document document = new Document(); + + //Add page + Page page = document.getPages().add(); + + // Add text to new page + page.getParagraphs().add(new TextFragment("Hello World!")); + + // Save updated PDF + document.save("HelloWorld_out.pdf"); + //ExEnd: HelloWorld + } + +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/OptimizePDFFileSize.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/OptimizePDFFileSize.java index e6ac289f..1f5b4c6f 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/OptimizePDFFileSize.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/OptimizePDFFileSize.java @@ -1,37 +1,63 @@ package com.aspose.pdf.examples.AsposePdfExamples.DocumentObject; import com.aspose.pdf.Document; +import com.aspose.pdf.examples.Utils; +import com.aspose.pdf.examples.AsposePdfExamples.Text.UseLatexScript3; +import com.aspose.pdf.optimization.OptimizationOptions; public class OptimizePDFFileSize { public static void main(String[] args) { - removeUnnecessaryObjects(); - compressingPDFWithImages(); + runExamples(); } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Document/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); - public static void removeUnnecessaryObjects() { - // Load source PDF file - Document doc = new Document("source.pdf"); - // Optimize the file size by removing unused objects - Document.OptimizationOptions opt = new Document.OptimizationOptions(); - opt.setRemoveUnusedObjects(true); - opt.setRemoveUnusedStreams(true); - opt.setLinkDuplcateStreams(true); - doc.optimizeResources(opt); - // Save the updated file - doc.save("optimized.pdf"); + System.out.println("============================1"); + System.out.println("Example removeUnnecessaryObjects start"); + removeUnnecessaryObjects(dataDir, outputDir); + System.out.println("Example removeUnnecessaryObjects end"); + + System.out.println("Example compressingPDFWithImages start"); + compressingPDFWithImages(dataDir, outputDir); + System.out.println("Example compressingPDFWithImages end"); + + + } + + public static void removeUnnecessaryObjects(String dataDir, String outputDir) { + + // Open document + Document pdfDocument = new Document(dataDir + "Aspose_End-User-License-Agreement_2017-01-09.pdf"); + // Set RemoveUsedObject option + OptimizationOptions optimizeOptions = new OptimizationOptions(); + optimizeOptions.setRemoveUnusedObjects(true); + optimizeOptions.setSubsetFonts(true); + // Optimize PDF document using OptimizationOptions + pdfDocument.optimizeResources(optimizeOptions); + // Save updated document + pdfDocument.save(outputDir + "removeUnnecessaryObjects_out.pdf"); + //ExEnd: removeUnnecessaryObjects } - public static void compressingPDFWithImages() { + public static void compressingPDFWithImages(String dataDir, String outputDir) { + // Load source PDF file - Document doc = new Document("input.htm"); - Document.OptimizationOptions opt = new Document.OptimizationOptions(); + Document doc = new Document(dataDir + "Aspose_End-User-License-Agreement_2017-01-09.pdf"); + com.aspose.pdf.optimization.OptimizationOptions opt = new com.aspose.pdf.optimization.OptimizationOptions(); opt.setRemoveUnusedObjects(false); opt.setLinkDuplcateStreams(false); opt.setRemoveUnusedStreams(false); // Enable image compression - opt.setCompressImages(true); // Set the quality of images in PDF file - opt.setImageQuality(10); + opt.getImageCompressionOptions().setCompressImages(true); + opt.getImageCompressionOptions().setImageQuality(10); + doc.optimizeResources(opt); + // Save the updated file + doc.save(outputDir + "compressingPDFWithImages_out.pdf"); + //ExEnd: compressingPDFWithImages } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/RemoveMetadataFromPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/RemoveMetadataFromPDF.java index f1a12724..9fa2df20 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/RemoveMetadataFromPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/RemoveMetadataFromPDF.java @@ -8,9 +8,9 @@ public static void main(String[] args) { // Instantiate Document object Document doc = new Document("testFile.pdf"); if (doc.getMetadata().contains("pdfaid:part")) - doc.getMetadata().removeItem("pdfaid:part"); + doc.getMetadata().removeItemByKey("pdfaid:part"); if (doc.getMetadata().contains("dc:format")) - doc.getMetadata().removeItem("dc:format"); + doc.getMetadata().removeItemByKey("dc:format"); // Save updated document doc.save("output.pdf"); } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/SetDefaultFont.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/SetDefaultFont.java new file mode 100644 index 00000000..f8574c48 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/DocumentObject/SetDefaultFont.java @@ -0,0 +1,15 @@ +package com.aspose.pdf.examples.AsposePdfExamples.DocumentObject; +import com.aspose.pdf.*; +public class SetDefaultFont { + public static void main(String[] args) { + String newName = "Arial"; + // Load an exisiting PDF document + Document doc = new Document("input.pdf"); + // Initialize save options for PDF format + PdfSaveOptions ops = new PdfSaveOptions(); + // Set default font name + ops.setDefaultFontName(newName); + // Save PDF file + doc.save("output_out.pdf", ops); + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Images/AddImage.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Images/AddImage.java new file mode 100644 index 00000000..c6de1a8c --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Images/AddImage.java @@ -0,0 +1,44 @@ +package com.aspose.pdf.examples.AsposePdfExamples.Images; +import java.io.FileNotFoundException; +import com.aspose.pdf.Document; +import com.aspose.pdf.ImageFileType; +import com.aspose.pdf.examples.Utils; + +public class AddImage { + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Images/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================1"); + System.out.println("Example AddDicomImage start"); + AddDicomImage(dataDir, outputDir); + System.out.println("Example AddDicomImage end"); + + } + + public static void AddDicomImage(String dataDir, String outputDir) { + // Load image into stream + java.io.FileInputStream imageStream = null; + try { + imageStream = new java.io.FileInputStream(new java.io.File(dataDir + "0002.dcm")); + + Document pdfDocument = new Document(); + pdfDocument.getPages().add(); + com.aspose.pdf.Image image = new com.aspose.pdf.Image(); + image.setFileType(ImageFileType.Dicom); + image.setImageStream(imageStream); + pdfDocument.getPages().get_Item(1).getParagraphs().add(image); + // Save output as PDF format + pdfDocument.save(outputDir + "PdfWithDicomImage_out.pdf"); + //ExEnd: AddDicomImage + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Images/AddImageToExistingPDFFile.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Images/AddImageToExistingPDFFile.java index 81fd0b2a..ac736b98 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Images/AddImageToExistingPDFFile.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Images/AddImageToExistingPDFFile.java @@ -35,18 +35,18 @@ public static void addImageToExistingPDFFile() throws IOException { // Add an image to the Images collection of the page resources page.getResources().getImages().add(imageStream); // Using the GSave operator: this operator saves current graphics state - page.getContents().add(new Operator.GSave()); + page.getContents().add(new com.aspose.pdf.operators.GSave()); // Create Rectangle and Matrix objects Rectangle rectangle = new Rectangle(lowerLeftX, lowerLeftY, upperRightX, upperRightY); Matrix matrix = new Matrix(new double[] { rectangle.getURX() - rectangle.getLLX(), 0, 0, rectangle.getURY() - rectangle.getLLY(), rectangle.getLLX(), rectangle.getLLY() }); // Using ConcatenateMatrix (concatenate matrix) operator: defines how // image must be placed - page.getContents().add(new Operator.ConcatenateMatrix(matrix)); + page.getContents().add(new com.aspose.pdf.operators.ConcatenateMatrix(matrix)); XImage ximage = page.getResources().getImages().get_Item(page.getResources().getImages().size()); // Using Do operator: this operator draws image - page.getContents().add(new Operator.Do(ximage.getName())); + page.getContents().add(new com.aspose.pdf.operators.Do(ximage.getName())); // Using GRestore operator: this operator restores graphics state - page.getContents().add(new Operator.GRestore()); + page.getContents().add(new com.aspose.pdf.operators.GRestore()); // Save the new PDF pdfDocument1.save("Updated_document.pdf"); // Close image stream diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Images/ExtractImageProperties.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Images/ExtractImageProperties.java new file mode 100644 index 00000000..c7f8dfe5 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Images/ExtractImageProperties.java @@ -0,0 +1,34 @@ +package com.aspose.pdf.examples.AsposePdfExamples.Images; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; + +import com.aspose.pdf.Document; +import com.aspose.pdf.Matrix; +import com.aspose.pdf.Operator; +import com.aspose.pdf.Page; +import com.aspose.pdf.Rectangle; +import com.aspose.pdf.XImage; + +public class ExtractImageProperties { + + public static void main(String[] args) throws IOException { + Document documet = new Document("page-0000000004.pdf"); + for (XImage image: documet.getPages().get_Item(1).getResources().getImages()) + { + XImage.RawParameters rawParameters = image.getRawParameters(); + System.out.println(rawParameters.getType()); + System.out.println(rawParameters.getName()); + System.out.println(rawParameters.getBitsPerComponent()); + System.out.println(rawParameters.getDecodeParms()); + System.out.println(rawParameters.getFilter()); + System.out.println(rawParameters.getHeight()); + System.out.println(rawParameters.getWidth()); + System.out.println(rawParameters.getLength()); + System.out.println(image.toString()); + } + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/AddHyperlinkInPDFFile.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/AddHyperlinkInPDFFile.java index e63c3477..90aa334b 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/AddHyperlinkInPDFFile.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/AddHyperlinkInPDFFile.java @@ -13,9 +13,22 @@ public class AddHyperlinkInPDFFile { - private static final String dataDir = Utils.getSharedDataDir(AddHyperlinkInPDFFile.class) + "LinksAndActions/"; - public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/LinksAndActions/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================1"); + System.out.println("Example addHyperlinkInPDFFile start"); + addHyperlinkInPDFFile(dataDir, outputDir); + System.out.println("Example addHyperlinkInPDFFile end"); + } + + public static void addHyperlinkInPDFFile(String dataDir, String outputDir) { // Open document Document document = new Document(dataDir + "input.pdf"); // Create link @@ -41,7 +54,7 @@ public static void main(String[] args) { // Add FreeText annotation to annotations collection of first page of Document document.getPages().get_Item(1).getAnnotations().add(textAnnotation); // Save updated document - document.save(dataDir + "Annotation_output.pdf"); + document.save(outputDir + "Annotation_output.pdf"); } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/CreateALinkToAnotherPDFDocument.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/CreateALinkToAnotherPDFDocument.java index 86424586..0ecb86ae 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/CreateALinkToAnotherPDFDocument.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/CreateALinkToAnotherPDFDocument.java @@ -7,9 +7,22 @@ public class CreateALinkToAnotherPDFDocument { - private static final String dataDir = Utils.getSharedDataDir(CreateALinkToAnotherPDFDocument.class) + "LinksAndActions/"; - public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/LinksAndActions/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================1"); + System.out.println("Example createALinkToAnotherPDFDocument start"); + createALinkToAnotherPDFDocument(dataDir, outputDir); + System.out.println("Example createALinkToAnotherPDFDocument end"); + } + + public static void createALinkToAnotherPDFDocument(String dataDir, String outputDir) { // Open document Document pdfDocument = new Document(); // Add page to PDF file @@ -23,6 +36,6 @@ public static void main(String[] args) { // Add link annotation to first page of PDF file pdfDocument.getPages().get_Item(1).getAnnotations().add(link); //Save the document with link - pdfDocument.save(dataDir + "Hyerplink_to_PDF.pdf"); + pdfDocument.save(outputDir + "Hyerplink_to_PDF.pdf"); } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/GetPDFHyperlinkDestination.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/GetPDFHyperlinkDestination.java index 28cf71a6..25bfd561 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/GetPDFHyperlinkDestination.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/LinksAndActions/GetPDFHyperlinkDestination.java @@ -15,7 +15,7 @@ public static void main(String[] args) { // Extract actions Page page = document.getPages().get_Item(1); AnnotationSelector selector = new AnnotationSelector(new LinkAnnotation(page, Rectangle.getTrivial())); - // page.accept(selector); + page.accept(selector); List list = selector.getSelected(); // Iterate through individual item inside list if (list.size() == 0) diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Miscellaneous/ChangingColorSpaceOfPDFDocument.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Miscellaneous/ChangingColorSpaceOfPDFDocument.java index 0a873921..e9bd2849 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Miscellaneous/ChangingColorSpaceOfPDFDocument.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Miscellaneous/ChangingColorSpaceOfPDFDocument.java @@ -12,18 +12,18 @@ public static void main(String[] args) { System.out.println("Values of RGB color operators in the pdf document"); for (int j = 1; j <= contents.size(); j++) { Operator oper = contents.get_Item(j); - if (oper instanceof Operator.SetRGBColor || oper instanceof Operator.SetRGBColorStroke) + if (oper instanceof com.aspose.pdf.operators.SetRGBColor || oper instanceof com.aspose.pdf.operators.SetRGBColorStroke) try { // Converting RGB to CMYK color System.out.println(oper.toString()); double[] rgbFloatArray = new double[] { Double.valueOf(oper.getParameters().get(0).toString()), Double.valueOf(oper.getParameters().get(1).toString()), Double.valueOf(oper.getParameters().get(2).toString()), }; double[] cmyk = new double[4]; - if (oper instanceof Operator.SetRGBColor) { - ((Operator.SetRGBColor) oper).getCMYKColor(rgbFloatArray, cmyk); - contents.set_Item(j, new Operator.SetCMYKColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3])); - } else if (oper instanceof Operator.SetRGBColorStroke) { - ((Operator.SetRGBColorStroke) oper).getCMYKColor(rgbFloatArray, cmyk); - contents.set_Item(j, new Operator.SetCMYKColorStroke(cmyk[0], cmyk[1], cmyk[2], cmyk[3])); + if (oper instanceof com.aspose.pdf.operators.SetRGBColor) { + ((com.aspose.pdf.operators.SetRGBColor) oper).getCMYKColor(rgbFloatArray, cmyk); + contents.set_Item(j, new com.aspose.pdf.operators.SetCMYKColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3])); + } else if (oper instanceof com.aspose.pdf.operators.SetRGBColorStroke) { + ((com.aspose.pdf.operators.SetRGBColorStroke) oper).getCMYKColor(rgbFloatArray, cmyk); + contents.set_Item(j, new com.aspose.pdf.operators.SetCMYKColorStroke(cmyk[0], cmyk[1], cmyk[2], cmyk[3])); } else throw new java.lang.Throwable("Unsupported command"); } catch (Throwable e) { @@ -37,7 +37,7 @@ public static void main(String[] args) { contents = doc.getPages().get_Item(1).getContents(); for (int j = 1; j <= contents.size(); j++) { Operator oper = contents.get_Item(j); - if (oper instanceof Operator.SetCMYKColor || oper instanceof Operator.SetCMYKColorStroke) { + if (oper instanceof com.aspose.pdf.operators.SetCMYKColor || oper instanceof com.aspose.pdf.operators.SetCMYKColorStroke) { System.out.println(oper.toString()); } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Pages/InsertAnEmptyPageIntoPDFFile.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Pages/InsertAnEmptyPageIntoPDFFile.java index 696facd1..080d5b77 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Pages/InsertAnEmptyPageIntoPDFFile.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Pages/InsertAnEmptyPageIntoPDFFile.java @@ -5,14 +5,29 @@ public class InsertAnEmptyPageIntoPDFFile { + public static void main(String[] args) { - String dataDir = Utils.getSharedDataDir(InsertAnEmptyPageIntoPDFFile.class) + "pages/"; + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/pages/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================1"); + System.out.println("Example insertAnEmptyPageIntoPDFFile start"); + insertAnEmptyPageIntoPDFFile(dataDir, outputDir); + System.out.println("Example insertAnEmptyPageIntoPDFFile end"); + } + + public static void insertAnEmptyPageIntoPDFFile(String dataDir, String outputDir) { // Open a document Document pdfDocument1 = new Document(dataDir + "input.pdf"); // Insert an empty page into a PDF pdfDocument1.getPages().insert(1); // Save the output file - pdfDocument1.save(dataDir + "output.pdf"); + pdfDocument1.save(outputDir + "output.pdf"); /* * //Info * // Insert a empty page at the end of PDF pdfDocument1.getPages().add(); diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/QuickStart/SetLocale.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/QuickStart/SetLocale.java new file mode 100644 index 00000000..74771cc3 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/QuickStart/SetLocale.java @@ -0,0 +1,8 @@ +package com.aspose.pdf.examples.AsposePdfExamples.QuickStart; + +public class SetLocale { + + public static void main(String[] args) { + com.aspose.pdf.LocaleOptions.setLocale(java.util.Locale.FRANCE); + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/QuickStart/UsingMultipleProducts.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/QuickStart/UsingMultipleProducts.java index eca1a0d1..a39a7f95 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/QuickStart/UsingMultipleProducts.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/QuickStart/UsingMultipleProducts.java @@ -1,23 +1,39 @@ package com.aspose.pdf.examples.AsposePdfExamples.QuickStart; +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.Utils; + public class UsingMultipleProducts { + + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/LinksAndActions/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================1"); + System.out.println("Example usingMultipleProducts start"); + usingMultipleProducts(dataDir, outputDir); + System.out.println("Example usingMultipleProducts end"); + } - public static void main(String[] args) { - Run(); - } - public static void Run(){ + public static void usingMultipleProducts(String dataDir, String outputDir) { // Instantiate the License class of Aspose.Pdf com.aspose.pdf.License license = new com.aspose.pdf.License(); // Set the license try { - license.setLicense("Aspose.Total.Java.lic"); + license.setLicense(dataDir+ "Aspose.Total.Java.lic"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } - + // Setting license for Aspose.Words for Java - + // Instantiate the License class of Aspose.Words com.aspose.words.License licenseaw = new com.aspose.words.License(); // Set the license @@ -27,5 +43,11 @@ public static void Run(){ // TODO Auto-generated catch block e.printStackTrace(); } + + //Check that licence is valid and document has no evaluation mark. + Document doc = new Document(); + doc.getPages().add(); + doc.save(outputDir+"usingMultipleProducts.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/SecurityAndSignatures/ExtractingImageFromSignatureField.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/SecurityAndSignatures/ExtractingImageFromSignatureField.java index f7c0450e..74fd384e 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/SecurityAndSignatures/ExtractingImageFromSignatureField.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/SecurityAndSignatures/ExtractingImageFromSignatureField.java @@ -16,8 +16,8 @@ public static void main(String[] args) { Document pdfDocument = new Document(myDir + "test.pdf"); int i = 0; try { - for (Field field : (Iterable) pdfDocument.getForm()) { - SignatureField sf = (SignatureField) field; + for (Field field : pdfDocument.getForm().getFields()) { + SignatureField sf = (SignatureField)field; if (sf != null) { FileOutputStream output = new FileOutputStream(myDir + "im" + i + ".jpeg"); InputStream tempStream = sf.extractImage(); diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/StampsAndWatermarks/AddImageStampAsBackgroundInFloatingBox.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/StampsAndWatermarks/AddImageStampAsBackgroundInFloatingBox.java new file mode 100644 index 00000000..7b7fa9ca --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/StampsAndWatermarks/AddImageStampAsBackgroundInFloatingBox.java @@ -0,0 +1,59 @@ +package com.aspose.pdf.examples.AsposePdfExamples.StampsAndWatermarks; + +import com.aspose.pdf.BorderInfo; +import com.aspose.pdf.BorderSide; +import com.aspose.pdf.Document; +import com.aspose.pdf.FloatingBox; +import com.aspose.pdf.Image; +import com.aspose.pdf.TextFragment; +import com.aspose.pdf.examples.Utils; +import com.aspose.pdf.examples.AsposePdfExamples.Tables.AddTableInExistingPDFDocument; + + +public class AddImageStampAsBackgroundInFloatingBox { + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Stamps-Watermarks/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================1"); + System.out.println("Example addImageStampAsBackgroundInFloatingBox start"); + addImageStampAsBackgroundInFloatingBox(dataDir, outputDir); + System.out.println("Example addImageStampAsBackgroundInFloatingBox end"); + } + public static void addImageStampAsBackgroundInFloatingBox(String dataDir, String outputDir) { + // TODO Auto-generated method stub + //ExStart: AddImageStampAsBackgroundInFloatingBox + // Instantiate Document object + Document doc = new Document(); + // Add page to PDF document + com.aspose.pdf.Page page = doc.getPages().add(); + // Create FloatingBox object + FloatingBox aBox = new FloatingBox(200, 100); + // Set left position for FloatingBox + aBox.setLeft(40); + // Set Top position for FloatingBox + aBox.setTop(80); + // Set the Horizontal alignment for FloatingBox + aBox.setHorizontalAlignment(com.aspose.pdf.HorizontalAlignment.Center); + // Add text fragment to paragraphs collection of FloatingBox + aBox.getParagraphs().add(new TextFragment("main text")); + // Set border for FloatingBox + aBox.setBorder(new BorderInfo(BorderSide.All, com.aspose.pdf.Color.getRed())); + // Add background image + aBox.setBackgroundImage( new Image()); + aBox.getBackgroundImage().setFile(dataDir +"aspose-logo.jpg"); + // Set background color for FloatingBox + aBox.setBackgroundColor(com.aspose.pdf.Color.getYellow()); + // Add FloatingBox to paragraphs collection of page object + page.getParagraphs().add(aBox); + // Save the PDF document + doc.save(outputDir + "AddImageStampAsBackgroundInFloatingBox_out.pdf"); + //ExEnd: AddImageStampAsBackgroundInFloatingBox + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/StampsAndWatermarks/ExtractTextFromStampAnnotation.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/StampsAndWatermarks/ExtractTextFromStampAnnotation.java new file mode 100644 index 00000000..8492ac7b --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/StampsAndWatermarks/ExtractTextFromStampAnnotation.java @@ -0,0 +1,43 @@ +package com.aspose.pdf.examples.AsposePdfExamples.StampsAndWatermarks; + +import com.aspose.pdf.Annotation; +import com.aspose.pdf.Document; +import com.aspose.pdf.StampAnnotation; +import com.aspose.pdf.TextAbsorber; +import com.aspose.pdf.XForm; +import com.aspose.pdf.examples.Utils; + +public class ExtractTextFromStampAnnotation { + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Stamps-Watermarks/"; + String dataDir = Utils.getDataDir(testID); +// String outputDir = Utils.getOutDir(testID); + + System.out.println("============================1"); + System.out.println("Example extractTextFromStampAnnotation start"); + extractTextFromStampAnnotation(dataDir); + System.out.println("Example extractTextFromStampAnnotation end"); + } + + public static void extractTextFromStampAnnotation(String dataDir) { + + //ExStart: ExtractTextFromStampAnnotation + + Document doc = new Document(dataDir+"test.pdf"); + Annotation item = doc.getPages().get_Item(1).getAnnotations().get_Item(3); + if (item instanceof StampAnnotation ) { + StampAnnotation annot = (StampAnnotation) item; + TextAbsorber ta = new TextAbsorber(); + XForm ap = annot.getNormalAppearance(); + ta.visit(ap); + System.out.println(ta.getText()); + } + //ExEnd: ExtractTextFromStampAnnotation + } + +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/AddTableInExistingPDFDocument.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/AddTableInExistingPDFDocument.java index 8029f6af..73ce9386 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/AddTableInExistingPDFDocument.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/AddTableInExistingPDFDocument.java @@ -12,80 +12,82 @@ public class AddTableInExistingPDFDocument { - public static void main(String[] args) { - // The path to the resource directory. - String dataDir = Utils.getSharedDataDir(AddTableInExistingPDFDocument.class) + "AsposePdfExamples/Tables/"; - - addTableInExistingPDFDocument(dataDir); - setAutoFitToWindowPropertyInColumnAdjustmentTypeEnumeration(dataDir); - } + public static void main(String[] args) { + // The paths to resources and output directories. + String testID = "AsposePdfExamples/Tables/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); - public static void addTableInExistingPDFDocument(String dataDir) { - // Load source PDF document - Document doc = new Document(dataDir + "input.pdf"); - // Initializes a new instance of the Table - Table table = new Table(); - // Set the table border color as LightGray - table.setBorder(new BorderInfo(BorderSide.All, .5f, Color.getLightGray())); - // set the border for table cells - table.setDefaultCellBorder(new BorderInfo(BorderSide.All, .5f, Color.getLightGray())); - // create a loop to add 10 rows - for (int row_count = 1; row_count < 10; row_count++) { - // add row to table - Row row = table.getRows().add(); - // add table cells - row.getCells().add("Column (" + row_count + ", 1)"); - row.getCells().add("Column (" + row_count + ", 2)"); - row.getCells().add("Column (" + row_count + ", 3)"); - } - // Add table object to first page of input document - doc.getPages().get_Item(1).getParagraphs().add(table); - // Save updated document containing table object - doc.save(dataDir + "document_with_table.pdf"); - } + addTableInExistingPDFDocument(dataDir, outputDir); + setAutoFitToWindowPropertyInColumnAdjustmentTypeEnumeration(dataDir, outputDir); + } - public static void setAutoFitToWindowPropertyInColumnAdjustmentTypeEnumeration(String dataDir) { - //Instantiate the PDF object by calling its empty constructor - Document doc = new Document(); - //Create the section in the PDF object - Page page = doc.getPages().add(); + public static void addTableInExistingPDFDocument(String dataDir, String outputDir) { + // Load source PDF document + Document doc = new Document(dataDir + "input.pdf"); + // Initializes a new instance of the Table + Table table = new Table(); + // Set the table border color as LightGray + table.setBorder(new BorderInfo(BorderSide.All, .5f, Color.getLightGray())); + // set the border for table cells + table.setDefaultCellBorder(new BorderInfo(BorderSide.All, .5f, Color.getLightGray())); + // create a loop to add 10 rows + for (int row_count = 1; row_count < 10; row_count++) { + // add row to table + Row row = table.getRows().add(); + // add table cells + row.getCells().add("Column (" + row_count + ", 1)"); + row.getCells().add("Column (" + row_count + ", 2)"); + row.getCells().add("Column (" + row_count + ", 3)"); + } + // Add table object to first page of input document + doc.getPages().get_Item(1).getParagraphs().add(table); + // Save updated document containing table object + doc.save(dataDir + "document_with_table.pdf"); + } - //Instantiate a table object - Table tab = new Table(); - //Add the table in paragraphs collection of the desired section - page.getParagraphs().add(tab); + public static void setAutoFitToWindowPropertyInColumnAdjustmentTypeEnumeration(String dataDir, String outputDir) { + //Instantiate the PDF object by calling its empty constructor + Document doc = new Document(); + //Create the section in the PDF object + Page page = doc.getPages().add(); - //Set with column widths of the table - tab.setColumnWidths("50 50 50"); - tab.setColumnAdjustment(ColumnAdjustment.AutoFitToWindow); + //Instantiate a table object + Table tab = new Table(); + //Add the table in paragraphs collection of the desired section + page.getParagraphs().add(tab); - //Set default cell border using BorderInfo object - tab.setDefaultCellBorder(new com.aspose.pdf.BorderInfo(com.aspose.pdf.BorderSide.All, 0.1F)); + //Set with column widths of the table + tab.setColumnWidths("50 50 50"); + tab.setColumnAdjustment(ColumnAdjustment.AutoFitToWindow); - //Set table border using another customized BorderInfo object - tab.setBorder(new com.aspose.pdf.BorderInfo(com.aspose.pdf.BorderSide.All, 1F)); - //Create MarginInfo object and set its left, bottom, right and top margins - com.aspose.pdf.MarginInfo margin = new com.aspose.pdf.MarginInfo(); - margin.setTop(5f); - margin.setLeft(5f); - margin.setRight(5f); - margin.setBottom(5f); + //Set default cell border using BorderInfo object + tab.setDefaultCellBorder(new com.aspose.pdf.BorderInfo(com.aspose.pdf.BorderSide.All, 0.1F)); - //Set the default cell padding to the MarginInfo object - tab.setDefaultCellPadding(margin); + //Set table border using another customized BorderInfo object + tab.setBorder(new com.aspose.pdf.BorderInfo(com.aspose.pdf.BorderSide.All, 1F)); + //Create MarginInfo object and set its left, bottom, right and top margins + com.aspose.pdf.MarginInfo margin = new com.aspose.pdf.MarginInfo(); + margin.setTop(5f); + margin.setLeft(5f); + margin.setRight(5f); + margin.setBottom(5f); - //Create rows in the table and then cells in the rows - com.aspose.pdf.Row row1 = tab.getRows().add(); - row1.getCells().add("col1"); - row1.getCells().add("col2"); - row1.getCells().add("col3"); - com.aspose.pdf.Row row2 = tab.getRows().add(); - row2.getCells().add("item1"); - row2.getCells().add("item2"); - row2.getCells().add("item3"); + //Set the default cell padding to the MarginInfo object + tab.setDefaultCellPadding(margin); - //Save the PDF - doc.save(dataDir + "ResultantFile.pdf"); - } + //Create rows in the table and then cells in the rows + com.aspose.pdf.Row row1 = tab.getRows().add(); + row1.getCells().add("col1"); + row1.getCells().add("col2"); + row1.getCells().add("col3"); + com.aspose.pdf.Row row2 = tab.getRows().add(); + row2.getCells().add("item1"); + row2.getCells().add("item2"); + row2.getCells().add("item3"); + + //Save the PDF + doc.save(dataDir + "ResultantFile.pdf"); + } } diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/HideSpannedCellBorder.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/HideSpannedCellBorder.java new file mode 100644 index 00000000..84fc9d22 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/HideSpannedCellBorder.java @@ -0,0 +1,95 @@ +package com.aspose.pdf.examples.AsposePdfExamples.Tables; + +import com.aspose.pdf.BorderInfo; +import com.aspose.pdf.BorderSide; +import com.aspose.pdf.Cell; +import com.aspose.pdf.Color; +import com.aspose.pdf.Document; +import com.aspose.pdf.TableBroken; +import com.aspose.pdf.examples.Utils; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertPDFFileIntoXPSFormat; + +public class HideSpannedCellBorder { + + + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/WorkingWithTables/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================1"); + System.out.println("Example hideSpannedCellBorder start"); + hideSpannedCellBorder(dataDir, outputDir); + System.out.println("Example hideSpannedCellBorder end"); + } + + public static void hideSpannedCellBorder(String dataDir, String outputDir) { + + //ExStart: HideSpannedCellBorder + + Document doc = new Document(); + com.aspose.pdf.Page page = doc.getPages().add(); + + //Instantiate a table object that will be nested inside outerTable that will break + //inside the same page + com.aspose.pdf.Table mytable = new com.aspose.pdf.Table(); + mytable.setBroken(TableBroken.Vertical); + mytable.setDefaultCellBorder(new BorderInfo(BorderSide.All)); + mytable.setRepeatingColumnsCount(2); + page.getParagraphs().add(mytable); + + //Add header Row + com.aspose.pdf.Row row = mytable.getRows().add(); + Cell cell = row.getCells().add("header 1"); + cell.setColSpan(2); + cell.setBackgroundColor(Color.getLightGray()); + Cell header3 = row.getCells().add("header 3"); + Cell cell2 = row.getCells().add("header 4"); + cell2.setColSpan(2); + cell2.setBackgroundColor(Color.getLightBlue()); + row.getCells().add("header 6"); + Cell cell3 = row.getCells().add("header 7"); + cell3.setColSpan(2); + cell3.setBackgroundColor(Color.getLightGreen()); + Cell cell4 = row.getCells().add("header 9"); + cell4.setColSpan(3); + cell4.setBackgroundColor(Color.getLightCoral()); + row.getCells().add("header 12"); + row.getCells().add("header 13"); + row.getCells().add("header 14"); + row.getCells().add("header 15"); + row.getCells().add("header 16"); + row.getCells().add("header 17"); + + for (int rowCounter = 0; rowCounter < 1; rowCounter++) + { + //Create rows in the table and then cells in the rows + com.aspose.pdf.Row row1 = mytable.getRows().add(); + row1.getCells().add("col "+rowCounter+", 1"); + row1.getCells().add("col "+rowCounter+", 2"); + row1.getCells().add("col "+rowCounter+", 3"); + row1.getCells().add("col "+rowCounter+", 4"); + row1.getCells().add("col "+rowCounter+", 5"); + row1.getCells().add("col "+rowCounter+", 6"); + row1.getCells().add("col "+rowCounter+", 7"); + row1.getCells().add("col "+rowCounter+", 8"); + row1.getCells().add("col "+rowCounter+", 9"); + row1.getCells().add("col "+rowCounter+", 10"); + row1.getCells().add("col "+rowCounter+", 11"); + row1.getCells().add("col "+rowCounter+", 12"); + row1.getCells().add("col "+rowCounter+", 13"); + row1.getCells().add("col "+rowCounter+", 14"); + row1.getCells().add("col "+rowCounter+", 15"); + row1.getCells().add("col "+rowCounter+", 16"); + row1.getCells().add("col "+rowCounter+", 17"); + } + doc.save(outputDir + "3_out.pdf"); + //ExEnd: HideSpannedCellBorder + } + +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/ManipulateTablesInExistingPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/ManipulateTablesInExistingPDF.java index 8a76f50a..6fcc66ec 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/ManipulateTablesInExistingPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/ManipulateTablesInExistingPDF.java @@ -19,7 +19,8 @@ public static void main(String[] args) { absorber.visit(pdfDocument.getPages().get_Item(1)); // Get access to first table on page, their first cell and text // fragments in it - TextFragment fragment = absorber.getTableList().get_Item(0).getRowList().get_Item(0).getCellList().get_Item(0).getTextFragments().get_Item(1); + + TextFragment fragment = absorber.getTableList().get(0).getRowList().get(0).getCellList().get(0).getTextFragments().get_Item(1); // Change text of the first text fragment in the cell fragment.setText("Hello World !"); // save updated document diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/RemoveTablesFromExistingPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/RemoveTablesFromExistingPDF.java index a9af02b9..7a987f26 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/RemoveTablesFromExistingPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Tables/RemoveTablesFromExistingPDF.java @@ -17,9 +17,9 @@ public static void main(String[] args) { // Visit first page with absorber absorber.visit(editor.getDocument().getPages().get_Item(1)); // Getting the table rectangle - Rectangle rect = absorber.getTableList().get_Item(0).getRectangle(); + Rectangle rect = absorber.getTableList().get(0).getRectangle(); // clear text for the table - for (AbsorbedRow row : absorber.getTableList().get_Item(0).getRowList()) { + for (AbsorbedRow row : absorber.getTableList().get(0).getRowList()) { for (AbsorbedCell cell : row.getCellList()) { for (Object fragment : cell.getTextFragments()) { ((TextFragment) fragment).setText(""); diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/AccessChildrenElements.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/AccessChildrenElements.java new file mode 100644 index 00000000..6c824dec --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/AccessChildrenElements.java @@ -0,0 +1,59 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.ElementList; +import com.aspose.pdf.tagged.logicalstructure.elements.Element; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureElement; + +public class AccessChildrenElements { + public static void main(String[] args) { + // ExStart:AccessChildrenElements + String path = Utils.getDataDir() + "TaggedPDFs\\"; + // Open Pdf Document + Document document = new Document( path +"StructureElements.pdf"); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Access to root element(s) + ElementList elementList = taggedContent.getStructTreeRootElement().getChildElements(); + for (Element element : elementList) + { + if (element instanceof StructureElement) + { + StructureElement structureElement = (StructureElement)element; + + // Get properties + String title = structureElement.getTitle(); + String language = structureElement.getLanguage(); + String actualText = structureElement.getActualText(); + String expansionText = structureElement.getExpansionText(); + String alternativeText = structureElement.getAlternativeText(); + } + } + + // Access to children elements of first element in root element + elementList = taggedContent.getRootElement().getChildElements().get_Item(1).getChildElements(); + for (Element element : elementList) + { + if (element instanceof StructureElement) + { + StructureElement structureElement = (StructureElement)element; + + // Set properties + structureElement.setTitle("title"); + structureElement.setLanguage("fr-FR"); + structureElement.setActualText("actual text"); + structureElement.setExpansionText("exp"); + structureElement.setAlternativeText("alt"); + } + } + + // Save Tagged Pdf Document + document.save( path +"AccessChildrenElements.pdf"); + + // ExEnd:AccessChildrenElements + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/AddStructureElementIntoElement.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/AddStructureElementIntoElement.java new file mode 100644 index 00000000..cf535351 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/AddStructureElementIntoElement.java @@ -0,0 +1,85 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.ParagraphElement; +import com.aspose.pdf.tagged.logicalstructure.elements.ils.SpanElement; + +public class AddStructureElementIntoElement { + public static void main(String[] args) { + // ExStart:1 + // The path to the documents directory. + String dataDir = Utils.getDataDir() + "TaggedPDFs\\"; + String outFile = dataDir + "AddStructureElementIntoElement_Output.pdf"; + String logFile = dataDir + "46144_log.xml"; + + // Creation document and getting Tagged Pdf Content + Document document = new Document(); + ITaggedContent taggedContent = document.getTaggedContent(); + + + // Setting Title and Nature Language for document + taggedContent.setTitle("Text Elements Example"); + taggedContent.setLanguage("en-US"); + + // Getting Root structure element (Document structure element) + StructureElement rootElement = taggedContent.getRootElement(); + + + ParagraphElement p1 = taggedContent.createParagraphElement(); + rootElement.appendChild(p1); + SpanElement span11 = taggedContent.createSpanElement(); + span11.setText("Span_11"); + SpanElement span12 = taggedContent.createSpanElement(); + span12.setText(" and Span_12."); + p1.setText("Paragraph with "); + p1.appendChild(span11); + p1.appendChild(span12); + + + ParagraphElement p2 = taggedContent.createParagraphElement(); + rootElement.appendChild(p2); + SpanElement span21 = taggedContent.createSpanElement(); + span21.setText("Span_21"); + SpanElement span22 = taggedContent.createSpanElement(); + span22.setText("Span_22."); + p2.appendChild(span21); + p2.setText(" and "); + p2.appendChild(span22); + + + ParagraphElement p3 = taggedContent.createParagraphElement(); + rootElement.appendChild(p3); + SpanElement span31 = taggedContent.createSpanElement(); + span31.setText("Span_31"); + SpanElement span32 = taggedContent.createSpanElement(); + span32.setText(" and Span_32"); + p3.appendChild(span31); + p3.appendChild(span32); + p3.setText("."); + + + ParagraphElement p4 = taggedContent.createParagraphElement(); + rootElement.appendChild(p4); + SpanElement span41 = taggedContent.createSpanElement(); + SpanElement span411 = taggedContent.createSpanElement(); + span411.setText("Span_411, "); + span41.setText("Span_41, "); + span41.appendChild(span411); + SpanElement span42 = taggedContent.createSpanElement(); + SpanElement span421 = taggedContent.createSpanElement(); + span421.setText("Span 421 and "); + span42.appendChild(span421); + span42.setText("Span_42"); + p4.appendChild(span41); + p4.appendChild(span42); + p4.setText("."); + + + // Save Tagged Pdf Document + document.save(outFile); + // ExEnd:1 + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateNoteStructureElement.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateNoteStructureElement.java new file mode 100644 index 00000000..e0d155eb --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateNoteStructureElement.java @@ -0,0 +1,49 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.ParagraphElement; +import com.aspose.pdf.tagged.logicalstructure.elements.ils.NoteElement; + + +public class CreateNoteStructureElement { + public static void main(String[] args) { + // ExStart:1 + // The path to the documents directory. + String dataDir = Utils.getDataDir() + "TaggedPDFs\\"; + String outFile = dataDir + "CreateNoteStructureElement.pdf"; + String logFile = dataDir + "45929_log.xml"; + + // Create Pdf Document + Document document = new Document(); + ITaggedContent taggedContent = document.getTaggedContent(); + + taggedContent.setTitle("Sample of Note Elements"); + taggedContent.setLanguage("en-US"); + + // Add Paragraph Element + ParagraphElement paragraph = taggedContent.createParagraphElement(); + taggedContent.getRootElement().appendChild(paragraph); + + // Add NoteElement + NoteElement note1 = taggedContent.createNoteElement(); + paragraph.appendChild(note1); + note1.setText("Note with auto generate ID. "); + + // Add NoteElement + NoteElement note2 = taggedContent.createNoteElement(); + paragraph.appendChild(note2); + note2.setText("Note with ID = 'note_002'. "); + note2.setId("note_002"); + + // Add NoteElement + NoteElement note3 = taggedContent.createNoteElement(); + paragraph.appendChild(note3); + note3.setText("Note with ID = 'note_003'. "); + note3.setId("note_003"); + // Save Tagged Pdf Document + document.save(outFile); + // ExEnd:1 + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreatePDFwithTaggedImage.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreatePDFwithTaggedImage.java new file mode 100644 index 00000000..8e5dbf34 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreatePDFwithTaggedImage.java @@ -0,0 +1,31 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.IllustrationElement; + +public class CreatePDFwithTaggedImage { + public static void main(String[] args) { + // ExStart:1 + // The path to the documents directory. + String dataDir = Utils.getDataDir() + "TaggedPDFs\\"; + Document document = new Document(); + ITaggedContent taggedContent = document.getTaggedContent(); + + taggedContent.setTitle("CreatePDFwithTaggedImage"); + taggedContent.setLanguage("en-US"); + + IllustrationElement figure1 = taggedContent.createFigureElement(); + taggedContent.getRootElement().appendChild(figure1); + figure1.setAlternativeText("Aspose Logo"); + figure1.setTitle("Image 1"); + figure1.setTag("Fig"); + // Add image with resolution 300 DPI (by default) + figure1.setImage(dataDir + "aspose-logo.jpg"); + + // Save PDF Document + document.save(dataDir + "PDFwithTaggedImage.pdf"); + // ExEnd:1 + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreatePDFwithTaggedText.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreatePDFwithTaggedText.java new file mode 100644 index 00000000..b695a696 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreatePDFwithTaggedText.java @@ -0,0 +1,46 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.HeaderElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.ParagraphElement; + +public class CreatePDFwithTaggedText { + public static void main(String[] args) { + // ExStart:1 + // The path to the documents directory. + String dataDir = Utils.getDataDir() + "TaggedPDFs\\"; + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Create Text Block-Level Structure Elements + HeaderElement headerElement = taggedContent.createHeaderElement(); + headerElement.setActualText("Heading 1"); + ParagraphElement paragraphElement1 = taggedContent.createParagraphElement(); + paragraphElement1.setActualText("test1"); + ParagraphElement paragraphElement2 = taggedContent.createParagraphElement(); + paragraphElement2.setActualText("test 2"); + ParagraphElement paragraphElement3 = taggedContent.createParagraphElement(); + paragraphElement3.setActualText("test 3"); + ParagraphElement paragraphElement4 = taggedContent.createParagraphElement(); + paragraphElement4.setActualText("test 4"); + ParagraphElement paragraphElement5 = taggedContent.createParagraphElement(); + paragraphElement5.setActualText("test 5"); + ParagraphElement paragraphElement6 = taggedContent.createParagraphElement(); + paragraphElement6.setActualText("test 6"); + ParagraphElement paragraphElement7 = taggedContent.createParagraphElement(); + paragraphElement7.setActualText("test 7"); + + // Save PDF Document + document.save( dataDir + "PDFwithTaggedText.pdf"); + // ExEnd:1 + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateStructureElement.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateStructureElement.java new file mode 100644 index 00000000..474b65a6 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateStructureElement.java @@ -0,0 +1,75 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.FigureElement; +import com.aspose.pdf.tagged.logicalstructure.elements.FormElement; +import com.aspose.pdf.tagged.logicalstructure.elements.FormulaElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.HeaderElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.ListElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.ParagraphElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.TableElement; +import com.aspose.pdf.tagged.logicalstructure.elements.grouping.*; +import com.aspose.pdf.tagged.logicalstructure.elements.ils.*; + +public class CreateStructureElement { + public static void main(String[] args) { + // ExStart:CreateStructureElements + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Create Grouping Elements + PartElement partElement = taggedContent.createPartElement(); + ArtElement artElement = taggedContent.createArtElement(); + SectElement sectElement = taggedContent.createSectElement(); + DivElement divElement = taggedContent.createDivElement(); + BlockQuoteElement blockQuoteElement = taggedContent.createBlockQuoteElement(); + CaptionElement captionElement = taggedContent.createCaptionElement(); + TOCElement tocElement = taggedContent.createTOCElement(); + TOCIElement tociElement = taggedContent.createTOCIElement(); + IndexElement indexElement = taggedContent.createIndexElement(); + NonStructElement nonStructElement = taggedContent.createNonStructElement(); + PrivateElement privateElement = taggedContent.createPrivateElement(); + + // Create Text Block-Level Structure Elements + ParagraphElement paragraphElement = taggedContent.createParagraphElement(); + HeaderElement headerElement = taggedContent.createHeaderElement(); + HeaderElement h1Element = taggedContent.createHeaderElement(1); + + // Create Text Inline-Level Structure Elements + SpanElement spanElement = taggedContent.createSpanElement(); + QuoteElement quoteElement = taggedContent.createQuoteElement(); + NoteElement noteElement = taggedContent.createNoteElement(); + + // Create Illustration Structure Elements + FigureElement figureElement = taggedContent.createFigureElement(); + FormulaElement formulaElement = taggedContent.createFormulaElement(); + + // Methods are under development + ListElement listElement = taggedContent.createListElement(); + TableElement tableElement = taggedContent.createTableElement(); + ReferenceElement referenceElement = taggedContent.createReferenceElement(); + BibEntryElement bibEntryElement = taggedContent.createBibEntryElement(); + CodeElement codeElement = taggedContent.createCodeElement(); + LinkElement linkElement = taggedContent.createLinkElement(); + AnnotElement annotElement = taggedContent.createAnnotElement(); + RubyElement rubyElement = taggedContent.createRubyElement(); + WarichuElement warichuElement = taggedContent.createWarichuElement(); + FormElement formElement = taggedContent.createFormElement(); + + // Save Tagged Pdf Document + document.save(path + "StructureElements.pdf"); + // ExEnd:CreateStructureElements + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateStructureElementTree.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateStructureElementTree.java new file mode 100644 index 00000000..831d1da9 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateStructureElementTree.java @@ -0,0 +1,71 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureElement; +import com.aspose.pdf.tagged.logicalstructure.elements.grouping.ArtElement; +import com.aspose.pdf.tagged.logicalstructure.elements.grouping.DivElement; +import com.aspose.pdf.tagged.logicalstructure.elements.grouping.SectElement; + +public class CreateStructureElementTree { + public static void main(String[] args) { + // ExStart:CreateStructureElementTree + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Get root structure element (Document) + StructureElement rootElement = taggedContent.getRootElement(); + + // Create Logical Structure + SectElement sect1 = taggedContent.createSectElement(); + rootElement.appendChild(sect1); + + SectElement sect2 = taggedContent.createSectElement(); + rootElement.appendChild(sect2); + + DivElement div11 = taggedContent.createDivElement(); + sect1.appendChild(div11); + + DivElement div12 = taggedContent.createDivElement(); + sect1.appendChild(div12); + + ArtElement art21 = taggedContent.createArtElement(); + sect2.appendChild(art21); + + ArtElement art22 = taggedContent.createArtElement(); + sect2.appendChild(art22); + + DivElement div211 = taggedContent.createDivElement(); + art21.appendChild(div211); + + DivElement div212 = taggedContent.createDivElement(); + art21.appendChild(div212); + + DivElement div221 = taggedContent.createDivElement(); + art22.appendChild(div221); + + DivElement div222 = taggedContent.createDivElement(); + art22.appendChild(div222); + + SectElement sect3 = taggedContent.createSectElement(); + rootElement.appendChild(sect3); + + DivElement div31 = taggedContent.createDivElement(); + sect3.appendChild(div31); + + // Save Tagged Pdf Document + document.save(path + "StructureElementsTree.pdf"); + // ExEnd:CreateStructureElementTree + } + +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateTableElement.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateTableElement.java new file mode 100644 index 00000000..f8e66b95 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CreateTableElement.java @@ -0,0 +1,137 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.*; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.AttributeKey; +import com.aspose.pdf.tagged.logicalstructure.AttributeOwnerStandard; +import com.aspose.pdf.tagged.logicalstructure.StructureAttributes; +import com.aspose.pdf.tagged.logicalstructure.elements.*; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.*; + +public class CreateTableElement { + public static void main(String[] args) { + // ExStart:1 + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + + // Create document + Document document = new Document(); + ITaggedContent taggedContent = document.getTaggedContent(); + + taggedContent.setTitle("Example table"); + taggedContent.setLanguage("en-US"); + + // Get root structure element + StructureElement rootElement = taggedContent.getRootElement(); + + + TableElement tableElement = taggedContent.createTableElement(); + rootElement.appendChild(tableElement); + + tableElement.setBorder(new BorderInfo(BorderSide.All, 1.2F, Color.getDarkBlue())); + + TableTHeadElement tableTHeadElement = tableElement.createTHead(); + TableTBodyElement tableTBodyElement = tableElement.createTBody(); + TableTFootElement tableTFootElement = tableElement.createTFoot(); + int rowCount = 50; + int colCount = 4; + int rowIndex; + int colIndex; + + TableTRElement headTrElement = tableTHeadElement.createTR(); + headTrElement.setAlternativeText("Head Row"); + + headTrElement.setBackgroundColor(Color.getLightGray()); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + TableTHElement thElement = headTrElement.createTH(); + thElement.setText(String.format("Head %s", colIndex)); + + thElement.setBackgroundColor(Color.getGreenYellow()); + thElement.setBorder(new BorderInfo(BorderSide.All, 4.0F, Color.getLightGray())); + + thElement.setMargin(new MarginInfo(16.0, 2.0, 8.0, 2.0)); + + thElement.setAlignment(HorizontalAlignment.Right); + } + + for (rowIndex = 0; rowIndex < rowCount; rowIndex++) + { + TableTRElement trElement = tableTBodyElement.createTR(); + trElement.setAlternativeText(String.format("Row %s", rowIndex)); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + int colSpan = 1; + int rowSpan = 1; + + if (colIndex == 1 && rowIndex == 1) + { + colSpan = 2; + rowSpan = 2; + } + else if (colIndex == 2 && (rowIndex == 1 || rowIndex == 2)) + { + continue; + } + else if (rowIndex == 2 && (colIndex == 1 || colIndex == 2)) + { + continue; + } + + TableTDElement tdElement = trElement.createTD(); + tdElement.setText(String.format("Cell [%s, %s]", rowIndex, colIndex)); + + + tdElement.setBackgroundColor(Color.getYellow()); + tdElement.setBorder(new BorderInfo(BorderSide.All, 4.0F, Color.getGray())); + + + tdElement.setMargin(new MarginInfo(8.0, 2.0, 8.0, 2.0)); + + tdElement.setAlignment(HorizontalAlignment.Center); + + TextState cellTextState = new TextState(); + cellTextState.setForegroundColor(Color.getDarkBlue()); + cellTextState.setFontSize(7.5F); + cellTextState.setFontStyle(FontStyles.Bold); + cellTextState.setFont(FontRepository.findFont("Arial")); + tdElement.setDefaultCellTextState(cellTextState); + + tdElement.isWordWrapped(); + tdElement.setVerticalAlignment(VerticalAlignment.Center); + + tdElement.setColSpan(colSpan); + tdElement.setRowSpan(rowSpan); + } + } + + TableTRElement footTrElement = tableTFootElement.createTR(); + footTrElement.setAlternativeText("Foot Row"); + + footTrElement.setBackgroundColor(Color.getLightSeaGreen()); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + TableTDElement tdElement = footTrElement.createTD(); + tdElement.setText(String.format("Foot %s", colIndex)); + + tdElement.setAlignment(HorizontalAlignment.Center); + tdElement.getStructureTextState().setFontSize(7F); + tdElement.getStructureTextState().setFontStyle(FontStyles.Bold); + } + + + StructureAttributes tableAttributes = tableElement.getAttributes().getAttributes(AttributeOwnerStandard.Table); + StructureAttribute summaryAttribute = new StructureAttribute(AttributeKey.Summary); + summaryAttribute.setStringValue("The summary text for table"); + tableAttributes.setAttribute(summaryAttribute); + + + // Save Tagged Pdf Document + document.save(path + "CreateTableElement.pdf"); + // ExEnd:1 + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CustomTagName.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CustomTagName.java new file mode 100644 index 00000000..08ef9764 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/CustomTagName.java @@ -0,0 +1,73 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.ParagraphElement; +import com.aspose.pdf.tagged.logicalstructure.elements.grouping.SectElement; +import com.aspose.pdf.tagged.logicalstructure.elements.ils.SpanElement; + +public class CustomTagName { + public static void main(String[] args) { + // ExStart:CustomTagName + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Create Logical Structure Elements + SectElement sect = taggedContent.createSectElement(); + taggedContent.getRootElement().appendChild(sect); + + ParagraphElement p1 = taggedContent.createParagraphElement(); + ParagraphElement p2 = taggedContent.createParagraphElement(); + ParagraphElement p3 = taggedContent.createParagraphElement(); + ParagraphElement p4 = taggedContent.createParagraphElement(); + + p1.setText("P1. "); + p2.setText("P2. "); + p3.setText("P3. "); + p4.setText("P4. "); + + p1.setTag("P1"); + p2.setTag("Para"); + p3.setTag("Para"); + p4.setTag("Paragraph"); + + sect.appendChild(p1); + sect.appendChild(p2); + sect.appendChild(p3); + sect.appendChild(p4); + + SpanElement span1 = taggedContent.createSpanElement(); + SpanElement span2 = taggedContent.createSpanElement(); + SpanElement span3 = taggedContent.createSpanElement(); + SpanElement span4 = taggedContent.createSpanElement(); + + span1.setText("Span 1."); + span2.setText("Span 2."); + span3.setText("Span 3."); + span4.setText("Span 4."); + + span1.setTag("SPAN"); + span2.setTag("Sp"); + span3.setTag("Sp"); + span4.setTag("TheSpan"); + + p1.appendChild(span1); + p2.appendChild(span2); + p3.appendChild(span3); + p4.appendChild(span4); + + // Save Tagged Pdf Document + document.save(path + "CustomTag.pdf"); + // ExEnd:CustomTagName + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/IllustrationStructureElements.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/IllustrationStructureElements.java new file mode 100644 index 00000000..7fb126f5 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/IllustrationStructureElements.java @@ -0,0 +1,35 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.IllustrationElement; + +public class IllustrationStructureElements { + public static void main(String[] args) { + // ExStart:IllustrationStructureElements + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Under Development + IllustrationElement figure1 = taggedContent.createFigureElement(); + taggedContent.getRootElement().appendChild(figure1); + figure1.setActualText("Figure One"); + figure1.setTitle("Image 1"); + figure1.setTag("Fig1"); + figure1.setImage("image.png"); + + // Save Tagged Pdf Document + document.save(path + "IllustrationStructureElements.pdf"); + // ExEnd:IllustrationStructureElements + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/InlineStructureElements.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/InlineStructureElements.java new file mode 100644 index 00000000..e54d7b62 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/InlineStructureElements.java @@ -0,0 +1,123 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.HeaderElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.ParagraphElement; +import com.aspose.pdf.tagged.logicalstructure.elements.ils.SpanElement; + +public class InlineStructureElements { + public static void main(String[] args) { + // ExStart:InlineStructureElements + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Get Root Structure Element + StructureElement rootElement = taggedContent.getRootElement(); + + HeaderElement h1 = taggedContent.createHeaderElement(1); + HeaderElement h2 = taggedContent.createHeaderElement(2); + HeaderElement h3 = taggedContent.createHeaderElement(3); + HeaderElement h4 = taggedContent.createHeaderElement(4); + HeaderElement h5 = taggedContent.createHeaderElement(5); + HeaderElement h6 = taggedContent.createHeaderElement(6); + rootElement.appendChild(h1); + rootElement.appendChild(h2); + rootElement.appendChild(h3); + rootElement.appendChild(h4); + rootElement.appendChild(h5); + rootElement.appendChild(h6); + + SpanElement spanH11 = taggedContent.createSpanElement(); + spanH11.setText("H1. "); + h1.appendChild(spanH11); + SpanElement spanH12 = taggedContent.createSpanElement(); + spanH12.setText("Level 1 Header"); + h1.appendChild(spanH12); + + SpanElement spanH21 = taggedContent.createSpanElement(); + spanH21.setText("H2. "); + h2.appendChild(spanH21); + SpanElement spanH22 = taggedContent.createSpanElement(); + spanH22.setText("Level 2 Header"); + h2.appendChild(spanH22); + + SpanElement spanH31 = taggedContent.createSpanElement(); + spanH31.setText("H3. "); + h3.appendChild(spanH31); + SpanElement spanH32 = taggedContent.createSpanElement(); + spanH32.setText("Level 3 Header"); + h3.appendChild(spanH32); + + SpanElement spanH41 = taggedContent.createSpanElement(); + spanH41.setText("H4. "); + h4.appendChild(spanH41); + SpanElement spanH42 = taggedContent.createSpanElement(); + spanH42.setText("Level 4 Header"); + h4.appendChild(spanH42); + + SpanElement spanH51 = taggedContent.createSpanElement(); + spanH51.setText("H5. "); + h5.appendChild(spanH51); + SpanElement spanH52 = taggedContent.createSpanElement(); + spanH52.setText("Level 5 Header"); + h5.appendChild(spanH52); + + SpanElement spanH61 = taggedContent.createSpanElement(); + spanH61.setText("H6. "); + h6.appendChild(spanH61); + SpanElement spanH62 = taggedContent.createSpanElement(); + spanH62.setText("Level 6 Header"); + h6.appendChild(spanH62); + + ParagraphElement p = taggedContent.createParagraphElement(); + p.setText("P. "); + rootElement.appendChild(p); + SpanElement span1 = taggedContent.createSpanElement(); + span1.setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. "); + p.appendChild(span1); + SpanElement span2 = taggedContent.createSpanElement(); + span2.setText("Aenean nec lectus ac sem faucibus imperdiet. "); + p.appendChild(span2); + SpanElement span3 = taggedContent.createSpanElement(); + span3.setText("Sed ut erat ac magna ullamcorper hendrerit. "); + p.appendChild(span3); + SpanElement span4 = taggedContent.createSpanElement(); + span4.setText("Cras pellentesque libero semper, gravida magna sed, luctus leo. "); + p.appendChild(span4); + SpanElement span5 = taggedContent.createSpanElement(); + span5.setText("Fusce lectus odio, laoreet nec ullamcorper ut, molestie eu elit. "); + p.appendChild(span5); + SpanElement span6 = taggedContent.createSpanElement(); + span6.setText("Interdum et malesuada fames ac ante ipsum primis in faucibus. "); + p.appendChild(span6); + SpanElement span7 = taggedContent.createSpanElement(); + span7.setText("Aliquam lacinia sit amet elit ac consectetur. Donec cursus condimentum ligula, vitae volutpat sem tristique eget. "); + p.appendChild(span7); + SpanElement span8 = taggedContent.createSpanElement(); + span8.setText("Nulla in consectetur massa. Vestibulum vitae lobortis ante. Nulla ullamcorper pellentesque justo rhoncus accumsan. "); + p.appendChild(span8); + SpanElement span9 = taggedContent.createSpanElement(); + span9.setText("Mauris ornare eu odio non lacinia. Aliquam massa leo, rhoncus ac iaculis eget, tempus et magna. Sed non consectetur elit. "); + p.appendChild(span9); + SpanElement span10 = taggedContent.createSpanElement(); + span10.setText("Sed vulputate, quam sed lacinia luctus, ipsum nibh fringilla purus, vitae posuere risus odio id massa. Cras sed venenatis lacus."); + p.appendChild(span10); + + // Save Tagged Pdf Document + document.save(path + "InlineStructureElements.pdf"); + // ExEnd:InlineStructureElements + } +} + diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/RootStructure.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/RootStructure.java new file mode 100644 index 00000000..0fba152c --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/RootStructure.java @@ -0,0 +1,30 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.StructTreeRootElement; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureElement; + +public class RootStructure { + public static void main(String[] args) { + // ExStart:RootStructure + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Properties StructTreeRootElement and RootElement are used for access to + // StructTreeRoot object of pdf document and to root structure element (Document structure element). + StructTreeRootElement structTreeRootElement = taggedContent.getStructTreeRootElement(); + StructureElement rootElement = taggedContent.getRootElement(); + // ExEnd:RootStructure + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StructureElementsProperties.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StructureElementsProperties.java new file mode 100644 index 00000000..371bb02a --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StructureElementsProperties.java @@ -0,0 +1,46 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.HeaderElement; +import com.aspose.pdf.tagged.logicalstructure.elements.grouping.SectElement; + +public class StructureElementsProperties { + public static void main(String[] args) { + // ExStart:StructureElementsProperties + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Create Structure Elements + StructureElement rootElement = taggedContent.getRootElement(); + + SectElement sect = taggedContent.createSectElement(); + rootElement.appendChild(sect); + + HeaderElement h1 = taggedContent.createHeaderElement(1); + sect.appendChild(h1); + h1.setText("The Header"); + + h1.setTitle("Title"); + h1.setLanguage("en-US"); + h1.setAlternativeText("Alternative Text"); + h1.setExpansionText("Expansion Text"); + h1.setActualText("Actual Text"); + + // Save Tagged Pdf Document + document.save(path + "StructureElementsProperties.pdf"); + + // ExEnd:StructureElementsProperties + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTableCell.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTableCell.java new file mode 100644 index 00000000..cb1ac253 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTableCell.java @@ -0,0 +1,121 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.*; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.*; + +public class StyleTableCell { + public static void main(String[] args) { + // ExStart:1 + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + + // Create document + Document document = new Document(); + ITaggedContent taggedContent = document.getTaggedContent(); + + taggedContent.setTitle("Example table cell style"); + taggedContent.setLanguage("en-US"); + + // Get root structure element + StructureElement rootElement = taggedContent.getRootElement(); + + + // Create table structure element + TableElement tableElement = taggedContent.createTableElement(); + rootElement.appendChild(tableElement); + + + TableTHeadElement tableTHeadElement = tableElement.createTHead(); + TableTBodyElement tableTBodyElement = tableElement.createTBody(); + TableTFootElement tableTFootElement = tableElement.createTFoot(); + int rowCount = 4; + int colCount = 4; + int rowIndex; + int colIndex; + + TableTRElement headTrElement = tableTHeadElement.createTR(); + headTrElement.setAlternativeText("Head Row"); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + TableTHElement thElement = headTrElement.createTH(); + thElement.setText(String.format("Head %s", colIndex)); + + thElement.setBackgroundColor(Color.getGreenYellow()); + thElement.setBorder(new BorderInfo(BorderSide.All, 4.0F, Color.getGray())); + + thElement.setNoBorder(false); + thElement.setMargin(new MarginInfo(16.0, 2.0, 8.0, 2.0)); + + thElement.setAlignment(HorizontalAlignment.Right); + } + + for (rowIndex = 0; rowIndex < rowCount; rowIndex++) + { + TableTRElement trElement = tableTBodyElement.createTR(); + trElement.setAlternativeText(String.format("Row %s", rowIndex)); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + int colSpan = 1; + int rowSpan = 1; + + if (colIndex == 1 && rowIndex == 1) + { + colSpan = 2; + rowSpan = 2; + } + else if (colIndex == 2 && (rowIndex == 1 || rowIndex == 2)) + { + continue; + } + else if (rowIndex == 2 && (colIndex == 1 || colIndex == 2)) + { + continue; + } + + TableTDElement tdElement = trElement.createTD(); + tdElement.setText(String.format("Cell [%s, %s]", rowIndex, colIndex)); + + + tdElement.setBackgroundColor(Color.getYellow()); + tdElement.setBorder(new BorderInfo(BorderSide.All, 4.0F, Color.getGray())); + + tdElement.setNoBorder(false); + tdElement.setMargin(new MarginInfo(8.0, 2.0, 8.0, 2.0)); + + tdElement.setAlignment(HorizontalAlignment.Center); + + TextState cellTextState = new TextState(); + cellTextState.setForegroundColor(Color.getDarkBlue()); + cellTextState.setFontSize(7.5F); + cellTextState.setFontStyle(FontStyles.Bold); + cellTextState.setFont(FontRepository.findFont("Arial")); + tdElement.setDefaultCellTextState(cellTextState); + + tdElement.setWordWrapped(false); + tdElement.setVerticalAlignment(VerticalAlignment.Center); + + tdElement.setColSpan(colSpan); + tdElement.setRowSpan(rowSpan); + } + } + + TableTRElement footTrElement = tableTFootElement.createTR(); + footTrElement.setAlternativeText("Foot Row"); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + TableTDElement tdElement = footTrElement.createTD(); + tdElement.setText(String.format("Foot %s", colIndex)); + } + + + // Save Tagged Pdf Document + document.save(path + "StyleTableCell.pdf"); + // ExEnd:1 + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTableElement.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTableElement.java new file mode 100644 index 00000000..6f5e7134 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTableElement.java @@ -0,0 +1,104 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.*; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.AttributeKey; +import com.aspose.pdf.tagged.logicalstructure.AttributeOwnerStandard; +import com.aspose.pdf.tagged.logicalstructure.StructureAttributes; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureAttribute; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.*; + +public class StyleTableElement { + public static void main(String[] args) { + // ExStart:1 + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + + // Create document + Document document = new Document(); + ITaggedContent taggedContent = document.getTaggedContent(); + + taggedContent.setTitle("Example table style"); + taggedContent.setLanguage("en-US"); + + // Get root structure element + StructureElement rootElement = taggedContent.getRootElement(); + + + // Create table structure element + TableElement tableElement = taggedContent.createTableElement(); + rootElement.appendChild(tableElement); + + + tableElement.setBackgroundColor(Color.getBeige()); + tableElement.setBorder(new BorderInfo(BorderSide.All, 0.80F, Color.getGray())); + tableElement.setAlignment(HorizontalAlignment.Center); + tableElement.setBroken(TableBroken.Vertical); + tableElement.setColumnAdjustment(ColumnAdjustment.AutoFitToWindow); + tableElement.setColumnWidths("80 80 80 80 80"); + tableElement.setDefaultCellBorder(new BorderInfo(BorderSide.All, 0.50F, Color.getDarkBlue())); + tableElement.setDefaultCellPadding(new MarginInfo(16.0, 2.0, 8.0, 2.0)); + tableElement.getDefaultCellTextState().setForegroundColor(Color.getDarkCyan()); + tableElement.getDefaultCellTextState().setFontSize(8F); + tableElement.setDefaultColumnWidth("70"); + + tableElement.setBroken(false); + tableElement.setBordersIncluded(true); + + tableElement.setLeft(0F); + tableElement.setTop(40F); + + tableElement.setRepeatingColumnsCount(2); + tableElement.setRepeatingRowsCount(3); + TextState rowStyle = new TextState(); + rowStyle.setBackgroundColor(Color.getLightCoral()); + tableElement.setRepeatingRowsStyle(rowStyle); + + + + + TableTHeadElement tableTHeadElement = tableElement.createTHead(); + TableTBodyElement tableTBodyElement = tableElement.createTBody(); + TableTFootElement tableTFootElement = tableElement.createTFoot(); + int rowCount = 10; + int colCount = 5; + int rowIndex; + int colIndex; + + TableTRElement headTrElement = tableTHeadElement.createTR(); + headTrElement.setAlternativeText("Head Row"); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + TableTHElement thElement = headTrElement.createTH(); + thElement.setText(String.format("Head %s", colIndex)); + } + + for (rowIndex = 0; rowIndex < rowCount; rowIndex++) + { + TableTRElement trElement = tableTBodyElement.createTR(); + trElement.setAlternativeText(String.format("Row %s", rowIndex)); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + TableTDElement tdElement = trElement.createTD(); + tdElement.setText(String.format("Cell [%s, %s]", rowIndex, colIndex)); + } + } + + TableTRElement footTrElement = tableTFootElement.createTR(); + footTrElement.setAlternativeText("Foot Row"); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + TableTDElement tdElement = footTrElement.createTD(); + tdElement.setText(String.format("Foot %s", colIndex)); + } + + // Save Tagged Pdf Document + document.save(path + "StyleTableElement.pdf"); + // ExEnd:1 + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTableRow.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTableRow.java new file mode 100644 index 00000000..d64a5515 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTableRow.java @@ -0,0 +1,90 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.*; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.*; + +public class StyleTableRow { + public static void main(String[] args) { + // ExStart:1 + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + + // Create document + Document document = new Document(); + ITaggedContent taggedContent = document.getTaggedContent(); + + taggedContent.setTitle("Example table row style"); + taggedContent.setLanguage("en-US"); + + // Get root structure element + StructureElement rootElement = taggedContent.getRootElement(); + + + // Create table structure element + TableElement tableElement = taggedContent.createTableElement(); + rootElement.appendChild(tableElement); + + + TableTHeadElement tableTHeadElement = tableElement.createTHead(); + TableTBodyElement tableTBodyElement = tableElement.createTBody(); + TableTFootElement tableTFootElement = tableElement.createTFoot(); + int rowCount = 7; + int colCount = 3; + int rowIndex; + int colIndex; + + TableTRElement headTrElement = tableTHeadElement.createTR(); + headTrElement.setAlternativeText("Head Row"); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + TableTHElement thElement = headTrElement.createTH(); + thElement.setText(String.format("Head %s", colIndex)); + } + + for (rowIndex = 0; rowIndex < rowCount; rowIndex++) + { + TableTRElement trElement = tableTBodyElement.createTR(); + trElement.setAlternativeText(String.format("Row %s", rowIndex)); + + trElement.setBackgroundColor(Color.getLightSeaGreen()); + trElement.setBorder(new BorderInfo(BorderSide.All, 0.75F, Color.getDarkGray())); + + trElement.setDefaultCellBorder(new BorderInfo(BorderSide.All, 0.50F, Color.getBlue())); + trElement.setMinRowHeight(100.0); + trElement.setFixedRowHeight(120.0); + trElement.setRowBroken(true); + + TextState cellTextState = new TextState(); + cellTextState.setForegroundColor(Color.getRed()); + trElement.setDefaultCellTextState(cellTextState); + + trElement.setDefaultCellPadding(new MarginInfo(16.0, 2.0, 8.0, 2.0)); + trElement.setVerticalAlignment(VerticalAlignment.Bottom); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + TableTDElement tdElement = trElement.createTD(); + tdElement.setText(String.format("Cell [{0}, {1}]", rowIndex, colIndex)); + } + } + + TableTRElement footTrElement = tableTFootElement.createTR(); + footTrElement.setAlternativeText("Foot Row"); + + for (colIndex = 0; colIndex < colCount; colIndex++) + { + TableTDElement tdElement = footTrElement.createTD(); + tdElement.setText(String.format("Foot %s", colIndex)); + } + + + + // Save Tagged Pdf Document + document.save(path + "StyleTableRow.pdf"); + // ExEnd:1 + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTextStructure.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTextStructure.java new file mode 100644 index 00000000..836897d2 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/StyleTextStructure.java @@ -0,0 +1,39 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Color; +import com.aspose.pdf.Document; +import com.aspose.pdf.FontStyles; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.ParagraphElement; + +public class StyleTextStructure { + public static void main(String[] args) { + // ExStart:StyleTextStructure + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + ParagraphElement p = taggedContent.createParagraphElement(); + taggedContent.getRootElement().appendChild(p); + + // Under Development + p.getStructureTextState().setFontSize(18F); + p.getStructureTextState().setForegroundColor(Color.getRed()); + p.getStructureTextState().setFontStyle(FontStyles.Italic); + + p.setText("Red italic text."); + + // Save Tagged Pdf Document + document.save(path + "StyleTextStructure.pdf"); + // ExEnd:StyleTextStructure + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/TaggedPDFContent.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/TaggedPDFContent.java new file mode 100644 index 00000000..9de9916e --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/TaggedPDFContent.java @@ -0,0 +1,31 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; + +public class TaggedPDFContent { + public static void main(String[] args) { + // ExStart:TaggedPDFContent + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // + // Work with Tagged Pdf content + // + + // Set Title and Language for Documnet + taggedContent.setTitle("Simple Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Save Tagged Pdf Document + document.save(path + "TaggedPDFContent.pdf"); + // ExEnd:TaggedPDFContent + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/TextBlockStructureElements.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/TextBlockStructureElements.java new file mode 100644 index 00000000..e7fb65c8 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/TextBlockStructureElements.java @@ -0,0 +1,57 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.HeaderElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.ParagraphElement; + +public class TextBlockStructureElements { + public static void main(String[] args) { + // ExStart:TextBlockStructureElements + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Get Root Structure Element + StructureElement rootElement = taggedContent.getRootElement(); + + HeaderElement h1 = taggedContent.createHeaderElement(1); + HeaderElement h2 = taggedContent.createHeaderElement(2); + HeaderElement h3 = taggedContent.createHeaderElement(3); + HeaderElement h4 = taggedContent.createHeaderElement(4); + HeaderElement h5 = taggedContent.createHeaderElement(5); + HeaderElement h6 = taggedContent.createHeaderElement(6); + h1.setText("H1. Header of Level 1"); + h2.setText("H2. Header of Level 2"); + h3.setText("H3. Header of Level 3"); + h4.setText("H4. Header of Level 4"); + h5.setText("H5. Header of Level 5"); + h6.setText("H6. Header of Level 6"); + rootElement.appendChild(h1); + rootElement.appendChild(h2); + rootElement.appendChild(h3); + rootElement.appendChild(h4); + rootElement.appendChild(h5); + rootElement.appendChild(h6); + + ParagraphElement p = taggedContent.createParagraphElement(); + p.setText("P. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nec lectus ac sem faucibus imperdiet. Sed ut erat ac magna ullamcorper hendrerit. Cras pellentesque libero semper, gravida magna sed, luctus leo. Fusce lectus odio, laoreet nec ullamcorper ut, molestie eu elit. Interdum et malesuada fames ac ante ipsum primis in faucibus. Aliquam lacinia sit amet elit ac consectetur. Donec cursus condimentum ligula, vitae volutpat sem tristique eget. Nulla in consectetur massa. Vestibulum vitae lobortis ante. Nulla ullamcorper pellentesque justo rhoncus accumsan. Mauris ornare eu odio non lacinia. Aliquam massa leo, rhoncus ac iaculis eget, tempus et magna. Sed non consectetur elit. Sed vulputate, quam sed lacinia luctus, ipsum nibh fringilla purus, vitae posuere risus odio id massa. Cras sed venenatis lacus."); + rootElement.appendChild(p); + + // Save Tagged Pdf Document + document.save(path + "TextBlockStructureElements.pdf"); + + // ExEnd:TextBlockStructureElements + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/TextStructureElements.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/TextStructureElements.java new file mode 100644 index 00000000..d8429a91 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/TextStructureElements.java @@ -0,0 +1,38 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; +import com.aspose.pdf.tagged.ITaggedContent; +import com.aspose.pdf.tagged.logicalstructure.elements.StructureElement; +import com.aspose.pdf.tagged.logicalstructure.elements.bls.ParagraphElement; + +public class TextStructureElements { + public static void main(String[] args) { + // ExStart:TextStructureElements + // The path to the documents directory. + String path = Utils.getDataDir() + "TaggedPDFs\\"; + + // Create Pdf Document + Document document = new Document(); + + // Get Content for work with TaggedPdf + ITaggedContent taggedContent = document.getTaggedContent(); + + // Set Title and Language for Documnet + taggedContent.setTitle("Tagged Pdf Document"); + taggedContent.setLanguage("en-US"); + + // Get Root Structure Elements + StructureElement rootElement = taggedContent.getRootElement(); + + ParagraphElement p = taggedContent.createParagraphElement(); + // Set Text to Text Structure Element + p.setText("Paragraph."); + rootElement.appendChild(p); + + + // Save Tagged Pdf Document + document.save(path + "TextStructureElement.pdf"); + // ExEnd:TextStructureElements + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/ValidatePDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/ValidatePDF.java new file mode 100644 index 00000000..b7b587b8 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/TaggedPDFs/ValidatePDF.java @@ -0,0 +1,22 @@ +package com.aspose.pdf.examples.AsposePdfExamples.TaggedPDFs; + +import com.aspose.pdf.Document; +import com.aspose.pdf.PdfFormat; +import com.aspose.pdf.examples.AsposePdfExamples.Utilities.Utils; + +public class ValidatePDF { + public static void main(String[] args) { + // ExStart:1 + // The path to the documents directory. + String dataDir = Utils.getDataDir() + "TaggedPDFs\\"; + String inputFileName = dataDir + "StructureElements.pdf"; + String outputLogName = dataDir + "ua-20.xml"; + + Document document = new Document(inputFileName); + + Boolean isValid = document.validate(outputLogName, PdfFormat.PDF_UA_1); + + System.out.println(isValid); + // ExStart:1 + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/AddHTMLOrderedListIntoDocuments.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/AddHTMLOrderedListIntoDocuments.java new file mode 100644 index 00000000..d942c191 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/AddHTMLOrderedListIntoDocuments.java @@ -0,0 +1,22 @@ +package com.aspose.pdf.examples.AsposePdfExamples.Text; + +import com.aspose.pdf.Document; +import com.aspose.pdf.HtmlFragment; +import com.aspose.pdf.Page; + +public class AddHTMLOrderedListIntoDocuments { + public static void main(String[] args) { + // ExStart:AddHTMLOrderedListIntoDocuments + // Instantiate Document object + Document doc = new Document(); + // Instantiate HtmlFragment object with corresponding HTML fragment + HtmlFragment t = new HtmlFragment("`
  • First
  • Second
  • Third
  • Fourth
  • Fifth
Text after the list.
Next line
Last line`"); + // Add Page in Pages Collection + Page page = doc.getPages().add(); + // Add HtmlFragment inside page + page.getParagraphs().add(t); + // Save resultant PDF file + doc.save("AddHTMLOrderedListIntoDocuments_out.pdf"); + // ExEnd:AddHTMLOrderedListIntoDocuments + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/AddHTMLUsingDOMAndOverwrite.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/AddHTMLUsingDOMAndOverwrite.java new file mode 100644 index 00000000..6ea3e9fd --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/AddHTMLUsingDOMAndOverwrite.java @@ -0,0 +1,30 @@ +package com.aspose.pdf.examples.AsposePdfExamples.Text; + +import com.aspose.pdf.Document; +import com.aspose.pdf.HtmlFragment; +import com.aspose.pdf.Page; +import com.aspose.pdf.TextState; + +public class AddHTMLUsingDOMAndOverwrite { + public static void main(String[] args) { + // ExStart:AddHTMLUsingDOMAndOverwrite + // Instantiate Document object + Document doc = new Document(); + // Add a page to pages collection of PDF file + Page page = doc.getPages().add(); + // Instantiate HtmlFragment with HTML contnets + HtmlFragment title = new HtmlFragment("

Table contains text

"); + //Font-family from 'Verdana' will be reset to 'Arial' + title.setTextState(new TextState("Arial")); + title.setTextState(new TextState(20)); + // Set bottom margin information + title.getMargin().setBottom(10); + // Set top margin information + title.getMargin().setTop(400); + // Add HTML Fragment to paragraphs collection of page + page.getParagraphs().add(title); + // Save PDF file + doc.save("AddHTMLUsingDOMAndOverwrite_out.pdf"); + // ExEnd:AddHTMLUsingDOMAndOverwrite + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/AddRotatedTextInPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/AddRotatedTextInPDF.java new file mode 100644 index 00000000..360b5200 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/AddRotatedTextInPDF.java @@ -0,0 +1,33 @@ +package com.aspose.pdf.examples.AsposePdfExamples.Text; + +import com.aspose.pdf.*; + +public class AddRotatedTextInPDF { + + public static void main(String[] args) { + // Open document + Document pdfDocument = new Document(); + // Get particular page + Page pdfPage = (Page)pdfDocument.getPages().add(); + + // Create rotated text fragment + TextFragment tf = new TextFragment("rotated text"); + tf.setPosition(new Position(200, 600)); + + // Set text properties + tf.getTextState().setFontSize(12); + tf.getTextState().setFont(FontRepository.findFont("TimesNewRoman")); + tf.getTextState().setBackgroundColor(com.aspose.pdf.Color.getLightGray()); + tf.getTextState().setForegroundColor(com.aspose.pdf.Color.getRed()); + tf.getTextState().setRotation(45); + tf.getTextState().setUnderline(true); + + + // Create TextBuilder object + TextBuilder textBuilder = new TextBuilder(pdfPage); + // Append the text fragment to the PDF page + textBuilder.appendText(tf); + // Save document + pdfDocument.save("TextFragmentTests_Rotated.pdf"); + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/ExtractRotatedText.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/ExtractRotatedText.java new file mode 100644 index 00000000..5863ec59 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/ExtractRotatedText.java @@ -0,0 +1,40 @@ +package com.aspose.pdf.examples.AsposePdfExamples.Text; + +import java.util.Iterator; + +import com.aspose.pdf.*; + +public class ExtractRotatedText { + + public static void main(String[] args) { + com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("PdfWithRotatedText.pdf"); + + TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("R"); + // Accept the absorber for 4th page of document + pdfDocument.getPages().get_Item(4).accept(textFragmentAbsorber); + // Get the extracted text fragments into collection + TextFragmentCollection textFragmentCollection = textFragmentAbsorber.getTextFragments(); + Iterator iterF = textFragmentCollection.iterator(); //assume textFragmentCollection has 2 results + + while (iterF.hasNext()) + { + TextFragment tf = iterF.next(); + System.out.println("Fragment: " + tf.getText() + " " + tf.getRectangle()); + TextFragmentState state = tf.getTextState(); + System.out.println("Rotation: " + state.getRotation()); + Iterator iterS = tf.getSegments().iterator(); //assume textFragmentCollection has 2 results + while (iterS.hasNext()) + { + TextSegment ts = iterS.next(); + System.out.println("Segment: " + ts.getText() + " " + ts.getRectangle()); + + Iterator iterC = ts.getCharacters().iterator(); + while (iterC.hasNext()) + { + CharInfo cI = iterC.next(); + System.out.println(cI.getPosition()); + } + } + } + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/ReplaceOnlyFirstOccurrenceOfThePhrase.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/ReplaceOnlyFirstOccurrenceOfThePhrase.java index 8c6d20af..7f5a644e 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/ReplaceOnlyFirstOccurrenceOfThePhrase.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/ReplaceOnlyFirstOccurrenceOfThePhrase.java @@ -16,7 +16,7 @@ public static void main(String[] args) { // phrase TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("line"); // accept the absorber for first page of document - pdfDocument.getPages().accept(textFragmentAbsorber); + pdfDocument.getPages().get_Item(1).accept(textFragmentAbsorber); // get the extracted text fragments into collection TextFragmentCollection textFragmentCollection = textFragmentAbsorber.getTextFragments(); // get first occurrence of text and replace diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/UseLatexScript.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/UseLatexScript.java new file mode 100644 index 00000000..289b5e21 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/UseLatexScript.java @@ -0,0 +1,34 @@ +package com.aspose.pdf.examples.AsposePdfExamples.Text; + +import com.aspose.pdf.*; + +public class UseLatexScript { + public static void main(String[] args) { + // ExStart:UseLatexScript + // Create a new Document Object + Document doc = new Document(); + // Add Page in Pages Collection + Page page = doc.getPages().add(); + // Create a Table + Table table = new Table(); + // Add a row into Table + Row row = table.getRows().add(); + // Add Cell with Latex Script to add methematical expressions/formulae + String latexText1 = "$123456789+\\sqrt{1}+\\int_a^b f(x)dx$"; + Cell cell = row.getCells().add(); + MarginInfo marginInfo = new MarginInfo(); + marginInfo.setLeft(20); + marginInfo.setRight(20); + marginInfo.setTop(20); + marginInfo.setBottom(20); + cell.setMargin(marginInfo); + // Second LatexFragment constructor bool parameter provides LaTeX paragraph indents elimination. + LatexFragment ltext1 = new LatexFragment(latexText1, true); + cell.getParagraphs().add(ltext1); + // Add table inside page + page.getParagraphs().add(table); + // Save the document + doc.save("LatextScriptInPdf_out.pdf"); + // ExEnd:UseLatexScript + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/UseLatexScript3.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/UseLatexScript3.java new file mode 100644 index 00000000..714f8a90 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Text/UseLatexScript3.java @@ -0,0 +1,54 @@ +package com.aspose.pdf.examples.AsposePdfExamples.Text; + +import com.aspose.pdf.Document; +import com.aspose.pdf.LatexFragment; +import com.aspose.pdf.Page; +import com.aspose.pdf.examples.Utils; +import com.aspose.pdf.examples.AsposePdfExamples.StampsAndWatermarks.AddImageStampAsBackgroundInFloatingBox; + +public class UseLatexScript3 { + + + public static void main(String[] args) { + runExamples(); + } + public static void runExamples() { + // The paths to resources and output directories. + String testID = "com/aspose/pdf/examples/AsposePdf/Text/"; + String dataDir = Utils.getDataDir(testID); + String outputDir = Utils.getOutDir(testID); + + System.out.println("============================1"); + System.out.println("Example useLatexScript3 start"); + useLatexScript3(dataDir, outputDir); + System.out.println("Example useLatexScript3 end"); + } + + public static void useLatexScript3(String dataDir, String outputDir) { + + //ExStart: UseLatexScript3 + + String s = + "\\usepackage{amsmath,amsthm}" + + "\\begin{document}" + + "\\begin{proof} The proof is a follows: " + + "\\begin{align}" + + "(x+y)^3&=(x+y)(x+y)^2" + + "(x+y)(x^2+2xy+y^2)\\\\" + + "&=x^3+3x^2y+3xy^3+x^3.\\qedhere" + + "\\end{align}" + + "\\end{proof}" + + "\\end{document}"; + + Document doc = new Document(); + Page page = doc.getPages().add(); + + LatexFragment latex = new LatexFragment(s); + + page.getParagraphs().add(latex); + + doc.save(outputDir + "Script_out.pdf"); + //ExEnd: UseLatexScript3 + } + +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Utilities/Utils.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Utilities/Utils.java new file mode 100644 index 00000000..ed245b90 --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfExamples/Utilities/Utils.java @@ -0,0 +1,14 @@ +package com.aspose.pdf.examples.AsposePdfExamples.Utilities; + +import java.io.File; + +public class Utils { + public static String getDataDir() { + File dir = new File(System.getProperty("user.dir")); + dir = new File(dir, "src"); + dir = new File(dir, "main"); + dir = new File(dir, "resources"); + System.out.println("Using data directory: " + dir.toString()); + return dir.toString() + File.separator; + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfFacades/Document/SetXMPMetadataOfAnExistingPDF.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfFacades/Document/SetXMPMetadataOfAnExistingPDF.java index dda53676..6f50a988 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfFacades/Document/SetXMPMetadataOfAnExistingPDF.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfFacades/Document/SetXMPMetadataOfAnExistingPDF.java @@ -11,15 +11,15 @@ public static void main(String[] args) { // bind pdf file to the object xmpMetaData.bindPdf("input.pdf"); // add create date - xmpMetaData.setByDefaultMetadataProperties(DefaultMetadataProperties.CreateDate, new java.util.Date()); + //xmpMetaData.setByDefaultMetadataProperties(DefaultMetadataProperties.CreateDate, new java.util.Date()); // change meta data date - xmpMetaData.setByDefaultMetadataProperties(DefaultMetadataProperties.MetadataDate, new java.util.Date()); + //xmpMetaData.setByDefaultMetadataProperties(DefaultMetadataProperties.MetadataDate, new java.util.Date()); // add creator tool - xmpMetaData.setByDefaultMetadataProperties(DefaultMetadataProperties.CreatorTool, "Creator tool name"); + //xmpMetaData.setByDefaultMetadataProperties(DefaultMetadataProperties.CreatorTool, "Creator tool name"); // add Nick for MetaData - xmpMetaData.setByDefaultMetadataProperties(DefaultMetadataProperties.Nickname, "Aspose Nick"); + //xmpMetaData.setByDefaultMetadataProperties(DefaultMetadataProperties.Nickname, "Aspose Nick"); // remove modify date - xmpMetaData.remove(DefaultMetadataProperties.ModifyDate); + //xmpMetaData.removeItemByKey(DefaultMetadataProperties.ModifyDate); // add user defined property // step #1: register namespace prefix and URI xmpMetaData.registerNamespaceURI("customNamespace", "http://www.customNameSpaces.com/ns/"); diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfFacades/SecurityAndSignatures/ChangeLanguageInDigitalSignText.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfFacades/SecurityAndSignatures/ChangeLanguageInDigitalSignText.java new file mode 100644 index 00000000..7d7f19ff --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfFacades/SecurityAndSignatures/ChangeLanguageInDigitalSignText.java @@ -0,0 +1,46 @@ +package com.aspose.pdf.examples.AsposePdfFacades.SecurityAndSignatures; + +import com.aspose.pdf.PKCS7; +import com.aspose.pdf.SignatureCustomAppearance; +import com.aspose.pdf.facades.PdfFileSignature; + +import java.awt.*; +import java.util.Date; + +public class ChangeLanguageInDigitalSignText { + public static void main(String[] args) { + // ExStart:ChangeLanguageInDigitalSignText + // Path to Directory + String dataDir = "PathToDir"; + // create PdfFileSignature object and bind input PDF files + String inPfxFile = dataDir + "certificate.pfx"; + String inFile = dataDir + "input.pdf"; + String outFile = dataDir + "output.pdf"; + PdfFileSignature pdfSign = new PdfFileSignature(); + pdfSign.bindPdf(inFile); + //create a rectangle for signature location + Rectangle rect = new Rectangle(310, 45, 200, 50); + + //create any of the three signature types + PKCS7 pkcs = new PKCS7(inPfxFile, "12345"); + pkcs.setReason("Pruebas Firma"); + pkcs.setContactInfo("Contacto Pruebas"); + pkcs.setLocation("Población (Provincia)"); + pkcs.setDate(new Date()); + SignatureCustomAppearance signatureCustomAppearance = new SignatureCustomAppearance(); + signatureCustomAppearance.setDateSignedAtLabel("Fecha"); + signatureCustomAppearance.setDigitalSignedLabel("Digitalmente firmado por"); + signatureCustomAppearance.setReasonLabel("Razón"); + signatureCustomAppearance.setLocationLabel("Localización"); + signatureCustomAppearance.setFontFamilyName("Arial"); + signatureCustomAppearance.setFontSize(10d); + signatureCustomAppearance.setDateTimeFormat("yyyy.MM.dd HH:mm:ss"); + pkcs.setCustomAppearance(signatureCustomAppearance); + // sign the PDF file + pdfSign.sign(1, true, rect, pkcs); + //save output PDF file + pdfSign.save(outFile); + + // ExEnd:ChangeLanguageInDigitalSignText + } +} \ No newline at end of file diff --git a/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfFacades/SecurityAndSignatures/SuppressLocationAndReason.java b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfFacades/SecurityAndSignatures/SuppressLocationAndReason.java new file mode 100644 index 00000000..7f98224c --- /dev/null +++ b/Examples/src/main/java/com/aspose/pdf/examples/AsposePdfFacades/SecurityAndSignatures/SuppressLocationAndReason.java @@ -0,0 +1,31 @@ +package com.aspose.pdf.examples.AsposePdfFacades.SecurityAndSignatures; + +import com.aspose.pdf.PKCS1; +import com.aspose.pdf.facades.PdfFileSignature; + +import java.awt.*; +import java.io.IOException; + +public class SuppressLocationAndReason { + public static void main(String[] args) { + // ExStart:SuppressLocationAndReason + // The path to the documents directory. + String dataDir = "PathToDir"; + String inPfxFile = dataDir + "certificate.pfx"; + String inFile = dataDir + "input.pdf"; + String outFile = dataDir + "output.pdf"; + PdfFileSignature pdfSign = new PdfFileSignature(); + + pdfSign.bindPdf(inFile); + //create a rectangle for signature location + Rectangle rect = new Rectangle(100, 100, 200, 100); + + //create any of the three signature types + PKCS1 signature = new PKCS1(inPfxFile, "12345"); + // sign the PDF file + pdfSign.sign(1, "", "Contact", "", true, rect, signature); + //save output PDF file + pdfSign.save(outFile); + // ExEnd:SuppressLocationAndReason + } +} diff --git a/Examples/src/main/java/com/aspose/pdf/examples/Utils.java b/Examples/src/main/java/com/aspose/pdf/examples/Utils.java index 5ddf6f9f..c549f422 100644 --- a/Examples/src/main/java/com/aspose/pdf/examples/Utils.java +++ b/Examples/src/main/java/com/aspose/pdf/examples/Utils.java @@ -1,30 +1,121 @@ package com.aspose.pdf.examples; +import com.aspose.pdf.examples.AsposePdfExamples.Annotations.AddAnnotationToPDF; +import com.aspose.pdf.examples.AsposePdfExamples.Annotations.DeleteAllAnnotationsFromPageOfPDFFile; +import com.aspose.pdf.examples.AsposePdfExamples.Annotations.DeleteParticularAnnotationFromThePDFFile; +import com.aspose.pdf.examples.AsposePdfExamples.Annotations.GetAllAnnotationsFromPageInPDF; +import com.aspose.pdf.examples.AsposePdfExamples.Annotations.GetParticularAnnotationFromPDF; +import com.aspose.pdf.examples.AsposePdfExamples.Annotations.RedactCertainPageRegionWithRedactionAnnotation; +import com.aspose.pdf.examples.AsposePdfExamples.Annotations.StrikeOutWordsUsingStrikeOutAnnotation; +import com.aspose.pdf.examples.AsposePdfExamples.Attachments.AddAttachmentToPDF; +import com.aspose.pdf.examples.AsposePdfExamples.Attachments.DeleteAllAttachmentsFromPDF; +import com.aspose.pdf.examples.AsposePdfExamples.Attachments.DisableFilesCompressionWhenAddingAsEmbeddedResources; +import com.aspose.pdf.examples.AsposePdfExamples.Attachments.GetAttachmentInformation; +import com.aspose.pdf.examples.AsposePdfExamples.Attachments.GetAttachmentsFromPDFDocument; +import com.aspose.pdf.examples.AsposePdfExamples.Bookmarks.AddBookmarkToPDFDocument; +import com.aspose.pdf.examples.AsposePdfExamples.Bookmarks.AddChildBookmarkToPDFDocument; +import com.aspose.pdf.examples.AsposePdfExamples.Bookmarks.BookmarkShouldPointToStartOfPage; +import com.aspose.pdf.examples.AsposePdfExamples.Bookmarks.DeleteBookmarksFromPDFDocument; +import com.aspose.pdf.examples.AsposePdfExamples.Bookmarks.ExpandedBookmarksWhenViewingDocument; +import com.aspose.pdf.examples.AsposePdfExamples.Bookmarks.GetBookmarksFromPDFDocument; +import com.aspose.pdf.examples.AsposePdfExamples.Bookmarks.UpdateBookmarksInPDFDocument; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertEPUBFileToPDFFormat; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertHTMLToPDFFormat; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertPCLToPDFFormat; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertPDFFileIntoXPSFormat; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertPDFToDOCOrDOCXFormat; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertPDFToEPUBFormat; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertPDFToExcelWorkbook; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertPDFToPDFAFormat; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertPDFToSVGFormat; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertPDFToXML; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertSVGFileToPDFFormat; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertXMLFileToPDF; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ConvertXSLFOToPDF; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.CreatePDFwithTaggedText; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.PDFToEMF; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.PDFToHTMLAvoidSavingImagesInSVGFormat; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.PDFToHTMLGetWarningForFontSubstitution; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.PDFToHTMLSingleHTMLWithAllResourcesEmbedded; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.PDFToHTMLSplittingOutputToMultipageHTML; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.ValidatePDFUAStandards; +import com.aspose.pdf.examples.AsposePdfExamples.DocumentObject.AddingJavaScriptDOM; + import java.io.File; public class Utils { - public static String getDataDir(Class c) { - File dir = new File(System.getProperty("user.dir")); - dir = new File(dir, "src"); - dir = new File(dir, "main"); - dir = new File(dir, "resources"); + public static void main(String[] args) { - for (String s : c.getName().split("\\.")) { - dir = new File(dir, s); - if (dir.isDirectory() == false) - dir.mkdir(); - } + //run all examples in evaluation mode: - System.out.println("Using data directory: " + dir.toString()); - return dir.toString() + File.separator; + //AsposePdfExamples.Annotations + AddAnnotationToPDF.runExamples(); + DeleteAllAnnotationsFromPageOfPDFFile.runExamples(); + DeleteParticularAnnotationFromThePDFFile.runExamples(); + GetAllAnnotationsFromPageInPDF.runExamples(); + GetParticularAnnotationFromPDF.runExamples(); + RedactCertainPageRegionWithRedactionAnnotation.runExamples(); + StrikeOutWordsUsingStrikeOutAnnotation.runExamples(); + + //AsposePdfExamples.Attachments + AddAttachmentToPDF.runExamples(); + DeleteAllAttachmentsFromPDF.runExamples(); + DisableFilesCompressionWhenAddingAsEmbeddedResources.runExamples(); + GetAttachmentInformation.runExamples(); + GetAttachmentsFromPDFDocument.runExamples(); + + //AsposePdfExamples.Bookmarks + AddBookmarkToPDFDocument.runExamples(); + AddChildBookmarkToPDFDocument.runExamples(); + BookmarkShouldPointToStartOfPage.runExamples(); + DeleteBookmarksFromPDFDocument.runExamples(); + ExpandedBookmarksWhenViewingDocument.runExamples(); + GetBookmarksFromPDFDocument.runExamples(); + UpdateBookmarksInPDFDocument.runExamples(); + + //DocumentConversion + ConvertEPUBFileToPDFFormat.runExamples(); + ConvertHTMLToPDFFormat.runExamples(); + ConvertPCLToPDFFormat.runExamples(); + ConvertPDFFileIntoXPSFormat.runExamples(); + ConvertPDFToDOCOrDOCXFormat.runExamples(); + ConvertPDFToEPUBFormat.runExamples(); + ConvertPDFToExcelWorkbook.runExamples(); + ConvertPDFToPDFAFormat.runExamples(); + ConvertPDFToSVGFormat.runExamples(); + ConvertPDFToXML.runExamples(); + ConvertSVGFileToPDFFormat.runExamples(); + ConvertXMLFileToPDF.runExamples(); + ConvertXSLFOToPDF.runExamples(); + CreatePDFwithTaggedText.runExamples(); + PDFToEMF.runExamples(); + PDFToHTMLAvoidSavingImagesInSVGFormat.runExamples(); + PDFToHTMLGetWarningForFontSubstitution.runExamples(); + PDFToHTMLSingleHTMLWithAllResourcesEmbedded.runExamples(); + PDFToHTMLSplittingOutputToMultipageHTML.runExamples(); + ValidatePDFUAStandards.runExamples(); + + //DocumentObject + AddingJavaScriptDOM.runExamples(); + + + } + + private static File dir = null; + + public static String getDataDir(String testID) { + return getSharedDataDir() + testID; } - - public static String getSharedDataDir(Class c) { - File dir = new File(System.getProperty("user.dir")); - dir = new File(dir, "src"); - dir = new File(dir, "main"); - dir = new File(dir, "resources"); + + public static String getOutDir(String testID) { + return getSharedDataDir() + "../../../testout/" + testID; + } + + public static String getSharedDataDir() { + if (dir == null) { + dir = new File(dir, "src/main/resources/"); + } return dir.toString() + File.separator; } diff --git a/Examples/src/main/resources/DocumentConversion/EmailDemo_updated.html b/Examples/src/main/resources/DocumentConversion/EmailDemo_updated.html new file mode 100644 index 00000000..2c6ce96b --- /dev/null +++ b/Examples/src/main/resources/DocumentConversion/EmailDemo_updated.html @@ -0,0 +1,9 @@ + +
Aspose.PDF rendering Text in Black Color
+
Aspose.PDF rendering Text in Green Color
Aspose.PDF rendering Text in Blue Color
+
Aspose.PDF rendering Text in Red Color
\ No newline at end of file diff --git a/Examples/src/main/resources/DocumentConversion/ExcludeFont.pdf b/Examples/src/main/resources/DocumentConversion/ExcludeFont.pdf new file mode 100644 index 00000000..e54344df Binary files /dev/null and b/Examples/src/main/resources/DocumentConversion/ExcludeFont.pdf differ diff --git a/Examples/src/main/resources/DocumentConversion/HTMLSVG.html b/Examples/src/main/resources/DocumentConversion/HTMLSVG.html new file mode 100644 index 00000000..f026356b --- /dev/null +++ b/Examples/src/main/resources/DocumentConversion/HTMLSVG.html @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Examples/src/main/resources/DocumentConversion/HTMLToPDF.html b/Examples/src/main/resources/DocumentConversion/HTMLToPDF.html new file mode 100644 index 00000000..4ae0bcf8 --- /dev/null +++ b/Examples/src/main/resources/DocumentConversion/HTMLToPDF.html @@ -0,0 +1,26 @@ + + + + +Your Title Here + + + + + +
+ +
+ +Link Name + +is a link to another nifty site + +

This is a Header

+ +

This is a Medium Header

+
+ + + + \ No newline at end of file diff --git a/Examples/src/main/resources/DocumentConversion/PDFJAVA-39123.pdf b/Examples/src/main/resources/DocumentConversion/PDFJAVA-39123.pdf new file mode 100644 index 00000000..cd134000 Binary files /dev/null and b/Examples/src/main/resources/DocumentConversion/PDFJAVA-39123.pdf differ diff --git a/Examples/src/main/resources/DocumentConversion/input2.pdf b/Examples/src/main/resources/DocumentConversion/input2.pdf new file mode 100644 index 00000000..4b326291 Binary files /dev/null and b/Examples/src/main/resources/DocumentConversion/input2.pdf differ diff --git a/Examples/src/main/resources/Images/0002.DCM b/Examples/src/main/resources/Images/0002.DCM new file mode 100644 index 00000000..76cea0c3 Binary files /dev/null and b/Examples/src/main/resources/Images/0002.DCM differ diff --git a/Examples/src/main/resources/Stamps-Watermarks/aspose-logo.jpg b/Examples/src/main/resources/Stamps-Watermarks/aspose-logo.jpg new file mode 100644 index 00000000..34575641 Binary files /dev/null and b/Examples/src/main/resources/Stamps-Watermarks/aspose-logo.jpg differ diff --git a/Examples/src/main/resources/Stamps-Watermarks/test.pdf b/Examples/src/main/resources/Stamps-Watermarks/test.pdf new file mode 100644 index 00000000..850e56f9 Binary files /dev/null and b/Examples/src/main/resources/Stamps-Watermarks/test.pdf differ diff --git a/Examples/src/main/resources/TaggedPDFs/AddStructureElementIntoElement_Output.pdf b/Examples/src/main/resources/TaggedPDFs/AddStructureElementIntoElement_Output.pdf new file mode 100644 index 00000000..00f6165e Binary files /dev/null and b/Examples/src/main/resources/TaggedPDFs/AddStructureElementIntoElement_Output.pdf differ diff --git a/Examples/src/main/resources/TaggedPDFs/CreateNoteStructureElement.pdf b/Examples/src/main/resources/TaggedPDFs/CreateNoteStructureElement.pdf new file mode 100644 index 00000000..b994fc2d Binary files /dev/null and b/Examples/src/main/resources/TaggedPDFs/CreateNoteStructureElement.pdf differ diff --git a/Examples/src/main/resources/TaggedPDFs/CreateTableElement.pdf b/Examples/src/main/resources/TaggedPDFs/CreateTableElement.pdf new file mode 100644 index 00000000..adb9bfa4 Binary files /dev/null and b/Examples/src/main/resources/TaggedPDFs/CreateTableElement.pdf differ diff --git a/Examples/src/main/resources/TaggedPDFs/LinkStructureElements_Output.pdf b/Examples/src/main/resources/TaggedPDFs/LinkStructureElements_Output.pdf new file mode 100644 index 00000000..e69de29b diff --git a/Examples/src/main/resources/TaggedPDFs/PDFwithTaggedImage.pdf b/Examples/src/main/resources/TaggedPDFs/PDFwithTaggedImage.pdf new file mode 100644 index 00000000..69da1643 Binary files /dev/null and b/Examples/src/main/resources/TaggedPDFs/PDFwithTaggedImage.pdf differ diff --git a/Examples/src/main/resources/TaggedPDFs/PDFwithTaggedText.pdf b/Examples/src/main/resources/TaggedPDFs/PDFwithTaggedText.pdf new file mode 100644 index 00000000..f9aed401 Binary files /dev/null and b/Examples/src/main/resources/TaggedPDFs/PDFwithTaggedText.pdf differ diff --git a/Examples/src/main/resources/TaggedPDFs/StructureElements.pdf b/Examples/src/main/resources/TaggedPDFs/StructureElements.pdf new file mode 100644 index 00000000..550d2209 Binary files /dev/null and b/Examples/src/main/resources/TaggedPDFs/StructureElements.pdf differ diff --git a/Examples/src/main/resources/TaggedPDFs/StyleTableCell.pdf b/Examples/src/main/resources/TaggedPDFs/StyleTableCell.pdf new file mode 100644 index 00000000..6f4875eb Binary files /dev/null and b/Examples/src/main/resources/TaggedPDFs/StyleTableCell.pdf differ diff --git a/Examples/src/main/resources/TaggedPDFs/StyleTableElement.pdf b/Examples/src/main/resources/TaggedPDFs/StyleTableElement.pdf new file mode 100644 index 00000000..7e57a4c4 Binary files /dev/null and b/Examples/src/main/resources/TaggedPDFs/StyleTableElement.pdf differ diff --git a/Examples/src/main/resources/TaggedPDFs/aspose-logo.jpg b/Examples/src/main/resources/TaggedPDFs/aspose-logo.jpg new file mode 100644 index 00000000..34575641 Binary files /dev/null and b/Examples/src/main/resources/TaggedPDFs/aspose-logo.jpg differ diff --git a/Examples/src/main/resources/TaggedPDFs/google-icon-512.png b/Examples/src/main/resources/TaggedPDFs/google-icon-512.png new file mode 100644 index 00000000..8a4c8a88 Binary files /dev/null and b/Examples/src/main/resources/TaggedPDFs/google-icon-512.png differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/AddingJavaScriptDOM/PdfWithAcroForm.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/AddingJavaScriptDOM/PdfWithAcroForm.pdf new file mode 100644 index 00000000..9577504b Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/AddingJavaScriptDOM/PdfWithAcroForm.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Annotations/StrikeOutWordsUsingStrikeOutAnnotation/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Annotations/StrikeOutWordsUsingStrikeOutAnnotation/input.pdf new file mode 100644 index 00000000..8345a2d9 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Annotations/StrikeOutWordsUsingStrikeOutAnnotation/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Annotations/redactCertainPageRegionWithRedactionAnnotation/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Annotations/redactCertainPageRegionWithRedactionAnnotation/input.pdf new file mode 100644 index 00000000..8345a2d9 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Annotations/redactCertainPageRegionWithRedactionAnnotation/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Attachments/addattachment/test.txt b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Attachments/addattachment/test.txt index d040f219..6d885204 100644 --- a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Attachments/addattachment/test.txt +++ b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Attachments/addattachment/test.txt @@ -1 +1 @@ -Aspose.Pdf for .NET \ No newline at end of file +Aspose.PDF for Java \ No newline at end of file diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/bookmarkShouldPointToStartOfPage/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/bookmarkShouldPointToStartOfPage/input.pdf new file mode 100644 index 00000000..089be934 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/bookmarkShouldPointToStartOfPage/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/deleteallbookmarks/source.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/deleteallbookmarks/source.pdf new file mode 100644 index 00000000..089be934 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/deleteallbookmarks/source.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/deleteallbookmarks/output.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/expandedBookmarksWhenViewingDocument/input.pdf similarity index 60% rename from Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/deleteallbookmarks/output.pdf rename to Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/expandedBookmarksWhenViewingDocument/input.pdf index bc1f47ee..1d0c3b5e 100644 Binary files a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/deleteallbookmarks/output.pdf and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Bookmarks/expandedBookmarksWhenViewingDocument/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/PDFUAStandards/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/PDFUAStandards/input.pdf new file mode 100644 index 00000000..8924ce4e Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/PDFUAStandards/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/htmltopdf/EmailDemo_updated.html b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/htmltopdf/EmailDemo_updated.html new file mode 100644 index 00000000..2c6ce96b --- /dev/null +++ b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/htmltopdf/EmailDemo_updated.html @@ -0,0 +1,9 @@ + +
Aspose.PDF rendering Text in Black Color
+
Aspose.PDF rendering Text in Green Color
Aspose.PDF rendering Text in Blue Color
+
Aspose.PDF rendering Text in Red Color
\ No newline at end of file diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/htmltopdf/HTMLSVG.html b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/htmltopdf/HTMLSVG.html new file mode 100644 index 00000000..f026356b --- /dev/null +++ b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/htmltopdf/HTMLSVG.html @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/htmltopdf/HTMLToPDF.html b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/htmltopdf/HTMLToPDF.html new file mode 100644 index 00000000..4ae0bcf8 --- /dev/null +++ b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/htmltopdf/HTMLToPDF.html @@ -0,0 +1,26 @@ + + + + +Your Title Here + + + + + +
+ +
+ +Link Name + +is a link to another nifty site + +

This is a Header

+ +

This is a Medium Header

+
+ + + + \ No newline at end of file diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftodoc/input2.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftodoc/input2.pdf new file mode 100644 index 00000000..91a75caf Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftodoc/input2.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftodoc/source.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftodoc/source.pdf new file mode 100644 index 00000000..39aa09da Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftodoc/source.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoemf/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoemf/input.pdf new file mode 100644 index 00000000..04b17d43 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoemf/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/ExcludeFont.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/ExcludeFont.pdf new file mode 100644 index 00000000..e54344df Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/ExcludeFont.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/ExcludeFontResourcesWithAdditionalOptions.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/ExcludeFontResourcesWithAdditionalOptions.pdf new file mode 100644 index 00000000..cd134000 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/ExcludeFontResourcesWithAdditionalOptions.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/SampleDataTable.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/SampleDataTable.pdf new file mode 100644 index 00000000..91a75caf Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/SampleDataTable.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/input1.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/input1.pdf new file mode 100644 index 00000000..b72f8ef9 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/input1.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/input2.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/input2.pdf new file mode 100644 index 00000000..4b326291 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftohtml/input2.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftomobixml/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftomobixml/input.pdf new file mode 100644 index 00000000..12eecede Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftomobixml/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftopdfa/attachment.xml b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftopdfa/attachment.xml new file mode 100644 index 00000000..1d1ebabb --- /dev/null +++ b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftopdfa/attachment.xml @@ -0,0 +1,3 @@ + +test + \ No newline at end of file diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftopptx/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftopptx/input.pdf new file mode 100644 index 00000000..04b17d43 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftopptx/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftosvg/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftosvg/input.pdf new file mode 100644 index 00000000..04b17d43 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftosvg/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxls/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxls/input.pdf new file mode 100644 index 00000000..12eecede Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxls/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxlsx/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxlsx/input.pdf new file mode 100644 index 00000000..12eecede Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxlsx/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxml/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxml/input.pdf new file mode 100644 index 00000000..67b7360d Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxml/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxps/input.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxps/input.pdf new file mode 100644 index 00000000..4b326291 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftoxps/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pstopdf/input.ps b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pstopdf/input.ps new file mode 100644 index 00000000..d3e1d0e0 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pstopdf/input.ps differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/texttopdf/test.txt b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/texttopdf/test.txt new file mode 100644 index 00000000..b6bca5cb --- /dev/null +++ b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/texttopdf/test.txt @@ -0,0 +1,3 @@ +Aspose.PDF for Java +Aspose.PDF for Java +Aspose.PDF for Java \ No newline at end of file diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/xmltopdf/Source.xml b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/xmltopdf/Source.xml new file mode 100644 index 00000000..ddff160a --- /dev/null +++ b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/xmltopdf/Source.xml @@ -0,0 +1,7 @@ + + + +segment1 +segment2 + + \ No newline at end of file diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdfGenerator/Conversion/xslfotopdf/test.fo b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/xslfotopdf/test.fo similarity index 100% rename from Examples/src/main/resources/com/aspose/pdf/examples/AsposePdfGenerator/Conversion/xslfotopdf/test.fo rename to Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/xslfotopdf/test.fo diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Document/Aspose_End-User-License-Agreement_2017-01-09.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Document/Aspose_End-User-License-Agreement_2017-01-09.pdf new file mode 100644 index 00000000..c89deaa4 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Document/Aspose_End-User-License-Agreement_2017-01-09.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/CustomTag.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/CustomTag.pdf new file mode 100644 index 00000000..d5a95006 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/CustomTag.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/IllustrationStructureElements.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/IllustrationStructureElements.pdf new file mode 100644 index 00000000..e69de29b diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/InlineStructureElements.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/InlineStructureElements.pdf new file mode 100644 index 00000000..1c663e42 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/InlineStructureElements.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/StructureElements.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/StructureElements.pdf new file mode 100644 index 00000000..65f8306b Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/StructureElements.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/StructureElementsProperties.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/StructureElementsProperties.pdf new file mode 100644 index 00000000..1f9f18ff Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/StructureElementsProperties.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/StructureElementsTree.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/StructureElementsTree.pdf new file mode 100644 index 00000000..1fd649f6 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/StructureElementsTree.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/TaggedPDFContent.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/TaggedPDFContent.pdf new file mode 100644 index 00000000..b4194bfb Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/TaggedPDFContent.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/TextBlockStructureElements.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/TextBlockStructureElements.pdf new file mode 100644 index 00000000..b3641e22 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/TextBlockStructureElements.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/TextStructureElement.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/TextStructureElement.pdf new file mode 100644 index 00000000..5b2abc4d Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Documents/taggedPDF/TextStructureElement.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Text/defaultFontWhenSpecificFontMissing/input1.pdf b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Text/defaultFontWhenSpecificFontMissing/input1.pdf new file mode 100644 index 00000000..b72f8ef9 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Text/defaultFontWhenSpecificFontMissing/input1.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdfGenerator/CreatePDFwithTaggedImage/aspose-logo.jpg b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdfGenerator/CreatePDFwithTaggedImage/aspose-logo.jpg new file mode 100644 index 00000000..34575641 Binary files /dev/null and b/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdfGenerator/CreatePDFwithTaggedImage/aspose-logo.jpg differ diff --git a/LICENSE b/LICENSE index f83cc4c8..cfd30602 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2001-2016 Aspose Pty Ltd +Copyright (c) 2001-2025 Aspose Pty Ltd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipseFeature/feature.xml b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipseFeature/feature.xml index b4c703aa..0c24b642 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipseFeature/feature.xml +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipseFeature/feature.xml @@ -1,29 +1,29 @@ - Aspose.Pdf Maven Project wizard creates Maven Project for using -Aspose.Pdf for Java API within Eclipse IDE. -Aspose.Pdf for Java is a robust PDF document creation API that + Aspose.PDF Maven Project wizard creates Maven Project for using +Aspose.PDF for Java API within Eclipse IDE. +Aspose.PDF for Java is a robust PDF document creation API that enables your Java applications to read, write and manipulate PDF documents without using Adobe Acrobat. -Aspose.Pdf for Java offers an incredible wealth of features, +Aspose.PDF for Java offers an incredible wealth of features, these include: PDF compression options, table creation and manipulation, graph support, image functions, extensive hyperlink functionality, extended security controls and custom font handling. -Aspose.Pdf Maven Project wizard fetch and configures the latest -Maven dependency reference of Aspose.Pdf for Java from the Aspose +Aspose.PDF Maven Project wizard fetch and configures the latest +Maven dependency reference of Aspose.PDF for Java from the Aspose Cloud Maven Repository. The wizard also gives you option to download the Code Examples -to use Aspose.Pdf for Java API. +to use Aspose.PDF for Java API. Once you are finished with this wizard - created Maven project and downloaded Code Examples, next you can insert those Code -Examples to use Aspose.Pdf for Java API in your Project from -File -> New -> Other -> Aspose.Pdf Code Example +Examples to use Aspose.PDF for Java API in your Project from +File -> New -> Other -> Aspose.PDF Code Example The newly created project and the Code Examples you added is now ready to be enhanced, all required resources and references are also automatically added. @@ -31,7 +31,7 @@ are also automatically added. The MIT License (MIT) -Copyright (c) 2001-2016 Aspose Pty Ltd +Copyright (c) 2001-2020 Aspose Pty Ltd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: @@ -40,11 +40,15 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/.classpath b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/.classpath index b1dabee3..b862a296 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/.classpath +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/.classpath @@ -1,6 +1,6 @@ - + diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/.settings/org.eclipse.jdt.core.prefs b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/.settings/org.eclipse.jdt.core.prefs index 11f6e462..295926d9 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/.settings/org.eclipse.jdt.core.prefs +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/build.properties b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/build.properties index bad26144..9e670b05 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/build.properties +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/build.properties @@ -4,4 +4,3 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ resources/ - diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/plugin.xml b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/plugin.xml index b7abba2e..08122636 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/plugin.xml +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/plugin.xml @@ -8,7 +8,7 @@ class="com.aspose.pdf.maven.AsposeMavenProjectWizard" icon="resources/Aspose.png" id="asposeplugin.wizard.new.mavenprojectwizard" - name="Aspose.Pdf Maven Project" + name="Aspose.PDF Maven Project" project="true"> diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/resources/pom-xml-template.txt b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/resources/pom-xml-template.txt index e5aa7d6b..3a496db3 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/resources/pom-xml-template.txt +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/resources/pom-xml-template.txt @@ -9,7 +9,7 @@ Aspose-Maven-Repository Aspose Maven Repository - http://maven.aspose.com/artifactory/simple/ext-release-local/ + https://repository.aspose.com/repo/ diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/AsposeMavenProjectWizard.java b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/AsposeMavenProjectWizard.java index d73d799d..7eb9cdb8 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/AsposeMavenProjectWizard.java +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/AsposeMavenProjectWizard.java @@ -23,7 +23,7 @@ public class AsposeMavenProjectWizard extends Wizard implements INewWizard { private AsposeMavenProjectWizardPage wizardPage; public AsposeMavenProjectWizard() { - setWindowTitle("Aspose.Pdf Maven Project"); + setWindowTitle("Aspose.PDF Maven Project"); } @Override diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/AsposeMavenProjectWizardPage.java b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/AsposeMavenProjectWizardPage.java index 137ca57e..70bdd454 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/AsposeMavenProjectWizardPage.java +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/AsposeMavenProjectWizardPage.java @@ -358,7 +358,7 @@ public void modifyText(ModifyEvent e) { chkDownloadExamples = new Button(container, SWT.CHECK); chkDownloadExamples.setBounds(5, 325, 492, 16); - chkDownloadExamples.setText("Also Download Code Examples (for using Aspose.Pdf for Java)"); + chkDownloadExamples.setText("Also Download Code Examples (for using Aspose.PDF for Java)"); Label lblNewLabel_1 = new Label(container, SWT.NONE); lblNewLabel_1.setBounds(443, 296, 55, 15); diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleSupport.java b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleSupport.java index ef5d8c80..064bbb42 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleSupport.java +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleSupport.java @@ -34,9 +34,9 @@ public class AsposeExampleSupport implements IRunnableWithProgress { private String exampleCategory; private IProject project; - final static String localExampleFolder = "aspose/GitConsRepos/Aspose.Pdf/Examples"; + final static String localExampleFolder = "aspose/GitConsRepos/Aspose.PDF/Examples"; final static String localExampleSourceFolder = "src/main/java/com/aspose/pdf/examples"; - final static String localExampleResourceFolder = "src/main/resources/com/aspose/pdf/examples"; + final static String localExampleResourceFolder = "src/main/resources/com/aspose/pdf/examples"; public AsposeExampleSupport(String selectedProjectPath, String exampleCategory, IProject project) { this.selectedProjectPath = selectedProjectPath; @@ -74,9 +74,15 @@ public void createExample() { + File.separator + AsposeConstants.MAVEN_POM_XML; try { - FileUtils.copyDirectory(srcExampleCategoryPath, destExampleCategoryPath); - Files.copy(srcUtil, destUtil, StandardCopyOption.REPLACE_EXISTING); - FileUtils.copyDirectory(srcExampleResourceCategoryPath, destExampleResourceCategoryPath); + if(srcExampleCategoryPath.exists()) { + FileUtils.copyDirectory(srcExampleCategoryPath, destExampleCategoryPath); + } + if(srcUtil.toFile().exists()) { + Files.copy(srcUtil, destUtil, StandardCopyOption.REPLACE_EXISTING); + } + if(srcExampleResourceCategoryPath.exists()) { + FileUtils.copyDirectory(srcExampleResourceCategoryPath, destExampleResourceCategoryPath); + } NodeList examplesNoneAsposeDependencies = AsposeMavenProjectManager.getInstance() .getDependenciesFromPOM(repositoryPOM_XML, AsposeConstants.ASPOSE_GROUP_ID); diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleWizard.java b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleWizard.java index 846be80f..4415bd29 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleWizard.java +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleWizard.java @@ -11,9 +11,7 @@ */ package com.aspose.pdf.maven.examples; -import java.io.File; import java.lang.reflect.InvocationTargetException; - import org.eclipse.core.resources.IProject; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.viewers.IStructuredSelection; @@ -26,7 +24,7 @@ public class AsposeExampleWizard extends Wizard implements INewWizard { private AsposeExampleWizardPage wizardPage; public AsposeExampleWizard() { - setWindowTitle("Aspose.Pdf Code Example"); + setWindowTitle("Aspose.PDF Code Example"); } @Override diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleWizardPage.java b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleWizardPage.java index 2707d9f6..b285c84c 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleWizardPage.java +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/examples/AsposeExampleWizardPage.java @@ -59,8 +59,8 @@ public class AsposeExampleWizardPage extends WizardPage { */ public AsposeExampleWizardPage() { super("wizardPage"); - setTitle("New Aspose.Pdf Code Example"); - setDescription("Aspose.Pdf Java API - Code Examples"); + setTitle("New Aspose.PDF Code Example"); + setDescription("Aspose.PDF Java API - Code Examples"); } public IProject getIProject() { @@ -224,7 +224,7 @@ public void populateExamplesTree(AsposeJavaAPI asposeComponent) { Queue queue = new LinkedList<>(); queue.add(new Object[] { null, directory }); TreeItem top = new TreeItem(examplesTree, 0); - top.setText("Aspose.Pdf"); + top.setText("Aspose.PDF"); while (!queue.isEmpty()) { Object[] _entry = queue.remove(); @@ -286,7 +286,7 @@ public void widgetSelected(SelectionEvent e) { Label lblAsposepdfForJava = new Label(container, SWT.NONE); lblAsposepdfForJava.setBounds(5, 131, 170, 15); - lblAsposepdfForJava.setText("Aspose.Pdf for Java (version):"); + lblAsposepdfForJava.setText("Aspose.PDF for Java (version):"); cbVersion = new Combo(container, SWT.READ_ONLY); cbVersion.addModifyListener(new ModifyListener() { diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposeConstants.java b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposeConstants.java index fa2aa7af..4a4e3472 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposeConstants.java +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposeConstants.java @@ -25,7 +25,7 @@ public class AsposeConstants { /** * */ - public static final String API_NAME = "Aspose.Pdf"; + public static final String API_NAME = "Aspose.PDF"; /** * @@ -77,7 +77,7 @@ public class AsposeConstants { /** * */ - public static final String WIZARD_NAME = "Aspose.Pdf Maven Project"; + public static final String WIZARD_NAME = "Aspose.PDF Maven Project"; /** * @@ -92,7 +92,7 @@ public class AsposeConstants { /** * */ - public static final String ASPOSE_MAVEN_REPOSITORY = "http://maven.aspose.com"; + public static final String ASPOSE_MAVEN_REPOSITORY = "https://repository.aspose.com"; /** * @@ -102,7 +102,7 @@ public class AsposeConstants { /** * */ - public static final String INTERNET_REQUIRED_MSG = "Internet connectivity is not available!\nInternet connectivity is required to retrieve latest Aspose.Pdf Maven Artifact"; + public static final String INTERNET_REQUIRED_MSG = "Internet connectivity is not available!\nInternet connectivity is required to retrieve latest Aspose.PDF Maven Artifact"; /** * @@ -112,12 +112,12 @@ public class AsposeConstants { /** * */ - public static final String MAVEN_ARTIFACTS_RETRIEVE_FAIL = "Unknown Error!\nCould not retrieve latest Aspose.Pdf Maven Artifact!"; + public static final String MAVEN_ARTIFACTS_RETRIEVE_FAIL = "Unknown Error!\nCould not retrieve latest Aspose.PDF Maven Artifact!"; /** * */ - public static final String EXAMPLES_DOWNLOAD_FAIL = "Unknown Error!\nCould not download Aspose.Pdf for Java API example Source codes!"; + public static final String EXAMPLES_DOWNLOAD_FAIL = "Unknown Error!\nCould not download Aspose.PDF for Java API example Source codes!"; /** * diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposeMavenProjectManager.java b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposeMavenProjectManager.java index 92ae6a5b..54656e19 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposeMavenProjectManager.java +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposeMavenProjectManager.java @@ -23,9 +23,6 @@ import java.util.ArrayList; import java.util.List; import javax.swing.JOptionPane; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -35,7 +32,6 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; @@ -45,9 +41,9 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; import org.xml.sax.SAXException; import com.aspose.pdf.maven.artifacts.Metadata; -import com.aspose.pdf.maven.artifacts.ObjectFactory; public class AsposeMavenProjectManager { @@ -314,16 +310,27 @@ public String readURLContents(String Url) throws IOException { */ public Metadata getProductMavenDependency(String productMavenRepositoryUrl) { final String mavenMetaDataFileName = "maven-metadata.xml"; - Metadata data = null; + Metadata data = new Metadata(); try { String productMavenInfo; productMavenInfo = readURLContents(productMavenRepositoryUrl + mavenMetaDataFileName); - JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class); - Unmarshaller unmarshaller; - unmarshaller = jaxbContext.createUnmarshaller(); - - data = (Metadata) unmarshaller.unmarshal(new StreamSource(new StringReader(productMavenInfo))); + + DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = dBuilder.parse(new InputSource(new StringReader(productMavenInfo))); + + String groupId = XPathFactory.newInstance().newXPath().compile("//metadata/groupId").evaluate(doc); + String artifactId = XPathFactory.newInstance().newXPath().compile("//metadata/artifactId").evaluate(doc); + String version = XPathFactory.newInstance().newXPath().compile("//metadata/version").evaluate(doc); + String latest = XPathFactory.newInstance().newXPath().compile("//metadata/versioning/latest").evaluate(doc); + + data.setArtifactId(artifactId); + data.setGroupId(groupId); + data.setVersion(version); + + Metadata.Versioning ver = new Metadata.Versioning(); + ver.setLatest(latest); + data.setVersioning(ver); String remoteArtifactFile = productMavenRepositoryUrl + data.getVersioning().getLatest() + "/" + data.getArtifactId() + "-" + data.getVersioning().getLatest(); @@ -334,7 +341,7 @@ public Metadata getProductMavenDependency(String productMavenRepositoryUrl) { } else { AsposeConstants.println("Exists"); } - } catch (IOException | JAXBException ex) { + } catch (Exception ex) { ex.printStackTrace(); data = null; } diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposePdfJavaAPI.java b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposePdfJavaAPI.java index 9def4249..fe88d337 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposePdfJavaAPI.java +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/AsposePdfJavaAPI.java @@ -24,8 +24,8 @@ public class AsposePdfJavaAPI extends AsposeJavaAPI { private final String _name = AsposeConstants.API_NAME; - private final String _mavenRepositoryURL = "http://maven.aspose.com/repository/ext-release-local/com/aspose/aspose-pdf/"; - private final String _remoteExamplesRepository = "https://github.com/asposepdf/Aspose_Pdf_Java"; + private final String _mavenRepositoryURL = "https://repository.aspose.com/repo/com/aspose/aspose-pdf/"; + private final String _remoteExamplesRepository = "https://github.com/aspose-pdf/Aspose.PDF-for-Java"; /** * @return the _name diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/GitHelper.java b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/GitHelper.java index 0d96c7f2..2aca1bc7 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/GitHelper.java +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipsePlugin/src/com/aspose/pdf/maven/utils/GitHelper.java @@ -14,6 +14,7 @@ * @author Adeel Ilyas * */ +@SuppressWarnings("restriction") public class GitHelper { /** diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipseSite/site.xml b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipseSite/site.xml index d1a80d35..bae51508 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipseSite/site.xml +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/AsposePdfEclipseSite/site.xml @@ -1,14 +1,14 @@ - - Aspose.Pdf Maven Project wizard creates Maven Project for using Aspose.Pdf for Java API within Eclipse IDE. -Aspose.Pdf for Java is a robust PDF document creation API that enables your Java applications to read, write and manipulate PDF documents without using Adobe Acrobat. -Aspose.Pdf for Java offers an incredible wealth of features, these include: PDF compression options, table creation and manipulation, graph support, image functions, extensive hyperlink functionality, extended security controls and custom font handling. -Aspose.Pdf Maven Project wizard fetch and configures the latest Maven dependency reference of Aspose.Pdf for Java from the Aspose Cloud Maven Repository. -The wizard also gives you option to download the Code Examples to use Aspose.Pdf for Java API. + + Aspose.PDF Maven Project wizard creates Maven Project for using Aspose.PDF for Java API within Eclipse IDE. +Aspose.PDF for Java is a robust PDF document creation API that enables your Java applications to read, write and manipulate PDF documents without using Adobe Acrobat. +Aspose.PDF for Java offers an incredible wealth of features, these include: PDF compression options, table creation and manipulation, graph support, image functions, extensive hyperlink functionality, extended security controls and custom font handling. +Aspose.PDF Maven Project wizard fetch and configures the latest Maven dependency reference of Aspose.PDF for Java from the Aspose Cloud Maven Repository. +The wizard also gives you option to download the Code Examples to use Aspose.PDF for Java API. - + - + diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/LICENSE b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/LICENSE index f83cc4c8..6d2e255f 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/LICENSE +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2001-2016 Aspose Pty Ltd +Copyright (c) 2001-2020 Aspose Pty Ltd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/README.md b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/README.md index 9be4d35a..857454ef 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/README.md +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/README.md @@ -25,7 +25,7 @@ The plugin provides following features to work with [Aspose.PDF for Java](http:/ ### Other Features -* Supports latest **Eclipse Mars.1 (4.5.1)** version +* Supports **Eclipse Mars.1 (4.5.1) and later** versions * Compatible with **Mac**, **Linux Flavors** and **Windows** * Native IDE user experience * Open Source diff --git a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/Release Notes.html b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/Release Notes.html index b5c14fd5..f757bac6 100644 --- a/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/Release Notes.html +++ b/Plugins/Aspose_Pdf_Java_Maven_for_Eclipse/Release Notes.html @@ -6,12 +6,12 @@ -Aspose.Pdf Java (Maven) for Eclipse - v1.0 +Aspose.Pdf Java (Maven) for Eclipse - v20.10

This is new Plugin for Eclipse IDE by Aspose. The Plugin intended for developers using Maven platform for Java developments and want to use Aspose.Pdf for Java in their projects.

NOTE: Aspose.Pdf for Java is Java API developed by Aspose that enables your Java applications to read, write and manipulate PDF documents without using Adobe Acrobat. For the API detailed features list check the link.

The plugin provides following features to work with Aspose.Pdf for Java API within Eclipse IDE comfortably:

  • Aspose.Pdf Maven Project
    • By using this wizard plugin creates Maven project for using Aspose.Pdf for Java from New -> Project -> Maven-> Aspose.Pdf Maven Project
    • The wizard will also give option for downloading latest available Code Examples for using the API.
  • Aspose.Pdf Code Example
  • -
  • Other Features
    • Supports latest Eclipse Mars.1 (4.5.1) version
    • Compatible with Mac, Linux Flavors and Windows
    • Native IDE user experience
    • Open Source
+
  • Other Features
    • Supports Eclipse Mars.1 (4.5.1) and later versions
    • Compatible with Mac, Linux Flavors and Windows
    • Native IDE user experience
    • Open Source
  • \ No newline at end of file diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToDoc.py b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToDoc.py new file mode 100644 index 00000000..95fee30e --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToDoc.py @@ -0,0 +1,21 @@ +# Import module +import string + +import jpype.imports + + +# Launch the JVM with adding aspose.pdf-22.5.jar in classpath +jpype.startJVM(classpath=['jars/aspose.pdf-22.5.jar']) + +# import the Java modules +from com.aspose.pdf import Document +from com.aspose.pdf import BuildVersionInfo +from com.aspose.pdf import SaveFormat + +name = "converters/pdftodoc/input" +inputPath = "testdata/" + name + ".pdf" +doc = Document(inputPath) +output = "testout/" + name + str(BuildVersionInfo.FileVersion) + ".doc" +doc.save(output, SaveFormat.Doc) + +print('Document has been converted in: ' + output) diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToDocx.py b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToDocx.py new file mode 100644 index 00000000..0a0e86c7 --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToDocx.py @@ -0,0 +1,21 @@ +# Import module +import string + +import jpype.imports + + +# Launch the JVM with adding aspose.pdf-22.5.jar in classpath +jpype.startJVM(classpath=['jars/aspose.pdf-22.5.jar']) + +# import the Java modules +from com.aspose.pdf import Document +from com.aspose.pdf import BuildVersionInfo +from com.aspose.pdf import SaveFormat + +name = "converters/pdftodoc/input" +inputPath = "testdata/" + name + ".pdf" +doc = Document(inputPath) +output = "testout/" + name + str(BuildVersionInfo.FileVersion) + ".docx" +doc.save(output, SaveFormat.DocX) + +print('Document has been converted in: ' + output) diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToEPUB.py b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToEPUB.py new file mode 100644 index 00000000..ab234fa1 --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToEPUB.py @@ -0,0 +1,23 @@ +# Import module +import string + +import jpype.imports + + +# Launch the JVM with adding aspose.pdf-22.5.jar in classpath +jpype.startJVM(classpath=['jars/aspose.pdf-22.5.jar']) + +# import the Java modules +from com.aspose.pdf import Document +from com.aspose.pdf import BuildVersionInfo +from com.aspose.pdf import EpubSaveOptions + +name = "converters/pdftoepub/input" +inputPath = "testdata/" + name + ".pdf" +doc = Document(inputPath) +options = EpubSaveOptions() +options.setContentRecognitionMode(EpubSaveOptions.RecognitionMode.Flow) +output = "testout/" + name + str(BuildVersionInfo.FileVersion) + "_.epub" +doc.save(output, options) + +print('Document has been converted in: ' + output) diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToPPTX.py b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToPPTX.py new file mode 100644 index 00000000..52a389e5 --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToPPTX.py @@ -0,0 +1,22 @@ +# Import module +import string + +import jpype.imports + + +# Launch the JVM with adding aspose.pdf-22.5.jar in classpath +jpype.startJVM(classpath=['jars/aspose.pdf-22.5.jar']) + +# import the Java modules +from com.aspose.pdf import Document +from com.aspose.pdf import BuildVersionInfo +from com.aspose.pdf import PptxSaveOptions + +name = "converters/pdftopptx/input" +inputPath = "testdata/" + name + ".pdf" +doc = Document(inputPath) +options = PptxSaveOptions() +output = "testout/" + name + str(BuildVersionInfo.FileVersion) + ".pptx" +doc.save(output, options) + +print('Document has been converted in: ' + output) diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToSVG.py b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToSVG.py new file mode 100644 index 00000000..7b6441c6 --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToSVG.py @@ -0,0 +1,23 @@ +# Import module +import string + +import jpype.imports + + +# Launch the JVM with adding aspose.pdf-22.5.jar in classpath +jpype.startJVM(classpath=['jars/aspose.pdf-22.5.jar']) + +# import the Java modules +from com.aspose.pdf import Document +from com.aspose.pdf import BuildVersionInfo +from com.aspose.pdf import SvgSaveOptions + +name = "converters/pdftosvg/input" +inputPath = "testdata/" + name + ".pdf" +doc = Document(inputPath) +options = SvgSaveOptions() +options.setCompressOutputToZipArchive(False); +output = "testout/" + name + str(BuildVersionInfo.FileVersion) + ".svg" +doc.save(output, options) + +print('Document has been converted in: ' + output) diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToXPS.py b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToXPS.py new file mode 100644 index 00000000..1aba1584 --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/ConvertToXPS.py @@ -0,0 +1,27 @@ +# Import module +import string + +import jpype.imports + + +# Launch the JVM with adding aspose.pdf-22.5.jar in classpath +jpype.startJVM(classpath=['jars/aspose.pdf-22.5.jar']) + +# import the Java modules +from com.aspose.pdf import Document +from com.aspose.pdf import BuildVersionInfo +from com.aspose.pdf import XpsSaveOptions +# from com.aspose.pdf import License +# +# licenseInstance = License() +# licenseInstance.setLicense("testdata/License/Aspose.PDF.Java.lic") + +name = "converters/pdftoxps/input" +inputPath = "testdata/" + name + ".pdf" +doc = Document(inputPath) +options = XpsSaveOptions() +options.setSaveTransparentTexts(True) +output = "testout/" + name + str(BuildVersionInfo.FileVersion) + "_lic.xps" +doc.save(output, options) + +print('Document has been converted in: ' + output) diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/LicenseInitialisation.py b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/LicenseInitialisation.py new file mode 100644 index 00000000..105e1d1c --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/LicenseInitialisation.py @@ -0,0 +1,17 @@ +# Import module +import string + +import jpype.imports + +# Launch the JVM with adding aspose.pdf-22.5.jar in classpath +jpype.startJVM(classpath=['jars/aspose.pdf-22.5.jar']) + +# import the Java modules +from com.aspose.pdf import Document +from com.aspose.pdf import License + +licenseInstance = License() +licenseInstance.setLicense("testdata/aspose.PDF.Java.lic") +print('Document is licensed? : ' + str(Document.isLicensed())) + + diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/__pycache__/LicenseInitialisation.cpython-38.pyc b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/__pycache__/LicenseInitialisation.cpython-38.pyc new file mode 100644 index 00000000..a3c8257d Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/__pycache__/LicenseInitialisation.cpython-38.pyc differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/jars/aspose.pdf-22.5.jar b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/jars/aspose.pdf-22.5.jar new file mode 100644 index 00000000..18dc6153 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/jars/aspose.pdf-22.5.jar differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/PDFUAStandards/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/PDFUAStandards/input.pdf new file mode 100644 index 00000000..8924ce4e Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/PDFUAStandards/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/epubtopdf/Sample.epub b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/epubtopdf/Sample.epub new file mode 100644 index 00000000..88fcf187 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/epubtopdf/Sample.epub differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/epubtopdf/wasteland.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/epubtopdf/wasteland.pdf new file mode 100644 index 00000000..e6213768 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/epubtopdf/wasteland.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/getsvgdimensions/Example.svg b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/getsvgdimensions/Example.svg new file mode 100644 index 00000000..438734c1 --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/getsvgdimensions/Example.svg @@ -0,0 +1,69 @@ + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/htmltopdf/EmailDemo_updated.html b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/htmltopdf/EmailDemo_updated.html new file mode 100644 index 00000000..2c6ce96b --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/htmltopdf/EmailDemo_updated.html @@ -0,0 +1,9 @@ + +
    Aspose.PDF rendering Text in Black Color
    +
    Aspose.PDF rendering Text in Green Color
    Aspose.PDF rendering Text in Blue Color
    +
    Aspose.PDF rendering Text in Red Color
    \ No newline at end of file diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/htmltopdf/HTMLSVG.html b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/htmltopdf/HTMLSVG.html new file mode 100644 index 00000000..f026356b --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/htmltopdf/HTMLSVG.html @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/htmltopdf/HTMLToPDF.html b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/htmltopdf/HTMLToPDF.html new file mode 100644 index 00000000..4ae0bcf8 --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/htmltopdf/HTMLToPDF.html @@ -0,0 +1,26 @@ + + + + +Your Title Here + + + + + +
    + +
    + +Link Name + +is a link to another nifty site + +

    This is a Header

    + +

    This is a Medium Header

    +
    + + + + \ No newline at end of file diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pcltopdf/test-converted.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pcltopdf/test-converted.pdf new file mode 100644 index 00000000..88faf2c9 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pcltopdf/test-converted.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pcltopdf/test.pcl b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pcltopdf/test.pcl new file mode 100644 index 00000000..c4cb6176 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pcltopdf/test.pcl differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftodoc/SampleDataTable.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftodoc/SampleDataTable.pdf new file mode 100644 index 00000000..91a75caf Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftodoc/SampleDataTable.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftodoc/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftodoc/input.pdf new file mode 100644 index 00000000..04b17d43 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftodoc/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftodoc/source.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftodoc/source.pdf new file mode 100644 index 00000000..39aa09da Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftodoc/source.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoemf/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoemf/input.pdf new file mode 100644 index 00000000..04b17d43 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoemf/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoepub/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoepub/input.pdf new file mode 100644 index 00000000..04b17d43 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoepub/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/ExcludeFont.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/ExcludeFont.pdf new file mode 100644 index 00000000..e54344df Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/ExcludeFont.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/ExcludeFontResourcesWithAdditionalOptions.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/ExcludeFontResourcesWithAdditionalOptions.pdf new file mode 100644 index 00000000..cd134000 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/ExcludeFontResourcesWithAdditionalOptions.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/SampleDataTable.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/SampleDataTable.pdf new file mode 100644 index 00000000..91a75caf Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/SampleDataTable.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/input.pdf new file mode 100644 index 00000000..04b17d43 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/input1.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/input1.pdf new file mode 100644 index 00000000..b72f8ef9 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/input1.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/input2.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/input2.pdf new file mode 100644 index 00000000..4b326291 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftohtml/input2.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftomobixml/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftomobixml/input.pdf new file mode 100644 index 00000000..12eecede Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftomobixml/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftopdfa/attachment.xml b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftopdfa/attachment.xml new file mode 100644 index 00000000..1d1ebabb --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftopdfa/attachment.xml @@ -0,0 +1,3 @@ + +test + \ No newline at end of file diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftopdfa/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftopdfa/input.pdf new file mode 100644 index 00000000..04b17d43 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftopdfa/input.pdf differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftopdfa/log.xml b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftopdfa/log.xml similarity index 100% rename from Examples/src/main/resources/com/aspose/pdf/examples/AsposePdf/Conversion/pdftopdfa/log.xml rename to Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftopdfa/log.xml diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftopptx/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftopptx/input.pdf new file mode 100644 index 00000000..04b17d43 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftopptx/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftosvg/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftosvg/input.pdf new file mode 100644 index 00000000..04b17d43 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftosvg/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftotex/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftotex/input.pdf new file mode 100644 index 00000000..04b17d43 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftotex/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxls/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxls/input.pdf new file mode 100644 index 00000000..12eecede Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxls/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxlsx/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxlsx/input.pdf new file mode 100644 index 00000000..12eecede Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxlsx/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxml/TestWithTags.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxml/TestWithTags.pdf new file mode 100644 index 00000000..67b7360d Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxml/TestWithTags.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxml/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxml/input.pdf new file mode 100644 index 00000000..12eecede Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxml/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxps/input.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxps/input.pdf new file mode 100644 index 00000000..4b326291 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pdftoxps/input.pdf differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pstopdf/input.ps b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pstopdf/input.ps new file mode 100644 index 00000000..d3e1d0e0 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/pstopdf/input.ps differ diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/svgtopdf/Example.svg b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/svgtopdf/Example.svg new file mode 100644 index 00000000..438734c1 --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/svgtopdf/Example.svg @@ -0,0 +1,69 @@ + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/texttopdf/test.txt b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/texttopdf/test.txt new file mode 100644 index 00000000..b6bca5cb --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/texttopdf/test.txt @@ -0,0 +1,3 @@ +Aspose.PDF for Java +Aspose.PDF for Java +Aspose.PDF for Java \ No newline at end of file diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xmltopdf/Source.xml b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xmltopdf/Source.xml new file mode 100644 index 00000000..ddff160a --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xmltopdf/Source.xml @@ -0,0 +1,7 @@ + + + +segment1 +segment2 + + \ No newline at end of file diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xpstopdf/test.xps b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xpstopdf/test.xps new file mode 100644 index 00000000..cd343b45 Binary files /dev/null and b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xpstopdf/test.xps differ diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdfGenerator/Conversion/xslfotopdf/Test.pdf b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xslfotopdf/Test.pdf similarity index 100% rename from Examples/src/main/resources/com/aspose/pdf/examples/AsposePdfGenerator/Conversion/xslfotopdf/Test.pdf rename to Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xslfotopdf/Test.pdf diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdfGenerator/Conversion/xslfotopdf/test.xml b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xslfotopdf/test.fo similarity index 100% rename from Examples/src/main/resources/com/aspose/pdf/examples/AsposePdfGenerator/Conversion/xslfotopdf/test.xml rename to Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xslfotopdf/test.fo diff --git a/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xslfotopdf/test.xml b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xslfotopdf/test.xml new file mode 100644 index 00000000..a5d8f656 --- /dev/null +++ b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xslfotopdf/test.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + XML Recommendation - p. + + + + + After + + + + + Start + + + + + End + + + + + Extensible Markup Language (XML) 1.0 + + + Abstract + + + The Extensible Markup Language (XML) is a subset of SGML that is completely described in this document. Its goal is to + enable generic SGML to be served, received, and processed on the Web in the way that is now possible with HTML. XML + has been designed for ease of implementation and for interoperability with both SGML and HTML. For further information + go to normal.pdf + + + Status of this document + + + This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a + W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from + another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its + widespread deployment. This enhances the functionality and interoperability of the Web. For further information go to + normal.pdf + + + This document specifies a syntax created by subsetting an existing, widely used international text processing standard + (Standard Generalized Markup Language, ISO 8879:1986(E) as amended and corrected) for use on the World Wide Web. It + is a product of the W3C XML Activity. + + + + \ No newline at end of file diff --git a/Examples/src/main/resources/com/aspose/pdf/examples/AsposePdfGenerator/Conversion/xslfotopdf/test.xsl b/Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xslfotopdf/test.xsl similarity index 100% rename from Examples/src/main/resources/com/aspose/pdf/examples/AsposePdfGenerator/Conversion/xslfotopdf/test.xsl rename to Plugins/Aspose_Pdf_Java_for_Python/Aspose_Pdf_Java_for_Python_3/testdata/converters/xslfotopdf/test.xsl diff --git a/Plugins/Aspose_Pdf_for_Struts/.classpath b/Plugins/Aspose_Pdf_for_Struts/.classpath index 9ae7bca0..ebde5200 100644 --- a/Plugins/Aspose_Pdf_for_Struts/.classpath +++ b/Plugins/Aspose_Pdf_for_Struts/.classpath @@ -6,15 +6,11 @@
    - - - - - + diff --git a/README.md b/README.md index ea1e696a..e7524053 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,122 @@ -## Aspose.PDF for Java +![GitHub all releases](https://img.shields.io/github/downloads/aspose-pdf/Aspose.pdf-for-Java/total) ![GitHub](https://img.shields.io/github/license/aspose-pdf/Aspose.pdf-for-java) +# Java API to Process & Manipulate PDF Files -This package contains [Examples](https://github.com/asposepdf/Aspose_Pdf_Java/tree/master/Examples) and Showcase projects for [Aspose.PDF for Java](https://products.aspose.com/pdf/java) and will help you write your own applications. +[Aspose.PDF for Java](https://products.aspose.com/pdf/java) is a PDF document creation component that enables your Java applications to read, write and manipulate PDF documents without using Adobe Acrobat. -Aspose.PDF for Java is a PDF document creation component that enables your Java applications to read, write and manipulate PDF documents without using Adobe Acrobat. +Directory | Description +--------- | ----------- +[Examples](Examples) | A collection of Java examples that help you learn the product features.

    - - +

    -Directory | Description ---------- | ----------- -[Examples](https://github.com/asposepdf/Aspose_Pdf_Java/tree/master/Examples) | A collection of Java examples that help you learn how to use product features. +## `aspose.pdf` Package Features + +### PDF Document Featres + +- Set basic information (e.g. author, creator) of the PDF document. +- Configure PDF Page properties (e.g. width, height, cropbox, bleedbox etc.). +- Set page numbering, bookmark level, page sizes etc. +- Apply document open action, open mode as well as appearance. +- Document can have different page transition effects such as dissolve or box. +- Create PDF documents via `XML`, `API` or `XML` and `API` combined. +- Ability to work with text, paragraphs, headings, hyperlinks, graphs, attachments etc. + +### Security Features + +- PDF documents can be encrypted up to 128 bits. +- Master and user passwords can be set for PDF encryption. +- Apply rescriptions on content modification, copying, printing and other operations. + +### Conversion Features + +- Convert an existing XML file (`.XML`) or `XmlDocument` to a new PDF document or a PDF file stream. +- Convert conventional Image formats into PDF file. +- Convert `PCL` files into PDF file. + +For a more comprehensive list of features, please visit [Features of `aspose.pdf` Package](https://docs.aspose.com/pdf/java/features-of-aspose-pdf-package/). + +## `com.aspose.pdf` Package Features + +- Supports 14 core fonts. +- Support for `Type 1`, `TrueType`, `Type 3`, `CJK` fonts. +- `Unicode` support is available. +- Add, search, extract and replace text in PDF files. +- Add/delete, extract and replace images. +- Insert, delete, split PDF pages. +- Support for Linearization (optimization for the web). +- Set and get XMP metadata. +- Validate (`PDF/A-1a`, `PDF/A-1b`). +- Work with bookmarks, annotations, PDF forms, stamps, watermarks and more. + +For a more comprehensive list of features, please visit [Features of `com.aspose.pdf` Package](https://docs.aspose.com/pdf/java/features-of-com-aspose-pdf-package/). + +## `com.aspose.pdf.facades` Package Features + +- Supports 14 core fonts. +- Support for `Type 1`, `TrueType`, `Type 3`, `CJK` fonts. +- `Unicode` support is available. +- Add, replace and extract text & images (from the entire PDF, a particular page, or a range of pages). +- Work with bookmarks, annotations, PDF forms, links, actions, signature and more. +- Print PDF to default, specified, physical, or virtual printer. +- Print PDF to `XPS` file or XPS printer. + +For a more comprehensive list of features, please visit [Features of `com.aspose.pdf.facades` Package](https://docs.aspose.com/pdf/java/features-of-com-aspose-pdf-facades-package/). + +## Read & Write PDF & Other Formats + +**Fixed Layout:** PDF, XPS\ +**Books:** EPUB\ +**Web:** HTML +**Other:** TEX, XML, SVG + +## Save PDF Documents As + +**Microsoft Office:** DOC, DOCX, XLS, XLSX, PPTX\ +**Images:** JPEG, PNG, BMP, TIFF, EMF\ +**Other:** MobiXML, XML, TEXT + +## Read Formats + +CGM, MHT, PCL, PS, XSLFO, MD + +## Supported Environments + +- **Microsoft Windows:** Windows Desktop & Server (x86, x64) +- **macOS:** Mac OS X +- **Linux:** Ubuntu, OpenSUSE, CentOS, and others +- **Java Versions:** `J2SE 8.0 (1.8)` or above + +## Get Started with Aspose.PDF for Java + +Aspose hosts all Java APIs at the [Aspose Repository](https://repository.aspose.com/webapp/#/artifacts/browse/tree/General/repo/com/aspose/aspose-pdf). You can easily use Aspose.PDF for Java API directly in your Maven projects with simple configurations. For the detailed instructions please visit [Installing Aspose.PDF for Java from Aspose Repository](https://docs.aspose.com/pdf/java/installation/) documentation page. + +## Extract text from a PDF file using Java + +```java +// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Java +// Open document +Document pdfDocument = new Document("input.pdf"); + +// Create TextAbsorber object to extract text +TextAbsorber textAbsorber = new TextAbsorber(); + +// Accept the absorber for all the pages +pdfDocument.getPages().accept(textAbsorber); + +// Get the extracted text +String extractedText = textAbsorber.getText(); + +// Create a writer and open the file +java.io.FileWriter writer = new java.io.FileWriter(new java.io.File("Extracted_text.txt")); +writer.write(extractedText); -## Resources +// Write a line of text to the file tw.WriteLine(extractedText); +// Close the stream +writer.close(); +``` -+ **Website:** [www.aspose.com](http://www.aspose.com) -+ **Product Home:** [Aspose.PDF for Java](https://products.aspose.com/pdf/java) -+ **Download:** [Download Aspose.PDF for Java](https://artifact.aspose.com/webapp/#/artifacts/browse/tree/General/repo/com/aspose/aspose-pdf) -+ **Documentation:** [Aspose.PDF for Java Documentation](https://docs.aspose.com/display/pdfjava/Home) -+ **Free Support:** [Aspose.PDF for Java Free Support Forum](https://forum.aspose.com/c/pdf) -+ **Paid Support:** [Aspose.PDF for Java Paid Support Forum](https://helpdesk.aspose.com/) -+ **Blog:** [Aspose.PDF for Java Blog](https://blog.aspose.com/category/aspose-products/aspose-pdf-product-family/) +[Product Page](https://products.aspose.com/pdf/java) | [Docs](https://docs.aspose.com/pdf/java/) | [Demos](https://products.aspose.app/pdf/family) | [API Reference](https://apireference.aspose.com/pdf/java) | [Examples](https://github.com/aspose-pdf/Aspose.PDF-for-Java/tree/master/Examples) | [Blog](https://blog.aspose.com/category/pdf/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/pdf) | [Temporary License](https://purchase.aspose.com/temporary-license)