I have drupal 9 webform and files element (private file system), if i access the file its always downloaded, when i use pdf.js its not loaded.
I've add header Content-Disposition: Inline in the nginx conf
# Handle PDFs to display inline
location ~* \.pdf$ {
add_header Content-Type application/pdf;
add_header Content-Disposition "inline; filename=\"$uri\"";
try_files $uri /index.php?$query_string;
}
# Private files handled by Drupal
location /system/files/webform/ {
internal;
try_files $uri /index.php?$query_string;
}
# Custom handling for PDFs in private files
location ~* ^/system/files/webform/.+\.pdf$ {
types { application/pdf pdf; }
add_header Content-Type application/pdf;
add_header Content-Disposition "inline; filename=\"$uri\"";
try_files $uri =404;
}
Unfortunately the pdf still cannot open in the browser, its always downloaded.
I check in the Browser Header content Content-Disposition valeu is attachment.
But when i try to direct access via php it's work.
<?php
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="example.pdf"');
readfile('/system/files/webform/example.pdf');
Anyone can assist me how to make pdf in drupal private files can display in the browser, so I can display via pdf.js.
Thank you for help.
Thank you @AstonVictor
Its work for displaying, but not working for filter/exposed filter in date format.
tinohuda → created an issue.
I was installed latest dev version, but can't find "book" string to translate in /admin/config/regional/translate
plus 1
Same request.
Hi @arne_hortell
is #5 solved?
Anyone can help?
tinohuda → created an issue.
tinohuda → created an issue.
tinohuda → created an issue.
tinohuda → created an issue.
Hi @Monster971
Have you solve the problem? can you describe it.
There a thread https://drupal.stackexchange.com/questions/77325/how-to-view-pdf-files-i...
but not solved yet for years.
@orizonmedia I use {{ webform_submission.data.field1 }} and its worked. To make sure i use the Devel.
tinohuda → created an issue.
tinohuda → created an issue.
#3 [SOLVED]
i've done this by adding % at the end of Query Options JSON File form and create webform element using view type and add token [current-user:account-name] as view arguments.
Thank you.
Hi,
I have JSON like this:
[
{
"counter": "1",
"type": "typenode-A",
"uid": "username2",
"moderation_state": "Verify"
},
{
"counter": "2",
"type": "typenode-A",
"uid": "username2",
"moderation_state": "Valid"
}
]
how to implement uid value as contextual filter?
hope anyone can help, thank you before.
Hi @jrockowitz thank for your reply.
i'm not a programmer, i try to add this in Webform > Settings > CSS/JS:
jQuery(document).ready(function() {
// Get the autocomplete element and the textfield element.
var autocompleteElement = document.getElementById('edit-username-autocomplete');
var firstNameElement = document.getElementById('edit-field_first_name');
// When the user selects a username in the autocomplete element,
// update the first name element with the user's first name.
autocompleteElement.addEventListener('change', function() {
var username = autocompleteElement.value;
var user = Drupal.user.load(username);
if (user) {
firstNameElement.value = user.field_first_name;
}
});
});
But i got this error in console:
Uncaught TypeError: Cannot read properties of undefined (reading 'load')
at HTMLInputElement.
I hope you can help ;-)
and thank you again.
@arne_hortell
Thank you, you saved my day, its work when i add end of URL with / and row apath with [
Thnak you.
tinohuda → created an issue.
Hello @antcab
what is your Row Apath value in Query Setting Options?
I try / but nothing show up and i got message "No query was run".
Hope anyone can help.
Thanks before.
Some here within drupal 9.5.9,, no pop up when click setting on Views Layout Grid.
tinohuda → created an issue.
Hai @tanasi
for me is not working.
does this work for you?
Hi @Kris77
Thank for your code above.
I can use {{ content }} and all content can be print out in pdf.
But how to print out particular webform elements label and its values?
I try to use {{ data.field1 }} but nothing printed.
Please help anyone and thank before.
tinohuda → created an issue.
tinohuda → created an issue.
Hai @Lendude,
those module ( https://www.drupal.org/project/user_field_value → ) just work!
Thank you :-)
tinohuda → created an issue.
@jurgenhaas thank you for your direction and sample.
its so simple, i draw line and now i can add the condition.
very helpful
tinohuda → created an issue.
Thank you @longwave you saved my day.
I allow anonymous to access unpublished nodes, now the label showing up in postman and reqbin.
tinohuda → created an issue.