Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] PDF data-sheet maker v.1.1


alverman

Recommended Posts

PDF data-sheet maker v.1.1

 

UPLOADED AS A NEW PACKAGE -> ERROR , Harald please move it to the correct location, thank you.

 

* Fixed some bugs of v1.0 and added some fatures.

* Images can have peculiar dimensions but proportions are maintained (settings in config file)

* Use of alternate image (es.: product_bimage) is now possible (set DB field name in config)

* Images other than .jpg .jpeg .png are replaced w/ "No Image" rectangle, but the rest of the document is rendered correctly.

 

Printed data will show:

* store name

* products category (path)

* products image (jpg or png shown only)

* description

* model

* manufacturer

* price (w/ - w/out tax)

* special price and expiry date

* options and options prices

* date of availability

* e-mail link

* Store Name watermark

 

Many thanks to David Rahrer for testing and corrections, and to Robert (Druide) for providing code improvement.

 

NOTES:

* tested on 2.2_MS1 Feb 21, 2003 , 2.2_CVS Jan 17, 2003.

* live example at http://www.chilipepper.it/catalog/

* feedback appreciated.

 

ivan

Link to comment
Share on other sites

  • Replies 179
  • Created
  • Last Reply

Top Posters In This Topic

i had a blackout for a minute, had no clue what i had done but after looking at your site... :oha: :onfire: LOL

 

nice improvement !

Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Link to comment
Share on other sites

:whaasup:

btw did you also thought of this in pdf/fpdf.php

 

find in line 990

	//Output PDF to file or browser

global $HTTP_ENV_VARS;



if($this->state<3)

 $this->Close();

if($file=='')

