Jump to content
Sign in to follow this  
alverman

[contribution] PDF data_sheet maker v.1

Recommended Posts

Hi all

I think I needed some sleep (7.00 a.m here) .

 

hellbound:

Now all its OK for me!  
I'glad it works now and like your centered lay-out better :wink: , I see you are having trouble w/ the Nutritional Data spanning on different pages, I'm not sure I can help you much on that, just try playing w/ the settings, sorry :).

 

jchasick:

its writing the file as type .php instead of .pdf

do you mean you are viewing something like:

http://www.yoursite.com/catalog/pdf_datash...?products_id=33

in place of:

http://www.yoursite.com/catalog/pdf_datasheet.pdf

 

if so, it's because the content is printed directly to the browser and not created on server and then downloaded, doesn't it open up AcrobatReader ? If you see the document you can save it as .pdf.

I hope I did not misunderstood.

 

thank you

 

ivan

Share this post


Link to post
Share on other sites

no, when i click on the create pdf button ( link shows as mysite.com/catalog/pdf_datasheet.php?products_id=288), it creates a file on the desktop labeled pdf_datasheet.php


Reading is beneficial - Searching is enlightening

find answers at wiki.oscommerce.com/top

Share this post


Link to post
Share on other sites
I made the fix you posted and now the file is being created, except it is being created with the extension .php instead of .pdf

what happened before the fix ?

are you on IE , Netscape ?

Just trying to figure it out.

Share this post


Link to post
Share on other sites

sorry for not supplying detailed info to start with.....

 

was getting the image error before applying the fix

 

testing this locally on my OS X server

 

have tested with the following browsers:

 

IE, Safari, Mozilla, Omniweb


Reading is beneficial - Searching is enlightening

find answers at wiki.oscommerce.com/top

Share this post


Link to post
Share on other sites

Did I miss it or did anyone get this mod to work with .gifs? I get this error FPDF error: Unsupported image file type: gif

Also, the information at the bottom of the pdf pages does not show my email and business address. Can someone help me out with this? Thanks.

Share this post


Link to post
Share on other sites

I'm afraid to tell you that at the moment and w/the library that this mod. uses it is not possible to parse .gif images to embed them into PDF, only .png and .jpg are supported (this is what the readme.txt says).

Just a note: for picture-like images I would suggest .jpg format, it is a much better solution in terms of compression and overall result.

ivan

Share this post


Link to post
Share on other sites

I have set up a new image input in admin for PDF Image.

This way we have small image, large image and PDF Image for all our products.

 

This seems to work nicely.

 

We always use gifs so we can keep the small image transparent for the site, they just look much neater on the site that way.

 

To show your email and business addres go to the text file in English, or whatever your language is, and change it there.

 

CC.

Share this post


Link to post
Share on other sites

I've probably underestimated the massive use of gifs as SMALL_IMAGE.

If find much easier to optimize jpg format in Photoshop but that's another story.

I think that if you really want to use this mod and not having to face problems w/ pics formats, your solution can be the best, just a little additional work to set the new db field and create the new supported pics.

 

ivan

Share this post


Link to post
Share on other sites

Does anyone have the updated files they are willing to share? Or better yet is there going to be an update to the package soon?

Share this post


Link to post
Share on other sites

Hi all,

not my businness but ...

In some sites using this mod I've seen :

IncVAT price and exVAT price show same amount eg.:

Price/Special price : $ 100.00 inc VAT ($100.00 ex VAT),

I guess because of "define('DISPLAY_PRICE_WITH_TAX', false);", correct ?

 

If you are not happy w/ that :evil: try replacing lines 329 ? 337 with:

        if ($print_catalog = tep_db_fetch_array($print_catalog_query)){

        if(DISPLAY_PRICE_WITH_TAX != false){

            if ($new_price = tep_get_products_special_price($print_catalog['products_id'])) {

            $special_price =  TEXT_PRODUCTS_SPECIALS_PRICE . $currencies->display_price($new_price, tep_get_tax_rate($print_catalog['products_tax_class_id'])) . TEXT_PRICE_VAT_INCLUDED . '  (' . $currencies->display_price($new_price, tep_get_tax_rate('')) . TEXT_PRICE_EX_VAT . ')';

            $products_price = TEXT_PRODUCTS_PRICE . $currencies->display_price($print_catalog['products_price'], tep_get_tax_rate($print_catalog['products_tax_class_id'])) . TEXT_PRICE_VAT_INCLUDED;

            } else {

                    $products_price = TEXT_PRODUCTS_PRICE . $currencies->display_price($print_catalog['products_price'], tep_get_tax_rate($print_catalog['products_tax_class_id'])) . TEXT_PRICE_VAT_INCLUDED . '  (' . $currencies->display_price($print_catalog['products_price'], '') . TEXT_PRICE_EX_VAT . ')';

            }

        } else {

             if ($new_price = tep_get_products_special_price($print_catalog['products_id'])) {

            $special_price =  TEXT_PRODUCTS_SPECIALS_PRICE . $currencies->display_price($new_price, '') . TEXT_PRICE_EX_VAT;

            $products_price = TEXT_PRODUCTS_PRICE . $currencies->display_price($print_catalog['products_price'], '') . TEXT_PRICE_EX_VAT;

            } else {

                    $products_price = TEXT_PRODUCTS_PRICE . $currencies->display_price($print_catalog['products_price'], '') . TEXT_PRICE_EX_VAT;

            }

        }

If this works for yous guys I can include it in the update (which, before you ask, will still NOT support GIFs 8) ).

