I use primefaces extensions documentViewer to display pdfs:
<pe:documentViewer id="docViewerId" value="#{contentBL.inlineContent}" name="#{contentBL.getContentDataName()}" />
This works so far until I give the attribute name a value like in the code above. Then the viewer does not show the pdf with a message:
PDF.js Version 1.0.21 (build: f954cde)
Nachricht: InvalidPDFException
I want to define the name of the file if the pdf is downloaded.
I am using PF extensions 3.2.0.
Related
I got a problem when converting html string to pdf, to be simple, I found the Kendo js/css file I referenced in my html string looks like not working at all.
Detail:
I am working on a project that converting my views(ASP MVC 4.5
) to Pdf using Evo Pdf, in my view, I have used Kendo UI controls, so I reference the Kendo css js file like below in my view file
#Scripts.Render("~/Libs/KendoUI/js/kendo.all.min.js")
<script type="text/javascript" src="#Url.Content("~/Libs/KendoUI/js/kendo.all.min.js")"></script>
When I open the view in browser, all controls works fine, but when I render the view into string, and pass it to Evo SavePdfFromHtmlStringToStream function, the pdf is generated but all the Kendo controls are missing on the pdf.
Ps, I know maybe I can use the absolute URL to convert URL to Pdf, but I am using view with model(model are posted to controller), so I don’t really want to do that.
Actually, I found the solution 2 weeks ago from Evo team, I just need set a base url in the parameters, that's all, now works fine! thanks for all!
I am working with a Grails 2.3.6 application.
I tried many different things to generate PDF, but most of them failed.
Is it possible to generate a text file of the contents of GSP file? Then have a button called EXPORT and when user clicks on that, the text file will download into there system.
Will it be possible to do that by passing the URL of GSP file?
This is quite straightforward. You just need to specify the response type (text/plain) in the render method from your controller. You can have plain text in the gsp file and use the tags where needed.
def textFile = {
response.setHeader('Content-Disposition', 'Attachment;Filename="textFile.txt"')
render view: 'textFile', contentType: 'text/plain'
}
textFile.gsp:
Dear ${name},
This is a text file.
As for pdf, I recommend the amazingly good grails rendering plugin.
I want to increase the size of the Calendar view because the default size is too small for my web application. I've tried to add a cssClass to the datetimepicker tag but it doesn't work, even if I change the width or height the only thing it changes is the field, not the calendar itself.
I'll put an image so you can understand better the problem that I have:
The thing is that the text from the field is correctly viewed, but when I click the calendar button, it shows that tiny view and it's extremelly difficult to pick one date.
The code for the datetimepicker is this:
<sx:datetimepicker name="start_date" displayFormat="dd-MMM-yyyy" value="%{'today'}" />
Any guess?
Ok, It's finally solved:
First I tried to find the file named datefilepicker.ftl inside the struts2-core.jar but I didn't find anything similar.
So after a few hours trying to find which was the correct template of datetimepicker without any luck, I tried to solve my problem using JQuery because when I was searching for the answer I found out a datepicker tutorial using this library.
There's a plugin called Struts2-JQuery that provides you with ajax functionality and therefore with multiple customizations in different widgets.
It's quite easy to install, I just had to download the correct .jar which for me it was Version 3.5.1 ( jQuery 1.8.3, jQuery UI 1.9.2 ). Once I'd downloaded the file, I just had to paste it in the lib folder inside my project. After doing that, I added this line at the beginning of the .jsp file:
<%# taglib prefix="sj" uri="/struts-jquery-tags"%>
With these steps I had jquery functionality inside my .jsp file, so the only thing left to do is to add the datepicker widget:
First I chose the jquerytheme I wanted for my widget, just like this:
<head>
<sj:head jquerytheme="flick"/>
...
</head>
And then, I added my datepicker widget:
<sj:datepicker name="start_date" displayFormat="dd-MM-yy" value="today"/>
And that's it.
If you want to resize the datepicker calendar see the answer of this post:
How to resize the jQuery DatePicker control
<sx:datetimepicker name="start_date" displayFormat="dd-MMM-yyyy" value="%{'today'}" />
It is a dojo tag, so you should be changing the template file corresponding to this tag
Freemarker changes
check for something like datetimepicker.ftl in your workspace. That would be the file rendering your calendar. Any presentation related changes will be done in that file only.
debug using firebug
Another approach can be using firebug in Mozilla firefox and manually try to change the html rendered by the tag. There might lie some CSS solution to your problem
I'm using the ckeditor plugin for grails (:ckeditor:3.6.2.2) and I'd like to reuse the File Chooser used to select images inside the rich text editor. I'd like to use it in a form for selecting images.
The plugin documentation makes me assume this is possible:
"If you just need the link to the file browser there is a fileBrowserLink tag:
Open file browser
If you want get back the path of the selected item in the file browser simply define a javascript function called ckeditorFileBrowserItemSelected in the page containing the opening link.
<script type="text/javascript" charset="utf-8">
function ckeditorFileBrowserItemSelected(path) {
// do whatever you want with path
alert(path);
}
</script>"
http://stefanogualdi.github.com/grails-ckeditor/docs/ref/Tags/fileBrowser.html
Unfortunately I'm not getting it to work. If I use the above approach to create a link, I'm getting an exception:
errors.GrailsExceptionResolver MissingMethodException occurred when processing request: [GET] /Admin/courseTemplate/create
No signature of method: Users_antonepple_NetBeansProjects_Eppleton_Relaunch_Admin_grails_app_views_courseTemplate_create_gsp.fileBrowserLink() is applicable for argument types: (java.util.LinkedHashMap) values: [[type:Image, userSpace:userone]].
I also tried using the fileBrowser Tag like this:
<ckeditor:fileBrowser type="Image" userSpace="userone">Open file browser</ckeditor:fileBrowser>
As a result the File Manager opens instead of the FileChooser I'm looking for. The File manager doesn't allow to select an image.
What am I doing wrong, and what can I do instead to reuse the File Chooser?
OK, I figured out how to do it. The documentation has a typo instead of this:
Open file browser
it should be:
Open file browser
An advanced grails user would probably have spotted this earlier :-). The second problem was, that there was no way to select an image in the file manager. But as soon as the FileManager is opened in a separate window it has an additional action in a files context menu allowing me to choose an image. So I just need to:
Open file browser
...or open fileBrowser in a dialog and this action becomes available...
I'm using orbeon 3.8, and have next problem when I'm trying to print filled form (using oxf:pdf-template), all data displays as it supposed to, but xforms:select element displays text in lower case.
This happens only when pdf template is defined to the form.
Any suggestions on where can I change this behavior?
The file is probably print-pdf-template.xsl. This used to be, as of 3.8, embedded in print-pdf-template.xpl.