{

 //Send to browser

 Header('Content-Type: application/pdf');

 if(headers_sent())

	 $this->Error('Some data has already been output to browser, can't send PDF file');

 Header('Content-Length: '.strlen($this->buffer));

 Header('Content-disposition: inline; filename=doc.pdf');

 echo $this->buffer;

replace by

	//Output PDF to file or browser

global $HTTP_ENV_VARS, $products_id;



if($this->state<3)

 $this->Close();

if($file=='')

{

 //Send to browser

 Header('Content-Type: application/pdf');

 if(headers_sent())

	 $this->Error('Some data has already been output to browser, can't send PDF file');

 Header('Content-Length: '.strlen($this->buffer));

 Header('Content-disposition: inline; filename=' . STORE_NAME . '_item' . $products_id . '.pdf');

 echo $this->buffer;

 

i changed the

global $HTTP_ENV_VARS;

to

global $HTTP_ENV_VARS, $products_id;

 

and

Header('Content-disposition: inline; filename=doc.pdf');

to

Header('Content-disposition: inline; filename=' . STORE_NAME . '_item' . $products_id . '.pdf');

 

 

now if the visitors rightclick on the PDF image they are able to download the PDF datasheet WITH 'Your store name'_item'id'.pdf

 

Thought that you all would like that ;)

 

Ofcourse you can adjust it to any field but then you will have to parse other/extra fields in catalog/product_info.php (right now the product_id is only parsed to lookup the right data in PDF Datasheet)

 

Have a good one you all

Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Link to comment
Share on other sites

Nice one Robert,

 

I was trying to do that also when printing to browser, so that the page <title> would look different than

http://www.store.it/catalog/pdf_datasheet.php?products_id=49

but I think you have to save the PDF to server first and then download it.

ivan

Link to comment
Share on other sites

  • 4 weeks later...

hello,

i have MS1 and PDF data-sheet maker_v1.1(MS1), when i click the pdf-gif using IE6 there comes an error and white site, in mozilla 1.2.1 it works fine. where is the problem and how can i fix it.

:?: :oops:

 

Reinhold

Link to comment
Share on other sites

I had the same problem!

 

It took me a while to figure it out, but I finallyfound that it has to do with the new "GZIP compression" features.

 

I was able to turn off the GZIP compression in the admin console, and then the PDF datasheet started working again.

 

I'll play with the code a little bit, but I figured you would like to know in case you want to zero in on it a little too.

Link to comment
Share on other sites

Try this....

 

In application_top.php change:

 

 if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') ) {

to this

 

 if (!(NO_GZIP_THIS_PAGE) && (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') ) {

 

then on pdf_datasheet.pdf add this line ABOVE the call to application_top.php

define('NO_GZIP_THIS_PAGE','true');

 

This might be a little crude, but it looks like it works.

Link to comment
Share on other sites

Hello everybody,

special thanks to Ivan for his work in Data Sheet Maker, it has resolved me a big problem but there is still one thing that resists to work properly. I can download the pdf file from the icon in the catalog but when i open it i see everything ok but i dont see the image, it looks like it hasnt generated the image.

Could anybody help me with this problem please??

I have seen it working in http://www.chilipepper.it/catalog/

it is just what i need but the image is missed, what can i do?

 

gracias

thanks

 

saludos!!!

Link to comment
Share on other sites

I think whats really necessary for the PDF sheet make is the ability to email the PDF to someone (or yourself).

 

Theres no point in viewing a PDF in the browser (because we could have viewed the item in a normally browser).

 

We are ok right-clicking and using Save As (as we're technically minded).

 

But ideally the PDF option cna be used for emailing /printing /downloading.

 

Just my thoughts.

 

What do you think ?

Special Effects / 3d + Flash

Link to comment
Share on other sites

I don't think that would be too difficult, and probably a very useful app.

 

In the pdf/pdf_datasheet_functions.php file at the very bottom is where the PDF is created. You could basically change the last few lines starting with:

   // Prints content to browser

   $pdf->Output("",false);

 

Instead, do something like this... (which saves the pdf as a local file in a tmp directory *write permissions required*, and then emails it...)

 

   // save content to local tmp directory

   $pdf->Output('tmp/' . STORE_NAME . '_item' . $products_id . '.pdf',false);

 

 $email_text = 'look at this datashee!';

 

 tep_mail($to_name, $to_email_address,  

     EMAIL_TEXT_SUBJECT . ' #' . $products_id,  

     nl2br($email_text),  

     STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

Anyway, that is very rough, but you get the idea. You will need to build this in a page that can collect the correct to and from information, or you can assume that it is being mailed to the signed-in customer.

Link to comment
Share on other sites

Hi all,

 

I'm interested in this discussion as it can lead to a contrib improvement:

 

Portable Document Format is the de facto standard for the secure and reliable distribution and exchange of electronic documents and forms around the world...

that preserves the fonts, images, graphics, and layout of any source document, regardless of the application and platform used to create it .... bla, bla, bla, bla ...................... :shock:

 

Ramesh says:

Theres no point in viewing a PDF in the browser....

But then I do not understand all the PDF files around the net.

I personally like the way that a PDF page (in general) shows up in a browser page (my opinion).

We are ok right-clicking and using Save As (as we're technically minded).

Why not just visualize it first (left-click) and then save it (download/print) only if you think it's a document you really want? (at least this is the way I do).

With this in mind, why do you want to e-mail it to yourself, also sometimes a PDF file can be really "heavy"; I would not be happy if someone e-mails me a big attachment (that probably I do not need); I'd rather e-mail the URL.

 

John says:

Instead, do something like this... (which saves the pdf as a local file in a tmp directory *write permissions required*, and then emails it...)

Yes that is correct, you can save it to the server first (see Catalog products PDF reports http://www.oscommerce.com/community/contributions,908).

The idea behind my contribution was to create a PDF page "on the fly" (even if you can tell PHP to erase it automatically); no need to save it, and it can be easily adapted to print an "order confirm" (at the end of the process), an "account history" or an "invoice".

 

However these are my thoughts and hope you understand I do not have any interest in patronizing my contib, just willing to improve it.

Please reply.

 

Thanks

 

Ivan

 

Necessary statement: I'm not related to Adobe? in any way ! :lol:

Link to comment
Share on other sites

Valid points.

 

The thing about .PDF is you could view it on anything which handles the format and retain the structure of the original document.

 

With the web (html ) we have Different

 

Browsers (I.E. Mozilla Opera )

Platforms: PC , Apple MAC , Unix

Operating Systems: win95 /98 / Linux / Os

Printers: Lasers /inkjet

 

OK, lets focus.

 

Quite a few people would have difficulty cut and pasting a URL in an email to someone.

 

Also people who are not at ease with shopping on the net (newbies)

would welcome an email from a friend with a particular products details.

(A few friends of mine only have email access, web browsing is not allowed at their work place ).

 

So if I see a TV I think a friend would like I can email him and he can read the details . Then when he gets home he could look at the website .

 

Also when you click on a PDF link in your browser, the page does come up. But the only option is to print it.

 

The Save As is greyed out (this is what normally happens on other

sites ...not sure with your contrib)

 

To save it locally we have to right click Save As, .

 

Emailing the PDF

This is only useful if the PDF file is small (I'd say less than 50K unless you have a fast internet connection).

 

Just my thoughts !

Special Effects / 3d + Flash

Link to comment
Share on other sites

But then I do not understand all the PDF files around the net.  

I personally like the way that a PDF page (in general) shows up in a browser page (my opinion).

 

The reason for all these files around the net ?

 

When a company produces a brochure/catalog/product info they also put these files on their website (as many design apps can export to .PDF)

 

It saves them money- they dont need to hire a web developer/designer.

 

But these brochureware sites are not very usable and dont make use of the web's strengths ( interaction & dynamics audio/video ) .

Special Effects / 3d + Flash

Link to comment
Share on other sites

I guess we are looking the thing under different perspectives, for people having just e-mail access you brought up a good point.

I'm still w/ Win'98, and it's pretty easy from IE to send an attachment containing the page or just the URL, but a newbie could have some problems.

 

However before e-mailing the document I'm almost positive you want to see it.

John's code gets pretty close to the solution but it sends automatically the file once you access the PDF document.

We need to find a work-around, like a doube PDF link, one to render the document and the other to render/e-mail it.

 

As far as printing, I think a PDF page looks better than a regular HTML and the mod hasn't any function disabled (printing/saving),

so maybe people want to print your (nice) PDF page and later on compare specs and price w/ similar products found in other sites.

Also in viewing, if I find a site that provides PDF brochures, one thing that comes to my mind is that the site owner put an extra effort to display better or at least in a different way his products (just my naive opinion).......

then we can discuss about the lay-out and the overall look of the page that can certainly be improved.

 

last thing Ramesh:

(A few friends of mine only have email access, web browsing is not allowed at their work place ).
Which is only fair, in fact they should be working, not browsing the web! :D.

 

ivan

Link to comment
Share on other sites

We need to find a work-around, like a doube PDF link, one to render the document and the other to render/e-mail it.

 

WOW: Thats it - simple

 

as far as web browsing at work....one of my friends sends about 150 txt messages per day.

 

I used to be new at using txt now can almost match my typing rate just responding to his messages!

 

So instead of blocking web access, they should take away his mobile

(James I hope you dont read this!)

Special Effects / 3d + Flash

Link to comment
Share on other sites

yes... I personally will leave the pdf datasheet so that it renders in the browser. I think it is a nice touch and most people today I think can figure out how to save it. I did change my link to it so that it opens in a new window just so that I dont cause my user to leave the all important "buy now" button.

 

I definitely think we could add a feature to email the pdf. Perhaps it should be integrated as an option on the "Tell a freind" box. This is the way a customer should be sending out product emails anyway.

 

JG

Link to comment
Share on other sites

Hi xaol,  

 

Can you see the "no image" rect. ?  

Only .png, .jpg, .jpeg o.k.?  

(no .gif supported at present).  

 

yes, i can see the rect where de image goes but not the image.

 

what could it be?

Link to comment
Share on other sites

Hi all,

 

Carlos:

while you reinstall, I've realized there's a bug in pdf_datasheet_functions.php - line 397

 

Change it to:

 

'image' => $print_catalog[PDF_ALT_IMAGE],

 

this would affect the use of alternate image.

Not sure this is the reason of your problem, Sorry.

 

ivan

Link to comment
Share on other sites

HI, I have tried and doesnt work, in the rectangle it says: No Image.

I have my images in the catalog/images folder.

I have also Photo Gallery contribution installed, could this affect your contribution?

and have made that little change in pdf_datasheet_functions.php

 

Can download even open the pdf in browser but the image is still missing...

And wanna make it work, anyone have the same problem?

 

bye

Link to comment
Share on other sites

What version of the GD library do you have installed? Or can you verify that you have it installed. I believe that it is required to make this work.

 

Is it correct to say that NONE of your images (in PDF) are working?

 

Have you installed the PDF Catalog contribution? (It would be interesting if the images are in there but not the datasheets.)

Link to comment
Share on other sites

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...