-
Notifications
You must be signed in to change notification settings - Fork 5
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
Printed PDFs not including contents of image fields/drawing widgets #59
Comments
view:curl --user enketorules: -d "server_url=https://api.ona.io/enketo&form_id=widgets&instance=<widgets><text_widgets><text>mart</text></text_widgets><media_widgets><signature>test.jpg</signature></media_widgets></widgets>&instance_id=someUUID&instance_attachments[test.jpg]=https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg" http://localhost:8005/api/v2/instance/view pdf:curl --user enketorules: -d "server_url=https://api.ona.io/enketo&form_id=widgets&instance=<widgets><text_widgets><text>mart</text></text_widgets><media_widgets><signature>test.jpg</signature></media_widgets></widgets>&instance_id=someUUID&instance_attachments[test.jpg]=https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg" http://localhost:8005/api/v2/instance/view/pdf > ~/Downloads/pdf1.pdf
Likely an issue with using canvas headlessly. This is a workaround that works but it causes a big slowdown: const canvases = await page.$$('canvas');
for (const canvas of canvases) {
const str = await canvas.screenshot({ encoding: 'base64' });
const dataUrl = `data:image/png;base64,${str}`;
await canvas.evaluate((canvas, dataUrl) => {
const newDiv = document.createElement('div');
newDiv.innerHTML = `<img src="${dataUrl}">`;
canvas.parentNode.replaceChild(newDiv, canvas);
}, dataUrl);
} A similar solution that does the same on the client directly will likely work too. Would be better to resolve the issue though. https://bugs.chromium.org/p/chromium/issues/detail?id=809065 Tried setting const originalGetContext = HTMLCanvasElement.prototype.getContext;
HTMLCanvasElement.prototype.getContext = function (a, b) {
return originalGetContext.call(this, a, b || { alpha: true });
}; |
copied issue here: enketo#969 |
Internal PR: OpenClinica/enketo-express-oc#627 |
Describe the bug
When printing participant casebooks from formprint.openclinica-dev.io, the contents of fields that contain images (Signature widgets, drawing widgets, annotated images) are not appearing in the resulting PDF. The fields are blank.
To Reproduce
Create a from with a signature item, drawing item, or image upload item, fill it in, and print the PDF casebook. The casebook includes these items but the image fields are blank.
Expected behavior
The filled in images appear in the resulting PDF.
Screenshots
The text was updated successfully, but these errors were encountered: