Jump to content

Simple HTML & CSS to PDF Script


FishSword

Recommended Posts

Thanks for your reply.

 

I'm trying to make a script similar to FPDF, but much simpler. All I want to do is create an A4 document, then alter the page(s) using HTML and CSS.

Do you know where I would need to start in making such a script?

 

How do I create a new pdf document, and insert HTML and CSS without using a ready made solution?

I'm against using a ready-made solution as it will make my original script more bloated.

 

Any help is greatly appreciated.

Link to comment
Share on other sites

The problem is that PDFs don't automatically use or interpret HTML or CSS.

 

If you want to use HTML- and CSS-like tags in a PDF, you have 2 options: 1. use a ready made solution that sort of does the job, or 2. create a new solution. If you want to get an idea of what it would take to create a new solution, I suggest that you download the source code for FPDF and take a look. And that's just a script to create a PDF, no HTML or CSS included.

 

Is there a reason that you need to use HTML and CSS in the PDF? If not, you can do anything that you can do with HTML and CSS (and more), but without the use of HTML and CSS tags.

Link to comment
Share on other sites

Using FPDF, you can do anything in a PDF that HTML/CSS can do on a web page: change fonts, colors, sizes, draw tables, place/resize images, create links within the PDF or to external websites, etc., etc., etc. You just need to learn how to use FPDF. There are tutorials and sample scripts on the website. One of the scripts that you can download allows some HTML tags, but I found it to produce unreliable results.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.