Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pdfmake in QuickJS #2795

Open
sallmann opened this issue Oct 3, 2024 · 0 comments
Open

Pdfmake in QuickJS #2795

sallmann opened this issue Oct 3, 2024 · 0 comments

Comments

@sallmann
Copy link

sallmann commented Oct 3, 2024

Hello together,
first I have to thank you for a great, well documented library.
After hopping through the examples, I decided that pdfmake would be a great addition to a small C++project embedding a quickjs (https://github.com/bellard/quickjs) javascript environment for scripting capabilities I'm currently working on.
I hoped I can use QuickJS to execute pdfmake for creating some pdfs.

But at least using the pdfmake.js in the build folder seems not to be the right approach... Looks like it is designed for web-client use only.
I've never went for Node.js or related projects, so hopefully there is any way to bundle the pdfmake relevant code for using in a QuickJS environment.

Perhaps anyone has a small hint achieving this?

import { require } from '/home/user/quickjs-require/require.js'

import * as std from "std";

import * as pdfmake from '../build/pdfmake.js';

var Roboto = require('../fonts/Roboto');
pdfmake.addFonts(Roboto);

[...]
~/pdfmake/examples $ /home/user/quickjs/qjs absolute.js    
TypeError: cannot read property 'navigator' of undefined
    at <anonymous> (../build/pdfmake.js)
    at apply (native)
    at <anonymous> (../build/pdfmake.js:60339)
    at 6549 (../build/pdfmake.js:60340)
    at call (native)
    at __webpack_require__ (../build/pdfmake.js:73301)
    at 428 (../build/pdfmake.js:6099)
    at call (native)
    at __webpack_require__ (../build/pdfmake.js:73301)
    at 2736 (../build/pdfmake.js:6365)
    at call (native)
    at __webpack_require__ (../build/pdfmake.js:73301)
    at 9921 (../build/pdfmake.js:27865)
    at call (native)
    at __webpack_require__ (../build/pdfmake.js:73301)
    at <anonymous> (../build/pdfmake.js:73366)
    at <anonymous> (../build/pdfmake.js:73369)
    at webpackUniversalModuleDefinition (../build/pdfmake.js:8)
    at <anonymous> (../build/pdfmake.js:73371)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant