Skip to content

Instantly share code, notes, and snippets.

View cjharkins's full-sized avatar
🏠
Working from home

Cory Harkins cjharkins

🏠
Working from home
  • Asurion
  • Nashville, TN
View GitHub Profile
import jsPDF from 'jspdf'
export default function({data, headers, filename}) {
const doc = new jsPDF({...})
{... I cut out previous code for brevity but it belongs here!}
// NEW CODE
// ROWS
data.forEach((row, rIndex) => {
import jsPDF from 'jspdf'
export default function({data, headers, filename}) {
const doc = new jsPDF({...})
{... I cut out previous code for brevity but it belongs here!}
// NEW CODE
// ROWS
data.forEach((row, rIndex) => {
import jsPDF from 'jspdf'
export default function({data, headers, filename}) {
const doc = new jsPDF({...})
{... I cut out previous code for brevity but it belongs here!}
// NEW CODE
 doc.line(pageMargin, pageMargin + 3.5, liveArea.width , pageMargin + 3.5)
import jsPDF from 'jspdf'
export default function({data, headers, filename}) {
const doc = new jsPDF({...})
{... I cut out previous code for brevity but it belongs here!}
const xPositions = [] // NEW CODE
// NEW CODE
import jsPDF from 'jspdf'
export default function({data, headers, filename}) {
const doc = new jsPDF({...})
const pageDimensions = {...}
const pageMargin = 50
const liveArea = {...}
import jsPDF from 'jspdf'
export default pdf({data, headers, filename}) {
const doc = new jsPDF({...})
const pageDimensions = {...}
const pageMargin = 50 // NEW CODE
// NEW CODE
const liveArea = {
import jsPDF from 'jspdf'
export default pdf({data, headers, filename}) {
const doc = new jsPDF({...})
const pageDimensions = { // NEW CODE
height: 595.28,
width: 841.89
}
doc.save(filename)
@cjharkins
cjharkins / jsdpf-2.js
Created January 29, 2020 16:30
jspdf-2
import jsPDF from 'jspdf'
export default pdf({data, headers, filename}) {
const doc = new jsPDF({
orientation: 'l',
unit: 'pt',
format: 'a4'
})
doc.save(filename)
}
@cjharkins
cjharkins / App.js
Last active December 1, 2020 09:56
jspdf-app.js
import React, {useState} from 'react';
import logo from './logo.svg';
import './App.css';
import pdf from './utils/pdf'
function App() {
const [searching, setSearching] = useState(false)
const [movieList, setMovieList] = useState([])
const [searchText, setSearchText] = useState('')
@cjharkins
cjharkins / placeholder-jspdf.js
Created January 29, 2020 16:19
Placeholder jspdf A
import jsPDF from 'jspdf'
export default pdf({data, headers, filename}) {
const doc = new jsPDF()
doc.save(filename)
}