CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 [RESOLVED] PDF Creation From MySQL Tables.

Print topic Send  topic

Author Message
ab5ni


Posts: 177
Posted: 11/06/2012, 9:05 AM

Hey Guys,

I'm looking for the best "CCS way" to query multiple tables and generate a PDF document.
I know I could just do a mysql_connect() in php, do the query, and format the thing correctly
via TCPDF, but is this the best way of doing things? I'd really like to do this from CCS and use its functionality. BTW, I don't want to generate an HTML page while doing this. What I really want is to add a link to the top of a page, run the query, and have it display the PDF. Any suggestions?
_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
bannedone


Posts: 273
Posted: 11/06/2012, 4:04 PM

Hi

I used this

http://realsites.biz/codecharge_studio_store.php?pid=24

It allows using CCS to create the page and layout then generate PDF from that.

Note: This is an interface of DomPDF into CCS.
_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
Garfieldus

Posts: 40
Posted: 11/07/2012, 2:08 AM

I use FPDF (http://www.fpdf.org/) very successfully. I produce invoices in pdf format directly from the mysql tables. It may not be the best "CCS way" as you will write all the code yourself but it works very well.
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 11/07/2012, 2:13 AM

I also use:

http://realsites.biz/codecharge_studio_store.php?pid=24


It is written to just "drop in" to a CCS page and is well supported by the developer.
Very good value.
_________________
Central Coast, NSW, Australia.

View profile  Send private message
ab5ni


Posts: 177
Posted: 11/07/2012, 9:34 AM

Thanks for all the great replies, guys :-D.

I have successfully used FPDF to do this a few years back with CCS user "Blazingguns" here in the forums (hey, Sameer!), and I know this is still doable, but like Garfieldus mentioned, we had to do all the coding by hand, and all of it was in straight php with very few CCS calls. WIth TCPDF being a super set of FPDF, this can still happen.

@bannedone and Michael: I will most definitely give this a look, as this would give me a choice of using either TCPDF (if need be) or the CCS product that u guys mentioned.

Thanks for all the great advice, and this sure helps me a lot, so off to do this AND celebrate my bday today :-D.

Best Regards,

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
ab5ni


Posts: 177
Posted: 11/07/2012, 1:15 PM

Well, I purchased the add-on u guys mentioned for my bday. Uploading to server as I type this, too. At $30.00, definitely worth a shot.

Regards,

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
ab5ni


Posts: 177
Posted: 11/07/2012, 1:20 PM

Oh, one other thing. Do u guys know if there is an easy way to drop their code into an existing page? I guess I can just copy and paste their code and it will work, or write a new page that uses their code for the link, rite?

Regards,

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
bannedone


Posts: 273
Posted: 11/07/2012, 5:47 PM

Hey... Happy Bday. (My Bday is this month too.. LOL)

BTW I have always wanted to get into HAM Radio. What is the easiest way to do that these days??

OK When using that PDF converter, the easiest way is to open the converter page as supplied and doing a save as to the page name you want to create.

Then build the page and get it to display as you want, then just call it with the _convert parameter and it should display as a PDF.

OR you could take an existing page and copy all the code in the BeforeOutput custom code in the supplied page to BeforeOutput custom code in your page.

Make sense???

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
ab5ni


Posts: 177
Posted: 11/09/2012, 9:31 AM

Hey, bannedone, and thanks for the reply. Oh...happy bday to u too, dude! :-D

As far as Ham Radio goes, it is a wonderful hobby, and I don't think I can say that enough!
Wonderful group of folks from all walks of life, but tends to attract technically-minded individuals, like programmers and engineers. In your home town, you can bank on it that this is where your fellow geeks/nerds are hanging out :-D.

I also need to mention that the morse code requirement to get a ham license no longer exists. If was done away with about 5 years ago or so, and since then there has been a massive expansion of the hobby. You still have to take tests to get a license; however, all you need to do to pass the exams is know a couple of basic electronic formulas, work a bit of Ohm's Law, and know which frequencies you can legally transmit on and such. There should be many study guides on the web, or u can probably pick one up at Radio Shack, etc.

What I'd do is search "Ham Radio <your home town>". or "Amateur Radio <your home town>". This will get you in touch with the local hams, they'll provide u with all the info u need, offer encouragement, and will probably lend u a book or three to pass the test. It is also important to note here that the Novice (beginning ham) exam is quite simple, and 5-year-olds have been known to pass, np. You'll also want to give www.arrl.org a shot if you're in the US. IF not, search "<Your Country> Amateur Radio" and you'll probably find the info u need.

K...now on to the topic at hand :-D. I looked at the "Before Output " event and their code, and I was pretty sure I could just copy and paste it with no problems, but just wanted to be sure there were no "Caveat Emptor's" to be had :-D. Also, I wrote a test page as you described, and everything worked out decently, but I'm having a problem displaying the entire table, which is normally displayed as a grid row. Unfortunately, the right edge of the table/row is being clipped, and that portion of the data is not being displayed, even though I'm using an 8-pt font and such : :-/. Guess I'm going to have to do some reformatting of the page, unless u know of a better idea?

Best Regards,

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
bannedone


Posts: 273
Posted: 11/09/2012, 10:57 AM

Hey Randall

Thanks for the HAM Radio Info. Glad to hear the Morse requirement is no longer neccessary!!
Basic electronics should not be a problem for me. I spent 9 years in the Air Force making B-52's invisible. (Electronic Warfare, Called Stealth today) I am in the US, in fact, in Los Angeles. I have always wanted to get into HAM Radio. In High School we had a station and actually the members collected QSLs from all over the world.

On the PDF topic.. Yes you need to format to fit on the paper size you are using. Both for width and length. If 8.5 x 11 and your grid is bigger than the 11 inch height, you might need to put HTML page breaks into your grid dynamically at certain record counts.

What I have done for the width issue is put a table around the grid or record to display and limit that encapsulating table to a certain pixel width to match 8.5 inch paper with. I cannot remember but i think a good pixel width to start with is around 650 to 700. You can start there and adust till it fills the 8.5 inch paper width. (You could do this for the height of your encapsulating table if you do not anticipate more grid records than will fit on a page.)

You might also want to check the /lib/jjrpdf_config.inc.php file and try to change some default paper sizes. ( I have never tried this )

John
8-)

