Generating pdf file using symfony framework - symfony1

I'm using Symfony 1.4 and I have to create pdf file from Word/HTML with some fields added by user using form.
I've met this problem in plain php few years ago, but I wonder if there is any ready solution in Symfony framework? Or someone wants to share his idea about this...

I've been using http://www.symfony-project.org/plugins/sfTCPDFPlugin with Symfony 1.4 and haven't run into any problems yet. The sfTCPDFPlugin provides abstraction for the TCPDF, an open source PHP class for generating PDF documents.

Related

Using Razor Templates Stored in Razor Class Library 3.0 (RCL) Without AspNetCore Web Application

I am using Razor templates (cshtml) to build HTML for use in emails. While I can get this all to work and I can send email from a ASPNetCore 3.0 web application I want to actually send email from another process which is NOT a web application. Ideally I would like to queue email, which can be triggered from any number of backend processes, and then send those from a timer like service which runs as a windows service or possibly a back-end worker running in Azure via something like Functions.
Is there any way to leverage razor templates from within a RCL in a .NetCore console or other application which is NOT hosted in AspNetCore??
I think there isn't a way to do this i am sry. :(
If I understand your question correctly, you can use RazorEngine, which I used in .NET Framework 4.6.2 Class Library. There is a .Net Core Nuget as well.
I referenced such Class Library projects from Console Applications, Windows Services and Azure Cloud Services (Worker Roles).
In my setup, I had to mark Razor files as Content so they are copied over to the bin folder. Also, it got more complicated if library is referenced by another library and then that library is used; content did not get copied over or it got flattened out (all razor views ended up in the root of the bin folder vs following directory structures), for which there is a fix by editing project file and adding your own copy build tasks. Or I had to embed razor views into DLL.
There might be improvements to this in recent years, as I said I used RazorEngine few years back. And it might be different in .Net Core RCL as well, but I believe it is possible.
Nowadays, I am using 3rd party services like SendGrid or MailJet. For me, using them avoids majority of the above issues and offers better insight into emails/templates/campaigns to Marketing and other non-tech users. They can edit and modify templates to their liking without (m)any code deployments.
You have to run the code through ASP.net core engine so that Razor code get converted into html.
Otherwise use simple html template.

How can I manage reactjs component files in Rails, since the app now has so many reactjs components?

I'm using react-rails gem to work with Reactjs in my Rails application. Everything works well until the frontend becomes to have so many components which were defined in the separated file.
The problem is every time the application was loaded, all of those files were downloaded to the browser. I know it is obvious, but kind of inefficient, because only a few react component will be used in a session.
Here is my current workspace:
--assets
----javascripts
------components
--------component_1.js.coffee
--------....
--------component_n.js.coffee
I just wonder is there any working solution to optimize this?
Reactjs does not support this, but there are other libraries you can use (requirejs for example).
A very good open source solution is LABjs.
Another one is https://webpack.github.io/.
There are others. See this discussion on reactjs site.

TypeScript in MVC

Im bulding a website using MVC4. Recently I've read about TypeScript. It looks really nice however I cannot find any use for it in a MVC website. Am I missing something? Do you use it? Where?
TypeScript is a pre-compiler for JavaScript. Hence you can use TypeScript only as a replacement for JavaScript (server-side, e.g. Node.js, or client-side, i.e. in the browser).
As you are probably writing MVC4 code with C#, TypeScript will be of no use for you in relation to MVC4.
Regarding the client-side it's somewhat different.
I guess the main point you need to know is that TypeScript is not (yet) just another language on the server, that you can exchange with C#.
I find it quite useful for building largish apps with lots of logic on the client. The interfaces help avoid some errors. It compiles to javascript so you could use it instead of javascript. If you're just writing a couple of lines I wouldn't bother though.
You can link to the generated javascript files from TS files directly in the script bundles or HTML. If you want to automatically link to many JS files, use require JS. This will save you having to link to many js files.

Get a 'cannot find file or it is invalid' error when trying to create a site from a custom STP file in Sharepoint

I am trying to create a site programmatically in Sharepoint but I keep getting an error saying that Sharepoint can't find the file or it is invalid.
The file is there because I can see it via the web interface, and I've written some helper code that loops through and displays the custom templates using GetCustomWebTemplates(1033).
I have been able to create a site via the web front end using one of Sharepoint's default templates, but when I try and do the same using one of the custom templates (STP files) that I've created I get the same error.
When I create the custom STP files there are no error messages or warnings but is there something I'm doing something wrong when I'm creating custom STP files?
Or is there something else that's more obscure?
I am using Sharepoint 2007 on Windows Server 2008.
Any tips or comments gratefully accepted.
I think I answered my own question when I was asking it. The problem was with some of the custom templates I was creating. I found that one of the sites I was using to create templates worked fine.
So, I guess a new question could be what's up with the site that creates bad templates? Searching through a 4 MB manifest.xml file isn't much fun, and don't worry I'm not going to ask that question.

CKEditor Image Upload

I am looking to include CKEditor in a project I am working on and I need the image upload support provided by the CKFinder plugin, however I do not particularly need the rest of the CKFinder tool and thus purchasing a license is a little overkill. Has anyone taken the time to implement a custom image uploader for CKEditor 3 that will work with ASP.NET MVC? If need be I can create my own, just wanted to check here first.
Alternatively, does anyone know of a decent WYSIWYG editor on par with CKEditor / Cute Editor that supports image uploading and will work in ASP.NET MVC?
Here is a image uploader I originally wrote in ASP.NET WebForms for Fckeditor (hence the theme no longer matches), that I've modified to work with Ckeditor.
https://github.com/mcm-ham/ckeditor-image-uploader
Update: I've now added an example showing how you can add this WebForms image uploader to a MVC project.
Update 2: I've now added a Razor Pages version which can be used in .NET Core MVC projects.
Here is a tutorial on how to upload image with ASP:NET MVC2 (not Webforms) using CKEditor
http://arturito.net/2010/11/03/file-and-image-upload-with-asp-net-mvc2-with-ckeditor-wysiwyg-rich-text-editor/
I have used ckeditor and the upload control using ASP.NET, but not MVC specifically. I haven't found anything on par with ckeditor that is even close to being as easy to set up or offers the same features.
Not sure of the restrictions for MVC, but I set up file upload support by using the following:
The basic documentation referring mostly to the CKFinder plugin you mentioned:
http://docs.cksource.com/CKEditor_3.x/Developers_Guide/File_Browser_%28Uploader%29
Better documentation on how to implement the upload component:
How can you integrate a custom file browser/uploader with CKEditor?
Otherwise, I believe ckeditor just stuffs all the image bytes in the request object and sends it to the page configured for uploading. This page can take those bytes and do whatever it pleases (i.e. save them to the file system, sql server, etc.) This is where the custom implementation comes in.
Instead of using a page to do the upload, I used an httphandler implementation. The page ckeditor redirects to calls the requisite javascript function to indicate the status of the upload after it is complete, but the handler really controls the actual file upload. The basic implementation for the httphandler I used is at:
http://darrenjohnstone.net/2008/07/15/aspnet-file-upload-module-version-2-beta-1/
Hope this at least gives you a starting point.
UPDATE: found this while searching for some other stuff. Didn't look at in depth, but seems to be right up your alley:
http://interactiveasp.net/blogs/spgilmore/archive/2009/06/03/how-to-support-file-uploads-in-asp-net-mvc.aspx
If you need to implement it quickly and have a reliable solution, you may consider a hosted solution to upload and store images for CKEditor - for example, our plugin:
http://ckeditor.com/addon/uploadcare

Resources