Closed seansimonanimation closed 7 years ago
I've done some playing around, and it only seems to affect the first autogenerated page. A workaround (at least for my project) is to force a pageBreak: "before" or pageBreak: "after" (depending on the situation) on every line that activates the autogenerating code. It's icky, and a proper fix would be preferable, but it's something for now.
If you plug this into the pdfmake playground, you'll see what I mean.
var dd = {
"content":
[
{"text":" INT. TIME TRAVEL SCHOOL - MORNING\n","style":"sch","bookmark":"Begin"},
{"text":" A classroom full of exhausted College Senior Level TIME CADETS sit in their classroom, staring down their PROFESSOR, Mid-30s, wearing a tweed jacket with elbow patches and a bow tie wrap up her lecture.\n","style":"act"},
{"text":"One student, CHRIS JENKINS, early twenties, wearing his green hoodie with “DR LORDE’S SCHOOL OF TEMPORAL MECHANICS” printed on the front, sits at his desk with his laptop in front, taking notes. Next to Chris, KATHLEEN MASON, mid-20s, skinny as a rail, hair disheveled, wearing the exact same hoodie as Chris, and black makeup, sits completely disinterested. She shakes her head in an attempt to wake herself up.\n","style":"act"},
{"text":"The professor points her laser pointer to drawings on a whiteboard, demonstrating what she’s saying.\n","style":"act"},
{"text":" PROFESSOR\n","style":"cha"},
{"text":" So to summarize the Bootstrap Paradox... You go back in tim... all of time and space with this little gem.\n","style":"dia"},
{"text":" The TIME CADETS stand and suffle out of the classroom. Chris and Kathleen follow.\n","style":"act"},
{"text":"PROFESSOR (CONT'D)\n","style":"cha"},
{"text":"(yelling)\n","style":"par"},
{"text":"And don't forget, stay out of history!\n","style":"dia"},
{"text":" INT. TIME TRAVEL SCHOOL - MORNING\n","style":"sch","bookmark":"Begin"},
{"text":" A classroom full of exhausted College Senior Level TIME CADETS sit in their classroom, staring down their PROFESSOR, Mid-30s, wearing a tweed jacket with elbow patches and a bow tie wrap up her lecture.\n","style":"act"},
{"text":"One student, CHRIS JENKINS, early twenties, wearing his green hoodie with “DR LORDE’S SCHOOL OF TEMPORAL MECHANICS” printed on the front, sits at his desk with his laptop in front, taking notes. Next to Chris, KATHLEEN MASON, mid-20s, skinny as a rail, hair disheveled, wearing the exact same hoodie as Chris, and black makeup, sits completely disinterested. She shakes her head in an attempt to wake herself up.\n","style":"act"},
{"text":"The professor points her laser pointer to drawings on a whiteboard, demonstrating what she’s saying.\n","style":"act"},
{"text":" PROFESSOR\n","style":"cha"},
{"text":" So to summarize the Bootstrap Paradox... You go back in tim... all of time and space with this little gem.\n","style":"dia"},
{"text":" The TIME CADETS stand and suffle out of the classroom. Chris and Kathleen follow.\n","style":"act"},
{"text":"PROFESSOR (CONT'D)\n","style":"cha"},
{"text":"(yelling)\n","style":"par"},
{"text":"And don't forget, stay out of history!\n","style":"dia"},
{"text":" INT. TIME TRAVEL SCHOOL - MORNING\n","style":"sch","bookmark":"Begin"},
{"text":" A classroom full of exhausted College Senior Level TIME CADETS sit in their classroom, staring down their PROFESSOR, Mid-30s, wearing a tweed jacket with elbow patches and a bow tie wrap up her lecture.\n","style":"act"},
{"text":"One student, CHRIS JENKINS, early twenties, wearing his green hoodie with “DR LORDE’S SCHOOL OF TEMPORAL MECHANICS” printed on the front, sits at his desk with his laptop in front, taking notes. Next to Chris, KATHLEEN MASON, mid-20s, skinny as a rail, hair disheveled, wearing the exact same hoodie as Chris, and black makeup, sits completely disinterested. She shakes her head in an attempt to wake herself up.\n","style":"act"},
{"text":"The professor points her laser pointer to drawings on a whiteboard, demonstrating what she’s saying.\n","style":"act"},
{"text":" PROFESSOR\n","style":"cha"},
{"text":" So to summarize the Bootstrap Paradox... You go back in tim... all of time and space with this little gem.\n","style":"dia"},
{"text":" The TIME CADETS stand and suffle out of the classroom. Chris and Kathleen follow.\n","style":"act"},
{"text":"PROFESSOR (CONT'D)\n","style":"cha"},
{"text":"(yelling)\n","style":"par"},
{"text":"And don't forget, stay out of history!\n","style":"dia"},
{"text":"Oppose the man: Please go to page ","style":"link","target":"Oppose1","pageBreak":"after"},
{"text":" The boy opposes the man. Everybody cheers.\n","style":"act","bookmark":"Oppose1"},
{"text":" The boy steps off the stage\n","style":"act"},
{"text":" THE BOY\n","style":"cha"},{"text":" The play is over!\n","style":"dia"}
],
"styles":
{"sch":
{"margin":[0,10,0,0]},
"tra":{alignment:"right",margin:[0,10,0,0]},
"cha":{margin:[190,10,144,0]},
"dia":{margin:[110,0,110,0],_maxwidth:324},
"act":{margin:[0,10,0,0]},
"par":{margin:[144,0,110,0]},
"link":{fontSize:16,margin:[0,20,0,0]}},
"pageMargins":[70,70],
"pageSize":"LETTER"
}
This is with the workaround
var dd = {
"content":
[
{"text":" INT. TIME TRAVEL SCHOOL - MORNING\n","style":"sch","bookmark":"Begin"},
{"text":" A classroom full of exhausted College Senior Level TIME CADETS sit in their classroom, staring down their PROFESSOR, Mid-30s, wearing a tweed jacket with elbow patches and a bow tie wrap up her lecture.\n","style":"act"},
{"text":"One student, CHRIS JENKINS, early twenties, wearing his green hoodie with “DR LORDE’S SCHOOL OF TEMPORAL MECHANICS” printed on the front, sits at his desk with his laptop in front, taking notes. Next to Chris, KATHLEEN MASON, mid-20s, skinny as a rail, hair disheveled, wearing the exact same hoodie as Chris, and black makeup, sits completely disinterested. She shakes her head in an attempt to wake herself up.\n","style":"act"},
{"text":"The professor points her laser pointer to drawings on a whiteboard, demonstrating what she’s saying.\n","style":"act"},
{"text":" PROFESSOR\n","style":"cha"},
{"text":" So to summarize the Bootstrap Paradox... You go back in tim... all of time and space with this little gem.\n","style":"dia"},
{"text":" The TIME CADETS stand and suffle out of the classroom. Chris and Kathleen follow.\n","style":"act"},
{"text":"PROFESSOR (CONT'D)\n","style":"cha"},
{"text":"(yelling)\n","style":"par"},
{"text":"And don't forget, stay out of history!\n","style":"dia"},
{"text":" INT. TIME TRAVEL SCHOOL - MORNING\n","style":"sch","bookmark":"Begin"},
{"text":" A classroom full of exhausted College Senior Level TIME CADETS sit in their classroom, staring down their PROFESSOR, Mid-30s, wearing a tweed jacket with elbow patches and a bow tie wrap up her lecture.\n","style":"act"},
{"text":"One student, CHRIS JENKINS, early twenties, wearing his green hoodie with “DR LORDE’S SCHOOL OF TEMPORAL MECHANICS” printed on the front, sits at his desk with his laptop in front, taking notes. Next to Chris, KATHLEEN MASON, mid-20s, skinny as a rail, hair disheveled, wearing the exact same hoodie as Chris, and black makeup, sits completely disinterested. She shakes her head in an attempt to wake herself up.\n","style":"act"},
{"text":"The professor points her laser pointer to drawings on a whiteboard, demonstrating what she’s saying.\n","style":"act"},
{"text":" PROFESSOR\n","style":"cha"},
{"text":" So to summarize the Bootstrap Paradox... You go back in tim... all of time and space with this little gem.\n","style":"dia"},
{"text":" The TIME CADETS stand and suffle out of the classroom. Chris and Kathleen follow.\n","style":"act"},
{"text":"PROFESSOR (CONT'D)\n","style":"cha", pageBreak: "before"},
{"text":"(yelling)\n","style":"par"},
{"text":"And don't forget, stay out of history!\n","style":"dia"},
{"text":" INT. TIME TRAVEL SCHOOL - MORNING\n","style":"sch","bookmark":"Begin"},
{"text":" A classroom full of exhausted College Senior Level TIME CADETS sit in their classroom, staring down their PROFESSOR, Mid-30s, wearing a tweed jacket with elbow patches and a bow tie wrap up her lecture.\n","style":"act"},
{"text":"One student, CHRIS JENKINS, early twenties, wearing his green hoodie with “DR LORDE’S SCHOOL OF TEMPORAL MECHANICS” printed on the front, sits at his desk with his laptop in front, taking notes. Next to Chris, KATHLEEN MASON, mid-20s, skinny as a rail, hair disheveled, wearing the exact same hoodie as Chris, and black makeup, sits completely disinterested. She shakes her head in an attempt to wake herself up.\n","style":"act"},
{"text":"The professor points her laser pointer to drawings on a whiteboard, demonstrating what she’s saying.\n","style":"act"},
{"text":" PROFESSOR\n","style":"cha"},
{"text":" So to summarize the Bootstrap Paradox... You go back in tim... all of time and space with this little gem.\n","style":"dia"},
{"text":" The TIME CADETS stand and suffle out of the classroom. Chris and Kathleen follow.\n","style":"act"},
{"text":"PROFESSOR (CONT'D)\n","style":"cha"},
{"text":"(yelling)\n","style":"par"},
{"text":"And don't forget, stay out of history!\n","style":"dia"},
{"text":"Oppose the man: Please go to page ","style":"link","target":"Oppose1","pageBreak":"after"},
{"text":" The boy opposes the man. Everybody cheers.\n","style":"act","bookmark":"Oppose1"},
{"text":" The boy steps off the stage\n","style":"act"},
{"text":" THE BOY\n","style":"cha"},{"text":" The play is over!\n","style":"dia"}
],
"styles":
{"sch":
{"margin":[0,10,0,0]},
"tra":{alignment:"right",margin:[0,10,0,0]},
"cha":{margin:[190,10,144,0]},
"dia":{margin:[110,0,110,0],_maxwidth:324},
"act":{margin:[0,10,0,0]},
"par":{margin:[144,0,110,0]},
"link":{fontSize:16,margin:[0,20,0,0]}},
"pageMargins":[70,70],
"pageSize":"LETTER"
}
On the left is the input as done by the user, and on the right is how PDFMake handles that input.
Here is the source for my project: https://github.com/seansimonanimation/Screentastic/