BTW. Where R U Located?

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
ab5ni


Posts: 177
Posted: 11/09/2012, 12:05 PM

Living in LA, you'll have absolutely zero problems finding folks to give u the exam. LA is Ham Radio Heaven :D. As a matter of fact, they'll be so many hams on the air over there talking on the 2-mtr and 440MHz repeaters, you're prolly going to have to throw some elbows to get a chance to talk :-D. You'll really enjoy listening to all the chatter, with most of the talk being about things like the new Windows 8, Mac OSX, Linux, programming, electronics, and the new cellular phones coming out and such. A lot of those guys will be working at large corporations, in the film industry, and all other kinda geek-movitaved establishments :-D.

As far as the PDF creation goes, I found a work-around. Basically, I just made a report from the table, and that seems to make DOMPDF happy. Not fancy, but it gets the job done.


Oh...I'm in Lafayette, LA., John. Cajun Country :-D. Yes, I'm a Cajun, and yes I cook Cajun food. No, I don't have an alligator in my back yard, and I also don't shoot people that look at me funny, although I have to admit I've been tempted a time or two :-D :-D. I do engineering and programming in the oil biz, and we use CCS for logistics tracking of oil-field equipment. Prolly going to start hacking on some Android and IPhone code soon and offer some real-time logistics as well. Prolly going to have to do some fancy mobile CSS to keep things looking good. Man, it never ends :-D.

Best Regards,

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
ab5ni


Posts: 177
Posted: 11/09/2012, 12:08 PM

One other thing, John. Would happen to have a link to your pages so I can see an example of what u are doing?

Regards,

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 11/09/2012, 1:36 PM

Hmm HAM radio, been thinking about that myself...

I am a bit further away from you guys and I do actually live in a town where kangaroos hop around paddocks and then try and cross the road ....


The issuance of licences here is a bit more involved.

http://vkfaq.ampr.org/index.php

Would be good to configure for data transfer ... I believe there is a neat little Linksys wireless modem that can easily be adapted...

Will let you know how that project goes...


_________________
Central Coast, NSW, Australia.

View profile  Send private message
ab5ni


Posts: 177
Posted: 11/09/2012, 2:29 PM

Hey Michael,

Australia has a great group of hams. Here's a great operators site to check out:
http://www.vk2zay.net/

Alan has a ton of wonderful projects on this site. Check out the links on the right side of the page.

Best Regards,


_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
bannedone


Posts: 273
Posted: 11/09/2012, 7:19 PM

Randall

Can't think of a site off the top of my head where I have used this where it is not behind a login. However, I have used the report method like you have as well as using an encapsulating table with a prescribed width / height parameter. The real limitation is the actual paper size.... and causing pagination. (WEB Pages don't care)

Well, with your encouragement, I think I will actually start getting into the HAM Radio arena.. Hope it does not turn out to be tooo expensive.

I do have an excellent scanner that covers the HAM bands. Using that I have at least been able to listen to all the chatter out here.

Maybe on a good nite I might even be able to reach Lafayette. LOL

Wonder if the waves can reach where Michael plays his didgeridoo while watching the kangaroos hop around paddocks.

