Skip to content

Commit a6970b3

Browse files
committedJul 17, 2019
Adding DC View SDK samples
0 parents  commit a6970b3

14 files changed

+455
-0
lines changed
 

‎.github/CONTRIBUTING.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Contributing
2+
3+
Thanks for choosing to contribute!
4+
5+
The following are a set of guidelines to follow when contributing to this project.
6+
7+
## Code Of Conduct
8+
9+
This project adheres to the Adobe [code of conduct](../CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [Grp-opensourceoffice@adobe.com](mailto:Grp-opensourceoffice@adobe.com).
10+
11+
## Contributor License Agreement
12+
13+
All third-party contributions to this project must be accompanied by a signed contributor license. This gives Adobe permission to redistribute your contributions as part of the project. Sign our [CLA](http://adobe.github.io/cla.html). You only need to submit an Adobe CLA one time, so if you have submitted one previously, you are good to go!
14+
15+
## Code Reviews
16+
17+
All submissions should come in the form of pull requests and need to be reviewed by project committers. Read [GitHub's pull request documentation](https://help.github.com/articles/about-pull-requests/) for more information on sending pull requests.
18+
19+
Lastly, please follow the [pull request template](PULL_REQUEST_TEMPLATE.md) when submitting a pull request!

‎.github/ISSUE_TEMPLATE.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!--- STOP! Before you open an issue please search this repository's issues to see if it has already been reported. This helps reduce duplicate issues from being created. -->
2+
<!--- SECURITY DISCLOSURE: If this is a security disclosure please follow the guidelines in CONTRIBUTING.md. This helps keep folks from accidentally releasing vulnerabilities before the maintainers get a chance to fix the issue. -->
3+
4+
### Expected Behaviour
5+
6+
### Actual Behaviour
7+
8+
### Reproduce Scenario (including but not limited to)
9+
10+
#### Steps to Reproduce
11+
12+
#### Platform and Version
13+
14+
#### Sample Code that illustrates the problem
15+
16+
#### Logs taken while reproducing problem

‎.github/PULL_REQUEST_TEMPLATE.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!--- Provide a general summary of your changes in the Title above -->
2+
3+
## Description
4+
5+
<!--- Describe your changes in detail -->
6+
7+
## Related Issue
8+
9+
<!--- This project only accepts pull requests related to open issues -->
10+
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
11+
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
12+
<!--- Please link to the issue here: -->
13+
14+
## Motivation and Context
15+
16+
<!--- Why is this change required? What problem does it solve? -->
17+
18+
## How Has This Been Tested?
19+
20+
<!--- Please describe in detail how you tested your changes. -->
21+
<!--- Include details of your testing environment, and the tests you ran to -->
22+
<!--- see how your change affects other areas of the code, etc. -->
23+
24+
## Screenshots (if appropriate):
25+
26+
## Types of changes
27+
28+
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
29+
30+
- [ ] Bug fix (non-breaking change which fixes an issue)
31+
- [ ] New feature (non-breaking change which adds functionality)
32+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
33+
34+
## Checklist:
35+
36+
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
37+
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
38+
39+
- [ ] I have signed the [Adobe Open Source CLA](http://opensource.adobe.com/cla.html).
40+
- [ ] My code follows the code style of this project.
41+
- [ ] My change requires a change to the documentation.
42+
- [ ] I have updated the documentation accordingly.
43+
- [ ] I have read the **CONTRIBUTING** document.
44+
- [ ] I have added tests to cover my changes.
45+
- [ ] All new and existing tests passed.

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
.idea

‎AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Authors ordered by first contribution

‎CODE_OF_CONDUCT.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Adobe Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at Grp-opensourceoffice@adobe.com. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

‎LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
© Copyright 2019 Adobe. All rights reserved.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Getting started with the Adobe Document Cloud View SDK
2+
3+
The Adobe Document Cloud View SDK lets you display PDFs in your website and leverage its power to benefit your users.
4+
5+
## Prerequisites
6+
7+
1. Before you can work with the SDK, you must register your application and get Client ID (API Key). For details, see the "Registering Your Application" section of this guide.
8+
1. The following software is required:
9+
10+
- **Supported browsers**: Chrome, Safari, Firefox, Edge, IE11+
11+
12+
## Registering Your Application
13+
14+
[Request Access](https://www.adobe.io/apis/documentcloud/dcsdk/form.html) to get your own Client Id and Credentials.
15+
16+
## Running the samples
17+
18+
The following sub-sections describe how to run the samples.
19+
20+
### PDF Preview
21+
22+
To preview file preview, copy the file under ```getting-started``` folder to your computer, and open index.html in supported browser. A sample PDF preview will be rendered using SDK.
23+
24+
### PDF Preview with listening to events
25+
26+
To preview file preview and listen various events, copy the file under ```events``` folder to your computer, and open index.html in supported browser. A sample PDF preview will be rendered using SDK and events will be printed on browser console.
27+
28+
### PDF Preview with Annotation tools
29+
30+
To preview file preview with annotation tools, copy the file under ```annotation-tools``` folder to your computer, and open index.html in supported browser. A sample PDF preview will be rendered using SDK with annotation tools enabled.
31+
32+
## Licensing
33+
34+
This project is licensed under the MIT License. See [LICENSE](LICENSE.md) for more information.

‎annotation-tools/index.html

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Adobe Document Cloud View SDK Sample</title>
5+
<meta charset="utf-8"/>
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
7+
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1"/>
8+
<!-- Uncomment below line for IE11 -->
9+
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js"></script> -->
10+
<script type="text/javascript" src="index.js"></script>
11+
</head>
12+
<body style="margin: 0px">
13+
<div id="adobe-dc-view"></div>
14+
<script type="text/javascript" src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
15+
</body>
16+
</html>

‎annotation-tools/index.js

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
Copyright 2019 Adobe
3+
All Rights Reserved.
4+
5+
NOTICE: Adobe permits you to use, modify, and distribute this file in
6+
accordance with the terms of the Adobe license agreement accompanying
7+
it. If you have received this file from a source other than Adobe,
8+
then your use, modification, or distribution of it requires the prior
9+
written permission of Adobe.
10+
*/
11+
12+
/* Wait for Adobe Document Cloud View SDK to be ready */
13+
document.addEventListener("adobe_dc_view_sdk.ready", function() {
14+
/* Initialize the AdobeDC View object */
15+
var adobeDCView = new AdobeDC.View({
16+
/* Pass your regsitered client id */
17+
clientId: "<YOUR_CLIENT_ID>",
18+
/* Pass the div id in which PDF should be rendered */
19+
divId: "adobe-dc-view",
20+
});
21+
22+
/* Invoke the file preview API on Adobe DC View object */
23+
adobeDCView.previewFile({
24+
/* Pass information on how to accesss the file */
25+
content: {
26+
/* Location of file where it is hosted */
27+
location: {
28+
url: "https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf",
29+
/*
30+
If accessing file from URL requires some addition headers like "Authorization" etc.
31+
It can be passed in headers.
32+
header: [
33+
{
34+
key: "<HEADER_KEY>",
35+
value: "<HEADER_VALUE>",
36+
}
37+
]
38+
*/
39+
},
40+
},
41+
/* Pass meta data of file */
42+
metaData: {
43+
/* file name */
44+
fileName: "Bodea Brochure.pdf"
45+
}
46+
}, {
47+
showAnnotationTools: true
48+
});
49+
50+
/* Define Save API Handler */
51+
var saveApiHandler = function(metaData, content, options) {
52+
console.log(metaData, content, options);
53+
/* Dummy implementation of Save API, replace with your implementation */
54+
return new Promise(function(resolve, reject) {
55+
setTimeout(function() {
56+
var response = {
57+
code: AdobeDC.View.Enum.ApiResponseCode.SUCCESS,
58+
data: {
59+
metadata: Object.assign(metaData, {fileName: config.fileName})
60+
},
61+
};
62+
resolve(response)
63+
}, 2000);
64+
});
65+
};
66+
67+
/* control Save API options */
68+
const options = {
69+
/* control the content of file, incremental false means full file content */
70+
incremental: false,
71+
};
72+
/*
73+
adobeDCView.registerCallback(
74+
AdobeDC.View.Enum.CallbackType.SAVE_API,
75+
saveApiHandler,
76+
options
77+
);
78+
*/
79+
});

‎events/index.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Adobe Document Cloud View SDK Sample</title>
5+
<meta charset="utf-8"/>
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
7+
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1"/>
8+
<script type="text/javascript" src="index.js"></script>
9+
</head>
10+
<body style="margin: 0px">
11+
<div id="adobe-dc-view"></div>
12+
<script type="text/javascript" src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)