Alright. I've started a project for a client of the shop I work for.
The details:
Take a 350 page policy and procedure manual that is currently in a monolithic PDF document, dump it into an SQL database, and set up a PhP driven, intuitive and dynamic web-interface for it.
The requirements:
Joe-idiot manager at this company has to be able to add, delete and edit items in the manual without aditional software or training.
There must be a dynamic menu for browsing, and a search function
There must be support for images, tables, lists, etc. within the policy items
The entire manual MUST be available to be printed at any time, with a full table of contents that includes page numbering.
I can figure out how to do everything except for the page numbered table of contents and numbered pages for print. I mean, it's easy to just get all of the Chapters, sections, and topics from MySQL and print a list of them in order, but I can't figure out a way to get PhP to figure out how to separate information by 8 1/2 * 11 printable pages. If I could do that, numbering and adding the Table of Contents would be a snap.
And there has to be dynamically numbered pages because if Joe-idiot manager goes and adds thirteen paragraphs to section 17-2b, then that would offset the numbering scheme on all of the pages after that, and they would have to be recalculated.
The good news:
Because my shop supports (and made) all of the computers that this business runs on, I know what my target browser / OS / printer setup is, and I have limited access to the server that it's running on, so I can set up custom scripts and programs (linux) if I need to.
Ideas that I had:
finding out how many lines of text are in a page at my specified font, and counting lines (but this is made harder by the presence of images and tables)
XML/XSL-FO page formatting options
Dynamic Page-Numbers and Numbered Table of Contents
Moderator: General Moderators
if using a monospace font, sized absolutely using pixels, i dont think it would be too hard. but i see your point about when adding images, tables, and larger font headings etc...
i could see it working if you specifically assign pixel measurements to everything, kinda like:
$line_break = 12; // pixels
$image_margin = 20;
$table_margin =20;
$cell_padding_top = 2;
and so on, although it would be a long list
but on the plus side you could have that directly correlate w/ a stylesheet,
which should simply it a bit.
does it need to support more than 1 type of content on the same line (like an image or table on the left w/ text wrapping around it on the right) ?
have you considered having them edit in a word processor which can output as html, then decode/parse the html output, clean it and update the db?
if you dont mind my asking, how much does a job like this pay? sorry if its rude to ask, im just curious.
i could see it working if you specifically assign pixel measurements to everything, kinda like:
$line_break = 12; // pixels
$image_margin = 20;
$table_margin =20;
$cell_padding_top = 2;
and so on, although it would be a long list
but on the plus side you could have that directly correlate w/ a stylesheet,
which should simply it a bit.
does it need to support more than 1 type of content on the same line (like an image or table on the left w/ text wrapping around it on the right) ?
have you considered having them edit in a word processor which can output as html, then decode/parse the html output, clean it and update the db?
if you dont mind my asking, how much does a job like this pay? sorry if its rude to ask, im just curious.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Yeah, it's looking kinda hopeless. I guess the best I can hope for is writing a PhP script to pull the information out of the database in a near-printable format, putting it into a Word / OpenOffice document and using a macro to do the page numbering and ToC.
Damn. And the whole point of this project was to remove a workload from my schedule.
We quoted $750 for this job. If I'd thought about the issues with the page numbering I would have quoted more.
Damn. And the whole point of this project was to remove a workload from my schedule.
We quoted $750 for this job. If I'd thought about the issues with the page numbering I would have quoted more.
To make the output formatted for 8.5/11 pages, just put it into a PDF - generated on the fly. You can put page numbers there as well. PDFLib has a lot of functions that tell you the height in pixels, of certain objects, such as images and a paragraph of text.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
The lite version of PDFLib looks somewhat restrictive, but while researching information on PDFLib I found out about FPDF, which is a free alternative. I'm pretty sure that one of those two libraries will contain the necesary functions for automatically numbering the pages as the document is created. That's the answer that I'm looking for. Thanks, pickle.