A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix exported pdf
ammarahm-ed8208b8ead263
diff --git a/apps/mobile/src/services/Exporter.js b/apps/mobile/src/services/Exporter.jsindex 3a012c868..f0f34f9fb 100644--- a/apps/mobile/src/services/Exporter.js+++ b/apps/mobile/src/services/Exporter.js@@ -5,12 +5,11 @@ import RNHTMLtoPDF from 'react-native-html-to-pdf-lite';import Storage from '../utils/storage';import showdown from 'showdown';import jsdom from 'jsdom-jscore-rn';-import { sanitizeFilename } from '../utils/filename';+import {sanitizeFilename} from '../utils/filename';let RNFetchBlob;const defaultStyle = `<style>-.img_size_one {width:100%;}@@ -47,16 +46,17 @@ iframe {}table {display: block !important;- overflow-x: auto !important;- white-space: nowrap !important;max-width:100% !important;width:100% !important;- height:auto !important;+ table-layout:fixed;+ border-width:0;}td {- min-width:10vw !important;+ padding:5px;+ border-width:0.5px;+ border-style:solid;}-</style>`+</style>`;async function saveToPDF(note) {let androidSavePath = '/Notesnook/exported/PDF';@@ -79,18 +79,20 @@ async function saveToPDF(note) {html = he.decode(html);let fileName = sanitizeFilename(note.title + Date.now(), {replacement: '_'});let html3 = html;- if (html.indexOf("<head>") > -1) {- let html1 = html.substring(0,html.indexOf("<head>") + 6);- let html2 = html.substring(html.indexOf("<head>") + 6);- html3 = html1 + defaultStyle + html2+ if (html.indexOf('<head>') > -1) {+ let html1 = html.substring(0, html.indexOf('<head>') + 6);+ let html2 = html.substring(html.indexOf('<head>') + 6);+ html3 = html1 + defaultStyle + html2;}-+let options = {html: html3,fileName: Platform.OS === 'ios' ? '/exported/PDF/' + fileName : fileName,directory: Platform.OS === 'ios' ? 'Documents' : androidSavePath,- width:595,- height:852+ width: 595,+ height: 852,+ bgColor: '#FFFFFF',+ padding: 30,};let res = await RNHTMLtoPDF.convert(options);@@ -119,7 +121,7 @@ async function saveToMarkdown(note) {RNFetchBlob = require('rn-fetch-blob').default;let converter = new showdown.Converter();- converter.setFlavor("original");+ converter.setFlavor('original');let dom = jsdom.html();let content = await db.notes.note(note.id).content();let markdown = converter.makeMarkdown(content, dom);@@ -185,12 +187,11 @@ async function saveToHTML(note) {let html = await db.notes.note(note.id).export('html');let fileName = sanitizeFilename(note.title + Date.now(), {replacement: '_'});let html3 = html;- if (html.indexOf("<head>") > -1) {- let html1 = html.substring(0,html.indexOf("<head>") + 6);- let html2 = html.substring(html.indexOf("<head>") + 6);- html3 = html1 + defaultStyle + html2+ if (html.indexOf('<head>') > -1) {+ let html1 = html.substring(0, html.indexOf('<head>') + 6);+ let html2 = html.substring(html.indexOf('<head>') + 6);+ html3 = html1 + defaultStyle + html2;}-path = path + fileName + '.html';await RNFetchBlob.fs.writeFile(path, html3, 'utf8');