Skip to content

Commit 865fb6b

Browse files
Merge pull request aspose-pdf#16 from fahadadeel/master
Aspose.Pdf Java for Jython Examples
2 parents 70da8c4 + f90ae1b commit 865fb6b

File tree

75 files changed

+1760
-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.

75 files changed

+1760
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Aspose.Pdf Java for Jython
2+
3+
Aspose.Pdf Java for Jython is a project that demonstrates / provides the Aspose.Pdf for Java API usage examples in Jython.
4+
5+
## Download
6+
7+
* To download Aspose.Pdf for Java API to be used with these examples, Please navigate to [Aspose.Pdf for Java](http://www.aspose.com/community/files/72/java-components/aspose.pdf-for-java/)
8+
* Place downloaded jar file into "lib" directory.
9+
* Replace "your-lib" with the jar filename.
10+
11+
## Documentation
12+
13+
For most complete documentation of the project, check [Aspose.Pdf Java For Jython confluence wiki](http://www.aspose.com/docs/display/pdfjava/Aspose.Pdf+Java+for+Jython).
14+
15+
## Download Latest Versions?
16+
17+
* [Latest Releases on Codeplex](http://asposepdfjavajython.codeplex.com/releasesce)
18+
19+
## Clone Plugin SourceCodes?
20+
21+
This project is also hosted and maintained at CodePlex. To clone navigate to:
22+
23+
* [Aspose.Pdf Java for Jython on CodePlex - click here](https://asposepdfjavajython.codeplex.com/SourceControl/latest)
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()

0 commit comments

Comments
 (0)