Skip to content

Commit 828419c

Browse files
committed
Initial Commit Aspose.Pdf Java for Jython
1 parent 3febc06 commit 828419c

File tree

74 files changed

+1737
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1737
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Metadata-Version: 1.1
2+
Name: aspose-pdf-java-for-jython
3+
Version: 1.0.0
4+
Summary: Aspose.Pdf Java for Jython is a project that demonstrates / provides the Aspose.Pdf for Java API usage examples in Jython.
5+
Home-page: https://github.com/fahadadeel/Aspose_Pdf_Java/tree/master/Plugins/Aspose-Pdf-Java-for-Jython
6+
Author: Fahad Adeel
7+
Author-email: pdf@aspose.com
8+
License: UNKNOWN
9+
Description: UNKNOWN
10+
Platform: UNKNOWN
11+
Classifier: Programming Language :: Python
12+
Classifier: Programming Language :: Python :: 2
13+
Classifier: License :: OSI Approved :: MIT License
14+
Classifier: Operating System :: OS Independent
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
setup.py
2+
aspose_pdf_java_for_jython.egg-info/PKG-INFO
3+
aspose_pdf_java_for_jython.egg-info/SOURCES.txt
4+
aspose_pdf_java_for_jython.egg-info/dependency_links.txt
5+
aspose_pdf_java_for_jython.egg-info/top_level.txt
6+
asposepdf/__init__.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
asposepdf
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from asposepdf import Settings
2+
from com.aspose.pdf import Document
3+
4+
class PdfToDoc:
5+
6+
def __init__(self):
7+
dataDir = Settings.dataDir + 'WorkingWithDocumentConversion/PdfToDoc/'
8+
9+
# Open the target document
10+
pdf = Document(dataDir + 'input1.pdf')
11+
12+
# Save the concatenated output file (the target document)
13+
pdf.save(dataDir + "output.doc")
14+
15+
print "Document has been converted successfully"
16+
17+
if __name__ == '__main__':
18+
PdfToDoc()
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from asposepdf import Settings
2+
from com.aspose.pdf import Document
3+
from com.aspose.pdf import ExcelSaveOptions
4+
5+
class PdfToExcel:
6+
7+
def __init__(self):
8+
dataDir = Settings.dataDir + 'WorkingWithDocumentConversion/PdfToExcel/'
9+
10+
# Open the target document
11+
pdf = Document(dataDir + 'input1.pdf')
12+
13+
# Instantiate ExcelSave Option object
14+
excelsave = ExcelSaveOptions()
15+
16+
# Save the output to XLS format
17+
pdf.save(dataDir + "Converted_Excel.xls", excelsave)
18+
19+
print "Document has been converted successfully"
20+
21+
if __name__ == '__main__':
22+
PdfToExcel()
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from asposepdf import Settings
2+
from com.aspose.pdf import Document
3+
from com.aspose.pdf import SvgSaveOptions
4+
5+
class PdfToSvg:
6+
7+
def __init__(self):
8+
dataDir = Settings.dataDir + 'WorkingWithDocumentConversion/PdfToSvg/'
9+
10+
# Open the target document
11+
pdf = Document(dataDir + 'input1.pdf');
12+
13+
# instantiate an object of SvgSaveOptions
14+
save_options = SvgSaveOptions();
15+
16+
# do not compress SVG image to Zip archive
17+
save_options.CompressOutputToZipArchive = False;
18+
19+
# Save the output to XLS format
20+
pdf.save(dataDir + "Output.svg", save_options);
21+
22+
print "Document has been converted successfully"
23+
24+
if __name__ == '__main__':
25+
PdfToSvg()
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from asposepdf import Settings
2+
from com.aspose.pdf import Document
3+
from com.aspose.pdf import SvgLoadOptions
4+
5+
class SvgToPdf:
6+
7+
def __init__(self):
8+
dataDir = Settings.dataDir + 'WorkingWithDocumentConversion/SvgToPdf/'
9+
10+
# Instantiate LoadOption object using SVG load option
11+
options = SvgLoadOptions()
12+
13+
# Create document object
14+
pdf = Document(dataDir + 'Example.svg', options)
15+
16+
# Save the output to XLS format
17+
pdf.save(dataDir + "SVG.pdf")
18+
19+
print "Document has been converted successfully"
20+
21+
if __name__ == '__main__':
22+
SvgToPdf()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from asposepdf import Settings
2+
from com.aspose.pdf import Document
3+
from com.aspose.pdf import JavascriptAction
4+
5+
class AddJavascript:
6+
7+
def __init__(self):
8+
dataDir = Settings.dataDir + 'WorkingWithDocumentObject/AddJavascript/'
9+
10+
# Open a pdf document.
11+
doc = Document(dataDir + "input1.pdf")
12+
13+
# Adding JavaScript at Document Level
14+
# Instantiate JavascriptAction with desried JavaScript statement
15+
javaScript = JavascriptAction("this.print({bUI:true,bSilent:false,bShrinkToFit:true})")
16+
17+
# Assign JavascriptAction object to desired action of Document
18+
doc.setOpenAction(javaScript)
19+
20+
# Adding JavaScript at Page Level
21+
doc.getPages().get_Item(2).getActions().setOnOpen(JavascriptAction("app.alert('page 2 is opened')"))
22+
doc.getPages().get_Item(2).getActions().setOnClose(JavascriptAction("app.alert('page 2 is closed')"))
23+
24+
# Save PDF Document
25+
doc.save(dataDir + "JavaScript-Added.pdf")
26+
27+
print "Added JavaScript Successfully, please check the output file."
28+
29+
if __name__ == '__main__':
30+
AddJavascript()
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
from asposepdf import Settings
2+
from com.aspose.pdf import Document
3+
4+
class GetDocumentWindow:
5+
6+
def __init__(self):
7+
dataDir = Settings.dataDir + 'WorkingWithDocumentObject/GetDocumentWindow/'
8+
9+
# Open a pdf document.
10+
doc = Document(dataDir + "input1.pdf")
11+
12+
# Get different document properties
13+
# Position of document's window - Default: false
14+
print "CenterWindow :- "
15+
print doc.getCenterWindow()
16+
17+
# Predominant reading order; determine the position of page
18+
# when displayed side by side - Default: L2R
19+
print "Direction :- "
20+
print doc.getDirection()
21+
22+
# Whether window's title bar should display document title.
23+
# If false, title bar displays PDF file name - Default: false
24+
print "DisplayDocTitle :- "
25+
print doc.getDisplayDocTitle()
26+
27+
#Whether to resize the document's window to fit the size of
28+
#first displayed page - Default: false
29+
print "FitWindow :- "
30+
print doc.getFitWindow()
31+
32+
# Whether to hide menu bar of the viewer application - Default: false
33+
print "HideMenuBar :-"
34+
print doc.getHideMenubar()
35+
36+
# Whether to hide tool bar of the viewer application - Default: false
37+
print "HideToolBar :-"
38+
print doc.getHideToolBar()
39+
40+
# Whether to hide UI elements like scroll bars
41+
# and leaving only the page contents displayed - Default: false
42+
print "HideWindowUI :-"
43+
print doc.getHideWindowUI()
44+
45+
# The document's page mode. How to display document on exiting full-screen mode.
46+
print "NonFullScreenPageMode :-"
47+
print doc.getNonFullScreenPageMode()
48+
49+
# The page layout i.e. single page, one column
50+
print "PageLayout :-"
51+
print doc.getPageLayout()
52+
53+
#How the document should display when opened.
54+
print "pageMode :-"
55+
print doc.getPageMode()
56+
57+
if __name__ == '__main__':
58+
GetDocumentWindow()

0 commit comments

Comments
 (0)