Skip to content

Commit

Permalink
Merge pull request #11 from ganeshh123/documentation_updates
Browse files Browse the repository at this point in the history
Documentation updates
  • Loading branch information
ganeshh123 authored Sep 16, 2020
2 parents 978befa + 82a7462 commit b8fe8ce
Show file tree
Hide file tree
Showing 9 changed files with 334 additions and 382 deletions.
32 changes: 12 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ Get the latest download for Windows and Mac from the releases page:

1. Download the tool and extract.

![downloaded_program](/docs/downloaded_program.png)
![downloaded_program](./docs/downloaded_program.png)

2. In [Notion](https://notion.so), go to the database and click Export, choose 'HTML' and ensure 'Include Subpages' is on.
2. In [Notion](https://notion.so), place all the pages you wish to export into one page and click Export, choose 'HTML' and ensure 'Include Subpages' is on.

![notion-export](/docs/notion-export.png)
![notion-export](./docs/notion-export.png)

3. Extract and place the html files with folders containing images in the same folder as 'notion-pdf-export.exe' (Windows) or 'notion-pdf-export' (Mac).
3. Extract the export to find a list of HTML files and folders for each page. Place the HTML files with folders containing images in the same folder as 'notion-pdf-export.exe' (Windows) or 'notion-pdf-export' (Mac).

![placing-markdown-files](/docs/placing-markdown-files.png)
![placing-markdown-files](./docs/placing-html-files.png)

4. Double Click 'notion-pdf-export.exe' (Windows) or 'notion-pdf-export' (Mac) and wait for the process to be completed.

![running-program](/docs/running-program.png)
![running-program](./docs/running-program.png)

5. All the individual pages can be found converted into pdfs at pdfs>pages .
5. All the individual pages can be found converted into PDF Documents inside the pdfs folder.

![created_pdfs](/docs/created_pdfs.png)
![created_pdfs](./docs/created_pdfs.png)

---

Expand All @@ -46,9 +46,7 @@ Get the latest download for Windows and Mac from the releases page:
```bash
npm install
```

2. Go to node_modules>phantomjs-prebuilt>lib>phantom>bin and copy 'phantomjs.exe' (Windows) or 'phantomjs' (Mac) into the the project root directory
3. Run this command to run the script:
2. Run this command to run the script:

```bash
node index.js
Expand Down Expand Up @@ -148,17 +146,12 @@ in the root directory of the project. Note that this is built under the name 'np

To distribute the Windows Executable, place it in a directory with the following:

- The 'markdown-pdf' folder that comes with the source code
- The original 'node_modules' folder from the source code
- The 'phantomjs.exe' prebuilt binary for Windows placed inside 'markdown-pdf' folder. This can be found at ***node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs.exe***
- The original 'utils' folder from the source code

![win32-build](/docs/win32-build.png)

To distribute the Mac Executable (npe), place it in a directorywith the following:

- The 'markdown-pdf' folder that comes with the source code
- The original 'node_modules' folder from the source code
- The 'phantomjs' prebuilt binary for Mac placed inside the 'markdown-pdf' folder. This can be found at ***node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs***
- The original 'utils' folder from the source code
- An executable unix shell script with the following contents, called 'notion-pdf-export':

```bash
Expand All @@ -169,6 +162,5 @@ To distribute the Mac Executable (npe), place it in a directorywith the followin

This can be obtained from 'mac_script.sh' or found inside /dist/macos

![macos_build](/docs/macos_build.png)

## Credits
<a href="https://iconscout.com/icons/notion" target="_blank">Notion Icon</a> by <a href="https://iconscout.com/contributors/Rengised">Alex Martinov</a> on <a href="https://iconscout.com">Iconscout</a>
Binary file modified docs/created_pdfs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/downloaded_program.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
322 changes: 322 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Notion PDF Export</title>
<style>
@media print {
*,
*:before,
*:after {
background: transparent !important;
color: #000 !important;
box-shadow: none !important;
text-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " ("attr(href) ")";
}
abbr[title]:after {
content: " ("attr(title) ")";
}
a[href^="#"]:after,
a[href^="javascript:"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
}
html {
font-size: 12px;
}
@media screen and (min-width: 32rem) and (max-width: 48rem) {
html {
font-size: 15px;
}
}
@media screen and (min-width: 48rem) {
html {
font-size: 16px;
}
}
body {
line-height: 1.85;
}
p,
.air-p {
font-size: 1rem;
margin-bottom: 1.3rem;
}
h1,
.air-h1,
h2,
.air-h2,
h3,
.air-h3,
h4,
.air-h4 {
margin: 1.414rem 0 .5rem;
font-weight: inherit;
line-height: 1.42;
}
h1,
.air-h1 {
margin-top: 0;
font-size: 3.998rem;
}
h2,
.air-h2 {
font-size: 2.827rem;
}
h3,
.air-h3 {
font-size: 1.999rem;
}
h4,
.air-h4 {
font-size: 1.414rem;
}
h5,
.air-h5 {
font-size: 1.121rem;
}
h6,
.air-h6 {
font-size: .88rem;
}
small,
.air-small {
font-size: .707em;
}
/* https://github.com/mrmrs/fluidity */
img,
canvas,
iframe,
video,
svg,
select,
textarea {
max-width: 100%;
}
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,300);
body {
color: #444;
font-family: 'Open Sans', Helvetica, sans-serif;
font-weight: 300;
margin: 6rem auto 1rem;
max-width: 48rem;
text-align: center;
}
a,
a:visited {
color: #3498db;
}
a:hover,
a:focus,
a:active {
color: #2980b9;
}
pre {
background-color: #fafafa;
padding: 1rem;
text-align: left;
}
blockquote {
margin: 0;
border-left: 5px solid #7a7a7a;
font-style: italic;
padding: 1.33em;
text-align: left;
}
ul,
ol,
li {
text-align: left;
}
p {
color: #777;
}
</style>
</head>
<body>
<h1 id="notion-pdf-export">Notion PDF Export</h1>
<p>A tool to allow batch PDF export for free Notion users. You can export as HTML with subpages and then use this
tool to convert those into PDFs.
</p>
<h2 id="download">Download</h2>
<p>Get the latest download for Windows and Mac from the releases page:</p>
<p><a
href="https://github.com/ganeshh123/notion-pdf-export/releases/latest">https://github.com/ganeshh123/notion-pdf-export/releases</a>
</p>
<p><a
href="https://github.com/ganeshh123/notion-pdf-export/releases/download/1.20/windows_notion-pdf-export_1.20.zip">Download
for Windows</a>
</p>
<p><a
href="https://github.com/ganeshh123/notion-pdf-export/releases/download/1.20/mac_notion-pdf-export_1.20.zip">Download
for Mac</a>
</p>
<h2 id="usage">Usage</h2>
<ol>
<li>
<p>Download the tool and extract.</p>
<p> <img src="./downloaded_program.png" alt="downloaded_program"></p>
</li>
<li>
<p>In <a href="https://notion.so">Notion</a>, place all the pages you wish to export into one page and click
Export, choose 'HTML' and ensure 'Include Subpages' is on.
</p>
<p> <img src="./notion-export.png" alt="notion-export"></p>
</li>
<li>
<p>Extract the export to find a list of HTML files and folders for each page. Place the HTML files with
folders containing images in the same folder as 'notion-pdf-export.exe' (Windows) or 'notion-pdf-export'
(Mac).
</p>
<p> <img src="./placing-html-files.png" alt="placing-markdown-files"></p>
</li>
<li>
<p>Double Click 'notion-pdf-export.exe' (Windows) or 'notion-pdf-export' (Mac) and wait for the process to
be completed.
</p>
<p> <img src="./running-program.png" alt="running-program"></p>
</li>
<li>
<p>All the individual pages can be found converted into PDF Documents inside the pdfs folder.</p>
<p> <img src="./created_pdfs.png" alt="created_pdfs"></p>
</li>
</ol>
<hr>
<h2 id="building">Building</h2>
<h3 id="running-the-project-on-node">Running the Project on Node</h3>
<ol>
<li>
<p>Clone/Download the project and run the command in the project root directory:</p>
<pre><code class="language-bash"> npm install</code></pre>
</li>
<li>
<p>Run this command to run the script:</p>
<pre><code class="language-bash"> node index.js</code></pre>
</li>
</ol>
<h3 id="compiling-an-executable">Compiling an Executable</h3>
<p>This is tricky. A lot of adjustments had to be made so that it can run without node.</p>
<p><strong>Installing nexe</strong></p>
<p>Executables are compiled with a very <a href="https://github.com/cspotcode/nexe/tree/fix-vfs">specific version of
nexe</a> that allows access to the filesystem, which has a tricky setup procedure.
</p>
<p>To install automatically:</p>
<p>Run <strong>install_nexe_win.bat</strong> as admin on <strong>Windows</strong>, will take about 5 minutes to
install fully.
</p>
<p>Or</p>
<p>Run <strong>install_nexe_mac</strong> on <strong>Mac</strong>, will take about 5 minutes to install, and you will
need to enter password. This sometimes doesn't seem to work properly, so might be worth doing manual install if
there's problems.
</p>
<p>Alternatively, install manually like this:</p>
<ol>
<li>
<p>Firstly, install the general <a href="https://www.npmjs.com/package/nexe">nexe</a> globally with the
command:
</p>
<pre><code class="language-bash"> npm install -g nexe</code></pre>
<p> In Windows with Command Prompt running as Admin. Or:</p>
<pre><code class="language-bash"> sudo npm install -g nexe</code></pre>
<p> In Mac in the terminal</p>
</li>
<li>
<p>In the project root folder build some executables with this version of nexe to download node binaries for
Windows and Mac:
</p>
<pre><code class="language-bash"> nexe . --target win32-x86-10.13.0
nexe . -t macos-10.13.0</code></pre>
<p> This will download the binaries we need for later, delete the executables built with this for now.</p>
</li>
<li>
<p>Now we need to install a <a href="https://github.com/cspotcode/nexe/tree/fix-vfs">specific version of
nexe</a> that allows access to the filesystem:
</p>
<p> Run the command:</p>
<pre><code class="language-bash"> npm install -g cspotcode/nexe#19a5046</code></pre>
<p> In Windows with Command Prompt running as Admin. Or:</p>
<pre><code class="language-bash"> sudo npm install -g cspotcode/nexe#19a5046</code></pre>
</li>
</ol>
<p>Now we should have the correct version of nexe for building.</p>
<p>Confirm by running:</p>
<pre><code class="language-bash">nexe -v</code></pre>
<p><img src="/docs/nexe-version.png" alt="nexe-version"></p>
<p>Check that the version is <code>4.0.0-beta.4</code></p>
<p><strong>Compiling Executables</strong></p>
<p>To Compile Automatically</p>
<p>Run <strong>build_win32.bat</strong> on <strong>Windows</strong> to build a Windows Executable. This can be found
in /dist/win32 and everything in that folder must be distributed together.
</p>
<p>Run <strong>build_macos</strong> on <strong>Mac</strong> to build a Mac Executable. This can be found in
/dist/macos and everything in that folder must be distributed together.
</p>
<p>If you wish to compile for Mac on Windows or Vice Versa, you can do so using the manual method below. This is
trickier and will require obtaining a phantomjs binary built for the desired platform and placing it in the
correct place.
</p>
<p>To Compile Manually</p>
<p>To build a Windows Executable, run the command:</p>
<pre><code class="language-bash">nexe . --target win32-x86-10.13.0 -o ./dist/win32/notion-pdf-export.exe</code></pre>
<p>in the root directory of the project.</p>
<p>To build a Mac executable, run the command:</p>
<pre><code class="language-bash">nexe . -t macos-10.13.0 -o ./dist/macos/npe</code></pre>
<p>in the root directory of the project. Note that this is built under the name 'npe' which is done for a reason.
</p>
<p>To distribute the Windows Executable, place it in a directory with the following:</p>
<ul>
<li>The original 'utils' folder from the source code</li>
</ul>
<p>To distribute the Mac Executable (npe), place it in a directorywith the following:</p>
<ul>
<li>
<p>The original 'utils' folder from the source code</p>
</li>
<li>
<p>An executable unix shell script with the following contents, called 'notion-pdf-export':</p>
<pre><code class="language-bash"> #/bin/bash
cd "$0"/..
./npe</code></pre>
<p> This can be obtained from 'mac_script.sh' or found inside /dist/macos</p>
</li>
</ul>
<h2 id="credits">Credits</h2>
<p><a href="https://iconscout.com/icons/notion" target="_blank">Notion Icon</a> by <a
href="https://iconscout.com/contributors/Rengised">Alex Martinov</a> on <a
href="https://iconscout.com">Iconscout</a></p>
<p>by <a href="https://nesh.gq">Ganesh H</a></p>
</body>
</html>
Binary file modified docs/notion-export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/placing-html-files.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/placing-markdown-files.png
Binary file not shown.
Binary file modified docs/running-program.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b8fe8ce

Please sign in to comment.