Write javascript script prototype-class to generate files of custom binary based format
$30-5000 USD
Cancelled
Posted about 12 years ago
$30-5000 USD
Paid on delivery
The project's goal is to write javascript script prototype-class to generate files of custom binary based format
References for use of this file format, sample source code to show how to create files of this format will be provided
The script will include functionality:
1) encode images into given format
2) generate binary buffer with the given binary format
3) functions to encode text and form binary file format
**PLEASE DETEAILED SPECIFICATION BELOW FOR MORE INFORMATION**
## Deliverables
BRIEF: Javascript prototype class to generate PDF files
LANGUAGE: Javascript
NEED TO IMPLEMENT:
1) functionality to generate PDF with font options (using predefined fonts in PDF), text, PNG and JPG images (with most basic flate compression)
2) html+js samples demonstrating the implemented javascript in work
USAGE OF 3RD PARTY CODE PARTS: not allowed
REQUIREMENTS:
1) code implemented as one single .js file
2) comments for every function implemented
3) compatibility with Firefox 1.6, Chrome, Internet Explorer 8 or higher on Windows, Mac and Linux platforms
REFERENCES on PDF format:
PDF format reference: [login to view URL]
Open source projects: iText (java): [login to view URL]
iTextSharp (c#): [login to view URL]
Open source [login to view URL]
JS CLASS IMPLEMENTATIOn
.pageSetSize(int pageSizeType); // pageSizeType is integer to set predefined page size, like 0 for A4 (default), and maybe some other
.pageSetOrientation(bool IsPortrait); // bool isPortrait defines (if true) if we should use portrait or landscape orientation for current page
.pageAdd(); // adds new page and uses new page for the output (while saves previously created pages)
.propertiesSet(string title, subject, keywords, author, creator); // sets info for the current PDF document
.fontSetCurrentName(string fontName); // set name for on of base 14 fonts (predefined fonts in PDF files), default font should be Arial
.fontSetSize(int fontSize); // set font size for the selected font
.fontSetStyle(bool bold, bool italic, bool underline); // set style for the selected font .fontSetColor(byte R, byte G, byte B); // defines the font color by RGB components possible variation is to implement .fontSetColor(int ColorIndex); // where ColorIndex sets one of 12 predefined colors like black, blue, green etc..
.textAddLine(int x, int y, string textString); // output text at given coordinates in PDF (x, y). Y coordinate is inverted in PDF (y starts from bottom left) but this function should accept Y coordinate if defined using zero point from left top corner
.imageLoadFrom(string imageSrc); // loads new image for use in PDF
.imagePlace(int x, int y); // places current image at given x, y coordinates
.generate(); // generates PDF and returns as a buffer
.generateToOutput(); // generates PDF and encodes as Base64 and returns to the browser (so it will be opened automatically in a browser) (by using [login to view URL] = "data:application/pdf;base64," + base64 encoded buffer
.generateAsAttachment(string fileName); // generates PDF and returns as an attachment (by using [login to view URL] = "data:application/pdf;name=fileName;base64," + encoded buffer fileName parameter defines filename to use for the attachment
NOTE: interface can be discussed if you feel it needs to be changed for better use from js