If I get on the air, I will be looking for U guys...

BTW. Just so you know.. I wrote this CCS Pdf converter. So if you need any help just PM me. I also reworked some of DOMPDF to eliminate the security flaw that originally existed. But as you see this is a pretty straight forward CCS way of doing it. No Complicated / Tedious TCPDF coding.. Just plain CCS coding and formatting (WYSIWYG.. mostly..)!!!

Have fun
John
8-)

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 11/09/2012, 8:57 PM

I've heard that one of the high bands can be bounced off the moon to provide a delayed hop and so over a 24 hour period incorporating planetary rotation can be transmitted anywhere on Earth.
_________________
Central Coast, NSW, Australia.

View profile  Send private message
bannedone


Posts: 273
Posted: 11/10/2012, 12:50 AM

LOL....:-D

Everybody likes a little ass... But nobody likes a smart ass.. My Friend.

LOL

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
ab5ni


Posts: 177
Posted: 11/10/2012, 10:07 AM

Hi again John and Michael,

You did a really great job on the PDF converter, John! Easy to use and understand, np. Anything that can save me time like your code does is okay in my book :-D.

The only issue I've had with the "Report Method" are foreign keys in the table showing up as integer, but I fixed that up in the Before Show event like this:

  
$db = new clsDBConnection1();  
  
$C = CCDLookUp("rig_name","rig","rig_id=" . $Container->rig_id->GetValue(), $db);  
$Container->rig_text->SetValue($C);  
  
$db->close();  
  

Added this and everything is working great.

As far as Moon Bounce goes, Michael: yep, there are some guys out there doing this, believe it or not :-D.
The idea behind it is to use the Moon as a reflector, bouncing powerful signals off the Moon and back to
Earth, even when absolutely no ionospheric propagation exists. They usually use Morse code to do this, and
the received signal is delayed about 4 seconds after the original transmission from the source. There are even some guys out there trying for "Worked All States" via Moon bounce :-D. A few have actually done this, but I think it's only like a hand full or so. lol.

As far as the costs go, John, it's become rather cheap to get on the air these days. For Morse, some of the guys are throwing rigs (radios) together with spare parts for like $10.00. An example would be "The Pixie II". Search "QRP Pixie II" and you'll find a plethora of schematics.

Another cheap way to get on the air is via something known as "Echo Link." Basically, Hams have interfaced their repeaters to the Internet. They'll be riding around in the car, talking on the local repeater, and all of the communications are being fed to the net. What I can do is get a computer with a net connection, a headset, run the Echo Link software, and connect to said repeater and talk to em. I could also login to one of your local repeaters and talk to you and Michael (who is logged in from Australia over the net). You'd be on your repeater via radio, riding around or whatever, and Michael and I would be on the net, and anybody listening would think we're locals, chatting away on the repeater.:-D. Note that u have to be a licensed amateur to use Echo Link. It's really cool, though, and interfaces all kinds of repeaters from all over the world together.

Best Regards, guys, and looking forward to the day we can all hook up via Echo Link!


_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
ab5ni


Posts: 177
Posted: 11/10/2012, 10:31 AM

Quote bannedone:
Randall

Can't think of a site off the top of my head where I have used this where it is not behind a login. However, I have used the report method like you have as well as using an encapsulating table with a prescribed width / height parameter. The real limitation is the actual paper size.... and causing pagination. (WEB Pages don't care)

Well, now I'm having a problem with the report being clipped. I'm not really sure where I need to adjust the width and height of things, but I guess it's probably the CSS and HTML. More info or an example would be greatly appreciated!

Best Regards,

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
bannedone


Posts: 273
Posted: 11/10/2012, 10:55 AM

Hi

Well I learn something new every day LOL. I was refering to skip as a possibility for us hooking up on the air. I have seen guys get out pretty far that way. Even I have picked up VERY far away stations with my scanner.

Echo Link sounds pretty cool as well.

Anyway let me "Moon Bounce" this off you.

First DOMpdf is just that. It converts to PDF based on the HTML Document Object Model.
It does have some weaknesses with regard to some CSS formatting. However it does a pretty good job on Non-Exotic type HTML and CSS.

What I meant about using width and height properties was sorta like so:

<table width="650"> or what ever pixel number fills out your page to 8.5" as you want it.
Your CCS generated grid or component in here
Note: any table row... etc in here should not have any pixel size defined widths. Instead use paramaters in percentages like so width="100%" .. and so on
</table>

The good news is, once you get all the DOM/HTML formatting done to meet your requirements, all subsequent PDF pages will be a snap.

In any event I will look thru some old code to find some examples for you. Been a while since I have needed PDF Conversion.

As far as pagination in reports, maybe this will help
http://forums.yessoftware.com/posts.php?post_id=97578

