Forum Discussion
Creating downloadable pdf files in Storyline - an update on earlier methods
š³šš¾šš¾ ššŗšš¾ š»š¾š¾š ššŗšš š¾šš¼š¾š š š¾šš ššššš ššš¾š ššš¾ šš¾šŗšš šš š¼šš¾šŗšššš šš½šæ šæšš š¾š š»š ššššš š©šŗššŗš²š¼šššš šæššš šššššš š²ššššš ššš¾ (š¾.š. Saving Storyline Variables to a PDF - Articulate Storyline Discussions - E-Learning Heroes) šŗšš½ šØ ššŗšš¾ ššŗš½ šš¾š š šæššš ššŗšš šš¾ššš¾š šš šššš šššš¾ ššš¾š šØ ššŗš ššššššŗš š š šššššš šš šæššššš¾ šš ššš šæšš šššš¾š šæ.
š¬ššš ššæ ššš¾ šŗšššš¼š š¾š (š ššš¾ ššš¾ ššš¾ šŗš»ššš¾) šŗšš¾ šæšŗššš š šš š½ ššš šŗšš½ šŗš½ššš¼šŗšš¾ ššššš ššš¾ š©šŗššŗš²š¼šššš š¼šš½š¾ š šš»ššŗšš "šššÆš½šæ". š ššššš¼šŗš šŗšššššŗš¼š šššš š½ š»š¾ šš š¼šŗššššš¾ šššš š š¾šŗššš¾š'š ššššš ššššš šš¾šš š¾šššš ššŗšššŗš»š š¾š šš š²ššššš ššš¾ - šŗš ššš¾ š¾šš½ ššæ ššš¾ š¼ššššš¾ ššš ššš¼š šš½š¾ šŗ š»ššššš šššŗš šššššš¾šš šššš¾ š©šŗššŗš²š¼šššš šššš¼š šššš š½ ššš¾š šš¾šššš¾šš¾ ššš¾ š²ššššš ššš¾ ššŗšššŗš»š š¾š, šš¾šŗš½ šš šŗ ššš šš ššš šššŗšš¾ ššæ šŗ šš½šæ šæšš š¾ ššŗšš¾, šššš¾šš ššš¾ šš¾ššššš¾š½ šš¾šš šŗš ššš¾ šŗššššššššŗšš¾ š šŗšš½ š š¼šššš½šššŗšš¾š šš ššš¾ ššŗšš¾, šŗšš½ ššš¾š š¼šŗš š šŗ šæššš¼šššš šš "ššŗšš¾" ššš¾ šš¾ššš ššŗšš š¼šššš š¾šš¾š½ šš½šæ.
š³šš¾ š š¾šŗššš¾š (š½š¾šš¾šš½ššš šš ššš¾šš š»ššššš¾š) šššš š½ š»š¾ ššš¾šš¾ššš¾š½ šššš šŗš šššššš šš 'ššŗšš¾' šš 'š½šššš ššŗš½' ššš¾ šæšš š¾.
š¢šš¾šŗšššš ššš šššš š¾ ššŗšš¾ šš½šæ'š ššŗš š¼šššš šš¼šŗšš¾š½ - š»šš šŗš šš šššššš»š š¾. šØ'šš¾ šš¾šššššŗš š š š½ššš¾ ššŗšš ššš¼š¼š¾šššæšš ššššš¾š¼šš ššššš šššš šŗšššššŗš¼š šæšš š½šššš ššŗš½ššš š¼ššššš¾ šššš¾š, ššššš¾š šš¾ššš šš šš š¼š¾ššššæšš¼šŗšš¾š.
š¦š¼ ššµš š®šŗ š š»š¼š š®š±šš¼š°š®šš¶š»š“ š® š±š¶š³š³š²šæš²š»š š®š½š½šæš¼š®š°šµ?
š¶š¾š š , š ššš¾ ššš¾ šŗšššš¼š š¾š, šššÆš½šæ šš šŗ š šš»ššŗšš šššŗš ššŗš š»š¾š¾š šŗššššš½ šššš¾ šššš¾. šØš š½šš¾š šŗ šššš½ ššš» šŗšš½ ššššššŗšš½š ššæ š©šŗššŗš²š¼šššš ššššššŗššš¾šš šš¾š š šš šš. šØš š¼šŗš š¼šš¾šŗšš¾, šŗšš½ ššŗšš¾ šš½šæ'š šššš šæššš¾. š§ššš¾šš¾š, šŗ šššš¾ šš¾š¼š¾šš š©šŗššŗš²š¼šššš š šš»ššŗšš "šš½šæ-š šš»" ššŗš šŗ š«š®š³ šššš¾ šæššš¼šššššŗš ššš. šØš ššŗšššš¼šš šŗš, šš š¼šŗš
ššš½ššæš š¾ššššššš šš½šæ'š
š¼šš¾šŗšš¾, šæšš š šŗšš½ šæš šŗššš¾š šš½šæ šæšššš
šŗš½š½, šššš¾šš šŗšš½ šš¾šššš¾ ššŗšš¾š šæššš šŗ šš½šæ
...šŗšš½ šŗ šššš š¾ š šš šššš¾.
š³ššš šš¾šŗšš šššŗš ššššš¾šŗš½ ššæ ššŗšššæšš š š ššššššš ššš ššš¾šš¾ ššš šš¾š¾š½ šš šš šŗš¼š¾ ššš¾ šš¾šš šš š¾šŗš¼š ššŗšš¾ ššæ ššš¾ šš½šæ, ššš š¼šŗš ššššš š š½š¾šššš šŗ šš½šæ šæššš, ššŗšš¾ ššš¾ šæšš¾š š½š šŗšš½ ššš¾š ššš¾ ššš¾ šš¾šššš¾šš¾š½ ššŗšššŗš»š š¾š šæššš š²ššššš ššš¾ šš 'šæšš š ' ššš ššš¾ šæššš.
š¶š¾ ššŗšš¾ š»š¾š¾š šŗššŗšš¾ ššæ šš½šæ-š šš» šæšš šššš¾ šššš¾ š»šš šš¾šš¾š šæšššš½ ššš¾ šššš¾ šš š½š šŗššššššš šŗš»ššš šš (ššššš ššš¾ šš š½ ššššššŗššš¾šš' šŗš½šŗšš¾ "ššæ šššš š¼šš½š¾ šš ššššššš š½šš'š ššš šŗšš½ šæšš šš"). š®šš¾š ššš¾ š¢šššššššŗš š»šš¾šŗš šš-š»š¾ššš¾š¾š š¼š¾š š¾š»ššŗššššš (šŗšš½ šššš»šŗš»š š šæšš¾š š¾š½ š»š ššš ššš¼š šæš¾ššššš¾ šššššš šš šš¼š¼šŗššššš) šš¾ šš¾šš¾ šŗš»š š¾ šš šš¾š šŗ šš¾š (š»šš šš¾šš š»šŗššš¼) š½š¾šššššššŗšššš ššššššš šššš¼š š¼šŗš š»š¾ ššš¾šš¾š½ šš¾šš¾:
https://demo5.profilelearning.com
š®š, šššš ššš'š šŗ šš¾šš ššššš¾ššššš¾ š½š¾šš - š»šš šš¾ šŗšš¾ ššššššš šš šš - šŗšš½ ššš š ššš»š ššš ššš šš šššš¾š¾ šššš¾ šŗšššš¼š š¾š š¾ššš šŗššššš šŗ š»šš šššš¾ šŗš»ššš šššš š¼šš½š¾ š šš»ššŗšš šŗšš½ šŗš šš šŗš»ššš 'ššš½š¾šš š©šŗššŗš²š¼šššš'
šššš šš¼ ššµš²š šš¼ššæ š®š½š½š²šš¶šš² š® š¹š¶ššš¹š² š³ššæššµš²šæ šš¼ šÆš¼š¼šøšŗš®šæšø ššµš¶š š½š¼šš - šš² š®š¹šš¼ šµš®šš² ššµš² š®šÆš¼šš² š±š²šŗš¼š»šššæš®šš¶š¼š» šš¼šæšøš¶š»š“ š¶š» š„šš¦š....
- LearningSapiensCommunity Member
Thanks to John for the wonderful idea. I did tweak this a bit. My requirment was to just create a pdf with the user responses for many text entry boxes. However I am stuck at one point. Once the text overflows the page, how do I go to the next page? Any javascript experts who can help with this?
Here is the javascript code:
//Retrieve Player Variables
var player = GetPlayer();
learnerName = player.GetVar("name");
learnerEmail = player.GetVar("email");
learnerMessage = player.GetVar("message");
createPdf();
async function createPdf() {
await import("https://unpkg.com/pdf-lib@1.4.0/dist/pdf-lib.min.js")
const { PDFDocument, StandardFonts, rgb } = PDFLib;
// Create a new PDFDocument
const pdfDoc = await PDFDocument.create()
// Embed the Times Roman font
const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)
// Add a blank page to the document
const page = pdfDoc.addPage()
// Get the width and height of the page
const { width, height } = page.getSize()
// Draw a string of text toward the top of the page
const fontSize = 30;
page.setFontSize(fontSize);
const startX = 50;
const maxWidth = width - 10;
const lineSpacer = 8;
let startY = height - 130;
const textContent = learnerName + ' ' + learnerEmail
+ ' ' + learnerMessage;
// page.setFontSize(fontSize);
//page.drawText(textContent,{x:startX, y:startY});
const lines = page.drawText(textContent, {
x: startX,
y: startY,
color: rgb(0, 0, 0),
maxWidth,
lineHeight: fontSize + 5
});
pdfDoc.addPage();
// Serialize the PDFDocument to bytes (a Uint8Array)
const pdfBytes = await pdfDoc.save()
// Trigger the browser to download the PDF document
download(pdfBytes, "Sample.pdf", "application/pdf");
}Thanks!
- JohannesBurkeCommunity Member
Hi there,
I've been trying to create this PDF here and have been able successfully tweak it.
However, I've run into a separate issue: I was trying to flatten the PDF (so as to prevent it being changed after it was downloaded). However, this command didn't work (in my case):
form.flatten();
Does anyone know what can be done? Appreciate any support!
Thanks a lot,
John
- SarahNewman-804Community Member
Is anyone else having issues with this suddenly not working in Review? I haven't loaded to my LMS to test there, but I've tried uploading the original NoteTaker story with the original PDF in its root folder into Review and the button does nothing now. That makes me think that it isn't a problem with the JavaScript in the course I'm working on. Thoughts?
- PhilMayorSuper Hero
Have you checked the console for an error?
Sent from my iPhone- SarahNewman-804Community Member
I'm a super beginner at programming, so I'm not sure how to do that. What I know is that I made no changes to the storyline file or the PDF that I downloaded from the author and when I publish the Storyline file for Review (adding PDF to zip file), the Submit button does nothing.
- JohannesBurkeCommunity Member
Still working here, but I'm using a different PDF library.
- JohannesBurkeCommunity Member
I recommend doing the following:
- Open console (on your browser (e.g. Chrome)).
- Check the error message (you'll likely receive).
- Copy your Java Script code into Chat GPT and ask Chat GPT to debug it.
I've had some pretty cool experiences with Chat GPT this way. I'd say it's quite likely it'll be able to help you, too.
- PhilMayorSuper Hero
Agree about opening the console.
Chat GPT may solve it if not post back
- SarahNewman-804Community Member
I found the console and looked at the Storyline file in Review. I see an error saying that it failed to load the PDF "Failed to load resource: the server responded with a status of 403 ()" and there's a web address. I clicked it, which led to this message:
This XML file does not appear to have any style information associated with it. The document tree is shown below.<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>Q4NR5B9HSKPHYTRB</RequestId><HostId>gM7J3TsxetllsJbjTfxVjvg3CSCbJtSyB+n3Xl9x6UGwJZwLQoVimuZBn9fYhHNymhHqPCPmUrI=</HostId></Error> - PhilMayorSuper Hero
403 the resource is missing did it upload?
- SarahNewman-804Community Member
It looks like it uploaded just fine? I did "Upload New Version" with the zip file, which I had already pasted the PDF file into. The note taker opens up just fine, but when I enter text and hit submit, nothing happens.
- PhilMayorSuper Hero
Sorry my mistake 403 is forbidden access. So it maybe being blocked. You can check in the console if the file is there.
Sent from my iPhone
- JohnCooper-be3cCommunity Member
Hi Sarah
Sorry you are having difficulties with the demo. I must admit I hadn't tried it in Articulate Review, as I load demos on my own cloud server - but I just tested it and it seemed to work fine. As Phil says, the 403 error indicates there's some problem opening the file rather than the file being missing.
My zip file content looks like this:
with the "Notes Template.pdf" in the root folder with the story,html file.
I'm not sure what else I can suggest.
If the problem persists I can maybe record a short video of my screen as I load the demo to Review. If that would help?
- JohnCooper-be3cCommunity Member
Just a quick thought. The NotesTemplate.pdf file must be a pdf form file as the JavaScript reads the field information from the file. You could just check the file opens OK as a form... I doubt that is the problem - but worth checking...
- SarahNewman-804Community Member
The specifics: I'm working on a tool that allows learners to create a job plan based on the specifics of an installation/jobsite. They answer questions and the course/tool builds out a plan using variables.
I've gotten the full plan to populate on a single slide, and I can print that slide. My preference, though, is to send the plan to a PDF using JavaScript. I publish for Review locally and add the PDF form to the zip file. When I upload it and check the JavaScript by clicking the button it's attached to, I get this error:
AccessDenied
Access Denied0250CKGY273YHNBTyseYqDxfnAUPrgDNqmEbuhDBQbOcME2zQKaxYYocD9/yxbtXXw0tQWwvUaf27zQymsPEFvA9wYiyRPyf5fikeQ==Any thoughts about why this might be happening? I'm attaching the file in case you are able to look at it. Help would be much appreciated! I'll keep messing with a test file and see if I can figure it out in the meantime. :)
Hello Sarah,
Thanks for sharing a copy of your published output. It would be helpful if you could also share a copy of your Storyline 360 .story project file so members of the community can open your course and review how you have your slides setup.
Based on the error message that you encountered, its possible that the JavaScript code you added is trying to access a file that's in a secure location. You can troubleshoot this by moving your file to a publicly accessible location such as Google Drive or Amazon S3 and updating the JavaScript code to see if this helps.