1
0
Fork 0

pdf export working

This commit is contained in:
Enoch Riese 2022-11-14 14:02:11 -06:00
parent 922cfd02b9
commit d8cb8a7783
9 changed files with 313 additions and 273 deletions

View file

@ -104,7 +104,7 @@ export const handleExport = async (format, gist, design, t, app, onComplete, onE
// add the strings that are used on the cover page
workerArgs.strings = {
design: capitalize(gist.design),
design: capitalize(pattern.designConfig.data.name.replace('@freesewing/', '')),
tagline: t('common:sloganCome') + '. ' + t('common:sloganStay'),
url: window.location.href,
}
@ -112,13 +112,10 @@ export const handleExport = async (format, gist, design, t, app, onComplete, onE
// draft and render the pattern
pattern.draft()
svg = pattern.render()
workerArgs.svg = pattern.render()
// add the svg and pages data to the worker args
workerArgs.svg = svg
if (pattern.parts.pages) {
workerArgs.pages = pattern.parts.pages.pages
}
workerArgs.pages = pattern.setStores[pattern.activeSet].get('pages')
} catch (err) {
console.log(err)
app.stopLoading()

View file

@ -65,8 +65,8 @@ export default class PdfMaker {
this.rows = pages.rows
// calculate the width of the svg in points
this.svgWidth = this.columns * pages.width * mmToPoints
this.svgHeight = this.rows * pages.height * mmToPoints
this.svgWidth = this.columns * this.pageWidth
this.svgHeight = this.rows * this.pageHeight
}
/** create the pdf document */
@ -179,7 +179,7 @@ export default class PdfMaker {
preserveAspectRatio: 'xMinYMin slice',
}
// everything is offset by half a margin so that it's centered on the page
// everything is offset by a margin so that it's centered on the page
const startMargin = this.margin
for (var h = 0; h < this.rows; h++) {
for (var w = 0; w < this.columns; w++) {