question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JS to WASM Examples for direct FPDF* function calls

See original GitHub issue

1# Is it possible to provide an example of bypassing the convenience functions defined in custom.cpp such as this one: https://github.com/paulo-coutinho/pdfium-lib/blob/8fac2c1cc09e5465b9dbb0dcb3156622aa41555e/extras/wasm/utils/custom.cpp#L80 and calling FPDF* functions directly from JavaScript instead?

Some issues such an example would help solve

  • control PDF_SCALE for matching dimensions with other PDF renderers
  • skip FPDFBitmap_FillRect for a transparent canvas background
  • control FPDF_RenderPageBitmap for page rotation and size

2# How can we call functions that take FPDF_BYTESTRING from JavaScript, such as this one? https://github.com/paulo-coutinho/pdfium-lib/blob/8fac2c1cc09e5465b9dbb0dcb3156622aa41555e/extras/wasm/utils/custom.cpp#L59

Some issues such an example would help solve

  • FPDF_LoadMemDocument(buffer, length, **password**)
    become able to load password-protected PDF files

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
paulocoutinhoxcommented, Jun 3, 2021

Do you this code with rotation?

Anyway i put a new version with your code mixed with mine. It is nice there.

Thanks.

0reactions
dandansoysaucecommented, Aug 4, 2021

Hi @cetinsert, do you have any updates on rotation? It seems like it isn’t being used.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Interacting with code — Emscripten 3.1.26-git (dev ...
Using direct function calls (faster but more complicated). Call compiled C++ classes from JavaScript using bindings created with: Embind or WebIDL-Binder.
Read more >
memory alignment issue that only occurs with specific buffer ...
In a project compiled with emscripten (em++) to WASM, calls to a function with some image dimensions keep triggering memalign memset free ...
Read more >
Importing Javascript Functions Into WebAssembly
In this example, we will import and implement a simple console.log which is called within Wasm. This example is inspired by the console_log...
Read more >
Calling JavaScript code from C/C++ using WebAssembly
Today, we will be discussing how to call JavaScript code from C/C++ with and ... Here, we have passed the console.log function to...
Read more >
sitemap-questions-34.xml - Stack Overflow
... .com/questions/99552/where-do-pure-virtual-function-call-crashes-come-from ... https://stackoverflow.com/questions/249467/what-is-a-simple-example-of- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found