ivan

Share this post


Link to post
Share on other sites

I'd just like a copy of the first version to work. I can change gifs to jpgs. I tryed walking through the changes posted here and just got a headache.

:(

Share this post


Link to post
Share on other sites

If you read the first pages of this post, you see that i had the same problem, but i solved it changing 4 lines of code. This is using Medium or Big images (i have it in jpg, but smalls in gif).

 

Good luck :roll:

Share this post


Link to post
Share on other sites

I now have it mostly working with thanks to Ivan sending his changes. I now only have a problem with images which I hope to look at this evening. For now I just turned images off in the config file. With images on I get an error like this:

 

Warning: getimagesize: Unable to open '/catalog/images/CN0041.jpg' for

reading. in /var/www/html/catalog/pdf/fpdf.php on line 1418 FPDF error:

Missing or incorrect image file: /catalog/images/CN0041.jpg

 

The image is .jpg and in the correct place.

 

I'll let eveyone know when I find the problem.

 

Thanks

Share this post


Link to post
Share on other sites

Unfortunately yes Orienell,

In the code you see:

 $description = str_replace(" ","",rtrim(strip_tags($print......

on line 369 to avoid at least   instead of space.

but

 $description = str_replace(" "," ",rtrim(strip_tags($print......

should do better.

Sorry about keeping patching the code.

strip_tags removes HTML and PHP tags, but when pdf is printed, HTML tags are not visible but they are still there giving unwanted empty lines. If you have a <table><tr><td>text..... formatting in your description, try removing the strip_tags function to see what I mean.

Do not know how to fix this (..still trying).

Ivan

Share this post


Link to post
Share on other sites

Does anyone know how to adjust the margins in this fine contribution? I've hacked around, but with no luck. My description is running past the left side margin. I need to move the whole description right a few inches. I didn't see an easy way of doing this. Hopefully, I missed something.


The specialty shops at 5thsister.com.

Share this post


Link to post
Share on other sites
FPDF error:

Missing or incorrect image file: /catalog/images/CN0041.jpg

 

I have the exact same problem but not with the datasheet maker but with the pdf catalog.

 

BTW, excellent contribution. The datasheet works perfectly but the catalog (at least for me) does not :(

Share this post


Link to post
Share on other sites
FPDF error:

Missing or incorrect image file: /catalog/images/CN0041.jpg

 

The path looks wrong: are you sure that your images are in /catalog/images in the root system directory? For Microsoft folks, that's the same as saying your directory is C:/catalog/images/. That would be really odd for a virtual domain setup. It should be more something like /var/www/html/catalog/images/ or /home/domains/hipware.com/images/ as the absolute path to the images directory. You might get away with dropping the "/" in the path, which would leave you with the relative path catalog/images

 

 

If you are using linux or unix in your virtual hosting environment, you can login to a shell and type "pwd" and it will tell you the path you are in or ask your system administrator.

 

If the path is correct (which I doubt), have either of you checked the permissions to see if the application has read permission on the images? It may also require more liberal permissions to incorporate or alter the images.

 

Just a guess based on what you've reported, hope it helps.


*edit*

Share this post


Link to post
Share on other sites

^^It's probably a typo. I get the same error but the output looks like this:

 

..//catalog/etc...

 

not

 

/catalog/etc...

Share this post


Link to post
Share on other sites

We talking about PDF datasheet, aren't we?

To mod page margins:

in catalog/pdf/fpdf.php line 173

	

//Page margins (2 cm)

$margin=56.70/$this->k;

U can bring it back to 28.35 (1 cm) as it is in PDF catalog.

 

HTH

ivan

Share this post


Link to post
Share on other sites
  ^^It's probably a typo. I get the same error but the output looks like this:

 

His post looks like a straight cut and paste, so that might be his problem. Could you reply with the exact error you are receiving without editing it? If you don't want to reveal your directory structure to the world at large then just IM it to me.

 

Did you try changing the permissions on the files? If it can't read them it might reply with this error. You could try to see what the conditions are for it to spew out this particular error by searching for the error text in the application itself. It may be poor error handling in the application leading you in the wrong direction.


*edit*

Share this post


Link to post
Share on other sites

Hi,

 

I'm using 2.2-CVS Daily Snapshot (05/08/2003) and when I change product_info.php like instructed in contrib file

 

quote;

2.2 CSV add:

 

<?php echo '<a href="' . tep_href_link(FILENAME_PDF_DATASHEET, 'products_id=' . $product_info_values['products_id']) .'" target="_self">' . tep_image('pdf/pdf.gif') .'</a>'; ?>

 

it shows blank pdf

 

I erased values so now it looks like this;

 

<?php echo '<a href="' . tep_href_link(FILENAME_PDF_DATASHEET, 'products_id=' . $product_info['products_id']) .'" target="_self">' . tep_image('pdf/pdf.gif') .'</a>'; ?>

 

and it works

 

Regards

 

Damir


*****************************************************************

Let the best thing happened to you yesterday be the worst to happen tommorow

*****************************************************************

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×