PDF generated by web form

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
0
Hi people!

I need to set up an HTML web form to generate a .pdf using submitted text and a .jpg image. Most of the .pdf content will be standard and already there, so the user is just adding an image and some text.

My first thoughts were wkhtml2pdf and maybe Imagemagick if the submitted image won't be correctly sized in advance (I'm not sure if it will). I'm not sure I'll have root access to their hosting though to install those and was wondering if there's a nicer way of doing this now? Thanks in advance :)
 

majestic1805

Honorable
Oct 1, 2012
69
0
10,590
3
PDF stands for Portable Document Format. It exists to ensure a consistent document appearance regardless of print or display device. So, if the same document needs to appear on a series of displays or printed then PDF is usually the way to go.

That said, it sounds like you're doing a pretty controlled thing whose end result is a folded document. PDF isn't necessary there as long as you're in control of the printing process so you can ensure quality and correctness of print though it can help minimize the tweaking you might otherwise encounter.

The above can sound a bit opaque but I used to work for a printing company for a while and it can be a fairly complex process. At the end of the day PDFs can generally get the job done okay.
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
0
I may actually use this:

[cpp]<div>
<a href="javascript:void(location.href='http://www.pdfspot.com/html-to-pdf-converter.aspx?url=' + escape(location.href)+'&pdf_name=' + escape('') + '&pdf_orientation=portrait&pdf_page_size=A4&scripts_enabled=true' )"
title="Convert HTML to PDF" style="font-family: Verdana;font-size: 12px; color: #4579ae; text-decoration: none">
<img src="http://www.pdfspot.com/pdfimg.aspx" alt="Convert HTML to PDF" style="border-style: none" />&nbsp;Save As PDF
</a>
<noscript>
<a href="http://www.pdfspot.com" title="HTML to PDF">Online HTML to PDF Converter</a>
</noscript>
</div>[/cpp]

Seems to just submit the page it's placed on to pdfspot.com's server and does the work for you!
 

majestic1805

Honorable
Oct 1, 2012
69
0
10,590
3
To my knowledge there are a few HTML to PDF tools out there but they generally cost money. "Free" ones like you listed I don't trust if the site is anyway associated to conducting business since there are no formal agreements there are no guarantees for the buisness you're working for. Personally, I really like http://itextpdf.com/. You have to code your own implementation but it's free and good for commercial use and carries the implicit benefit of being able to implement it according to what's best for your client.
 

randomizer

Distinguished
Moderator
Jul 24, 2006
880
0
19,260
62
wkhtml2pdf is hit and miss. I've found that the Windows binary works quite well, but the Linux binary is pretty poor and often just doesn't work even for relatively simple HTML. Since you will almost certainly be running it on a Linux web server this could be a problem.

If you are relying on this for business purposes then you will want to purchase a converter with proper support rather than relying on a poorly maintained project with dubious reliability.
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
0
Thanks for the responses! What kind of coding would iText require? I may not get root access to their hosting so can't rely on being able to install anything.
 

majestic1805

Honorable
Oct 1, 2012
69
0
10,590
3
When I used it, I didn't have to install anything. It can be used with either Java or .Net.

As far as coding goes you'd have to setup your document and content parameters in code. Naturally, the more complex your document the more complex your code will need to be. If you have a template PDF you could then just load that PDF and add only additional content as needed so you wouldn't have to code everything. It's been around for a while and has a large support site so there are a lot of tutorials and snippets out there to give you an idea of what the code would look like.

It fully supports rights management (no printing, saving etc) and encryption as well so you get those options as well.
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
0
Alright no good for me then - I'm not a programmer. I can write PHP but that's it. Is Doculicious any good? I've emailed them to ask about the functionality, but no response.
 

majestic1805

Honorable
Oct 1, 2012
69
0
10,590
3
Then please take this with even more weight. Get some sort of written agreement between the department/agency/etc you're working for and the target supplier. This is probably over your head so get someone authorized to make these agreements involved. Either that or get your contact/boss/etc involved and pay for a service from a clearly official government account. Either way you'll need to liaise with the provider as government gets a lot of nifty privileges in most sectors of business. However, what you're looking for is a guarantee of service and reasonable terms if they can't meet that level of service.
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
0
Sounds like solid advice - appreciate it. I had been thinking about what happens if the converter site goes down etc. I'd think they'd be willing to budget for a reliable system.
 

majestic1805

Honorable
Oct 1, 2012
69
0
10,590
3
I just think government systems, especially ones open to the public, should contain the most up to date information and be on the most reliable systems even when compared to commercial businesses. I know it's often not the case though. :p
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
0
Well this is actually just for generating leaflets for mailing out to neighbourhoods that will be affected by utility works, that kind of thing. So they just change a few details on it and the map.
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
0
I'm not sure... the idea was that the designer creates a .pdf template for the leaflet with a space left for a map image and some text. Form then uploads and submits that image and some text to fill in the boxes. So I was thinking I'd create and style the leaflet in HTML based on the .pdf design, then convert the result (with image and text inserted) to .pdf to be printed.

Now that I think about it, I'm not sure why it even needs to be in .pdf format though, surely they could print out the HTML? There's no benefit to it being .pdf is there?
 

majestic1805

Honorable
Oct 1, 2012
69
0
10,590
3
PDF stands for Portable Document Format. It exists to ensure a consistent document appearance regardless of print or display device. So, if the same document needs to appear on a series of displays or printed then PDF is usually the way to go.

That said, it sounds like you're doing a pretty controlled thing whose end result is a folded document. PDF isn't necessary there as long as you're in control of the printing process so you can ensure quality and correctness of print though it can help minimize the tweaking you might otherwise encounter.

The above can sound a bit opaque but I used to work for a printing company for a while and it can be a fairly complex process. At the end of the day PDFs can generally get the job done okay.
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
0
Only thing I'm thinking there is that the .pdf is being generated from HTML anyway, so some rendering engine (I know Webkit is used in wkhtml2pdf) is interpreting the HTML/CSS and generating the .pdf based on that page rendering. If the same browser was always used to view the page, wouldn't it achieve the same result?
 

sam_p_lay

Distinguished
Mar 26, 2010
81
0
18,580
0
Alright, I'm gonna propose a non-PDF solution and see what they think. I'll come back if they insist on PDF. Thanks for helping me out once again, majestic - really appreciate your time :)
 
Thread starter Similar threads Forum Replies Date
K Apps General Discussion 1
H Apps General Discussion 2
A Apps General Discussion 2
K Apps General Discussion 2
hoover1979 Apps General Discussion 2
wanamingo Apps General Discussion 3
P Apps General Discussion 4
M Apps General Discussion 4
B Apps General Discussion 4
wanamingo Apps General Discussion 1
T Apps General Discussion 3
V Apps General Discussion 6
F Apps General Discussion 4
F Apps General Discussion 5
henrythechief Apps General Discussion 2
J Apps General Discussion 2
I Apps General Discussion 1
B Apps General Discussion 6

ASK THE COMMUNITY