For doing the same thing in grids try putting a label in the grid and based on the rowcount put the HTML page break into the label.

BTW. Thanks Randall glad the code is useful to you.

Have Fun
8-)

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
ab5ni


Posts: 177
Posted: 11/10/2012, 2:55 PM

Quote bannedone:
Hi

Well I learn something new every day LOL. I was refering to skip as a possibility for us hooking up on the air. I have seen guys get out pretty far that way. Even I have picked up VERY far away stations with my scanner.

Echo Link sounds pretty cool as well.

Oh, we can all probably do that on 15 or 20 mtrs, np, and Echo Link is cool as hell.



Quote :
Anyway let me "Moon Bounce" this off you.

First DOMpdf is just that. It converts to PDF based on the HTML Document Object Model.
It does have some weaknesses with regard to some CSS formatting. However it does a pretty good job on Non-Exotic type HTML and CSS.

K. Gotcha. Sounds simple enough. BTW, I have to ask if you ever thought about name your product "DOMinatrix," or did somebody already have that name registered :-D.

Quote :
What I meant about using width and height properties was sorta like so:

<table width="650"> or what ever pixel number fills out your page to 8.5" as you want it.
Your CCS generated grid or component in here
Note: any table row... etc in here should not have any pixel size defined widths. Instead use paramaters in percentages like so width="100%" .. and so on
</table>

Okay. This sounds/looks simple enough.

Quote :
The good news is, once you get all the DOM/HTML formatting done to meet your requirements, all subsequent PDF pages will be a snap.

In any event I will look thru some old code to find some examples for you. Been a while since I have needed PDF Conversion.

Sounds wonderful, John. I think your excellent explanation is good enough, though. I was going to PM this stuff to you, but I figured our open discussion will help others here that purchase your wonderful product.

Quote :
As far as pagination in reports, maybe this will help
http://forums.yessoftware.com/posts.php?post_id=97578

For doing the same thing in grids try putting a label in the grid and based on the rowcount put the HTML page break into the label.

BTW. Thanks Randall glad the code is useful to you.


K...that all sounds simple enough, John. Figure out how many rows per page, and at "N rows," shove in a page break.dynamically on my pages.

Thanks for help, my friend, and my God Bless,


_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
bannedone


Posts: 273
Posted: 11/11/2012, 11:43 PM

Hey Randall

I have found a HAM club near me..

I have been researching radios

What do you think of an ICOM IC 9100 with a 1kw linear.

Should be able to "Moon Bounce" with that... LOL

Maybe we should take our HAM stuff out of the forums.. PM me with contact info if you like.

Then we can talk CCS and HAM my friend...

8-)
_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
ab5ni


Posts: 177
Posted: 11/13/2012, 7:55 AM

Hi again John,

Okay. I've sent you all my contact info. As far as the ICOM rig goes, it looks like a beauty! Not sure which amp you'd be interested in, but I can tell you it won't be cheap at the frequency range for Moon Bounce :-D. What I'd do is get the rig, get to know the locals, and then ask who the local moon-bounce junkies' are and what repeater they hang out on or something. Give me an sms text, I'll put on my headset, and I'll call ya via Google Voice.

Best Regards,


_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
ab5ni


Posts: 177
Posted: 11/26/2012, 11:57 AM

Okay. I added a link to the top of a page, which is basically "http://www.<whatever>.com/_convert=yes." What I want to do now is kill the search form and navigator. What's the best way and place to add the code to do so?

Best Regards,

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 11/26/2012, 2:22 PM

If you want the page to convert to PDF full time you can change to:

if (CCGetParam("_convert","1")!="0") {

_________________
Central Coast, NSW, Australia.

View profile  Send private message
ab5ni


Posts: 177
Posted: 11/26/2012, 3:18 PM

Quote MichaelMcDonald:
If you want the page to convert to PDF full time you can change to:

if (CCGetParam("_convert","1")!="0") {


Thanks, Michael. I'll give it shot and see how it goes.

Best Regards,

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
bannedone


Posts: 273
Posted: 11/27/2012, 9:30 AM

Hi

In the BeforeShow Event use Hide Show Component action on your search and navigator bases on the existence of the _convert parameter.


_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
ab5ni


Posts: 177
Posted: 11/30/2012, 8:45 AM

K...sounds good, John....tyvm!

Best Regards,


Randall

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message
ab5ni


Posts: 177
Posted: 11/30/2012, 10:34 AM

This code seems to work:

  
if(CCGetParam("_convert","1") =="yes") {  
 $JSASearch->Visible = false;  
}  
else {  
 $JSASearch->Visible = true;  
}  
  

Thanks guys!

Best Regards,

_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!


View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.