-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4fbafb4
Showing
8 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
rcedit-x64.exe | ||
pdf.ico | ||
|
||
|
||
#Added by cargo | ||
|
||
/target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "chrome-pdf-viewer" | ||
version = "2.0.0" | ||
authors = ["maxloh <[email protected]>"] | ||
edition = "2018" | ||
license = "MIT" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
url = "2.1.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Loh Ka Hong | ||
|
||
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: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# chrome-pdf-viewer | ||
|
||
This simple rust program served as a shortcut to open pdf in a popup Chrome window without tab bar and address bar | ||
|
||
For the old Golang implementation, please check [v1.0](https://github.com/maxloh/chrome-pdf-viewer/tree/v1.0) tag | ||
|
||
![Screenshot](https://raw.githubusercontent.com/maxloh/chrome-pdf-viewer/readme/screenshot.png) | ||
|
||
## Usage | ||
|
||
You need to have Google Chrome installed in order to use this program | ||
|
||
- Open File Explorer | ||
|
||
- Right click on a PDF file | ||
|
||
- Select **Open with** > **Choose another app** | ||
|
||
- Check the **Always use this app to open .pdf files** checkbox | ||
|
||
- Select **More apps** | ||
|
||
- Scroll to the bottom and select **Look for another app on this PC** | ||
|
||
- Select the downloaded .exe file from [Releases](https://github.com/maxloh/chrome-pdf-viewer/releases) page, and select **Open** | ||
|
||
## Build | ||
|
||
### Prerequisites | ||
|
||
- [Rust](https://www.rust-lang.org/tools/install) installed | ||
|
||
- [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/#vstool-2019-family) installed | ||
|
||
- [ImageMagick](https://imagemagick.org/script/download.php#windows) installed (for converting icon to .ico file) | ||
|
||
- [Rcedit (x64 version)](https://github.com/electron/rcedit/releases) downloaded and put into your path | ||
|
||
### Run the build | ||
|
||
- Run **build.bat** | ||
|
||
## Credits | ||
|
||
- Program icon from [chromium/chromium](https://chromium.googlesource.com/chromium/src/+/28ee90fc0392760f358c16cbb57c0323500d7bb0/chrome/browser/resources/settings/icons.html#123), licensed under [a BSD-style license](https://chromium.googlesource.com/chromium/src/+/refs/heads/master/LICENSE) | ||
|
||
- Sample PDF file in screenshot from [mozilla/pdf.js](https://github.com/mozilla/pdf.js/blob/f652cf8e5ea127393ee83e6cb30c51ecd6ce91c3/web/compressed.tracemonkey-pldi-09.pdf), licensed under [Apache License 2.0](https://github.com/mozilla/pdf.js/blob/master/LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cargo build --release | ||
magick -background none -density 10000 pdf.svg -trim -scale 256x256 pdf.ico | ||
rcedit-x64.exe .\target\release\chrome-pdf-viewer.exe --set-icon pdf.ico | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#![windows_subsystem = "windows"] | ||
|
||
use std::env; | ||
use std::process::Command; | ||
use url::form_urlencoded; | ||
|
||
fn main() { | ||
let args: Vec<String> = env::args().collect(); | ||
let path: String = form_urlencoded::Serializer::new(String::new()) | ||
.append_pair("", &args[1]) | ||
.finish()[1..] | ||
.replace("%3A", ":") | ||
.replace("%5C", "\\") | ||
.replace("+", "%20"); | ||
Command::new("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe") | ||
.arg("--app=".to_owned() + &path) | ||
.spawn() | ||
.expect("PDF viewer failed to start"); | ||
} |