32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-26 06:17:33 +00:00
This commit is contained in:
nicolaasuni 2010-05-21 18:47:01 +02:00
parent 0c3b729f12
commit dda292d19c
83 changed files with 1888 additions and 1236 deletions

View File

@ -1,3 +1,9 @@
5.0.014 (2010-05-21)
- A problem on color and style of HTML links was fixed.
- A bug relative to gradients was fixed.
- The getStringHeight() method was added and getNumLines() method was improved.
- All examples were updated.
5.0.013 (2010-05-19) 5.0.013 (2010-05-19)
- A bug related to page-breaks and table cells was fixed. - A bug related to page-breaks and table cells was fixed.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 5.0.013 Version: 5.0.014
Release date: 2010-05-19 Release date: 2010-05-21
Author: Nicola Asuni Author: Nicola Asuni
Copyright (c) 2001-2010: Copyright (c) 2001-2010:

View File

@ -1,10 +1,19 @@
The year 1866 was marked by a bizarre development, an unexplained and downright inexplicable phenomenon that surely no one has forgotten. Without getting into those rumors that upset civilians in the seaports and deranged the public mind even far inland, it must be said that professional seamen were especially alarmed. Traders, shipowners, captains of vessels, skippers, and master mariners from Europe and America, naval officers from every country, and at their heels the various national governments on these two continents, were all extremely disturbed by the business. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.
In essence, over a period of time several ships had encountered "an enormous thing" at sea, a long spindle-shaped object, sometimes giving off a phosphorescent glow, infinitely bigger and faster than any whale.
The relevant data on this apparition, as recorded in various logbooks, agreed pretty closely as to the structure of the object or creature in question, its unprecedented speed of movement, its startling locomotive power, and the unique vitality with which it seemed to be gifted. If it was a cetacean, it exceeded in bulk any whale previously classified by science. No naturalist, neither Cuvier nor Lacépède, neither Professor Dumeril nor Professor de Quatrefages, would have accepted the existence of such a monster sight unseen -- specifically, unseen by their own scientific eyes. Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.
Striking an average of observations taken at different times -- rejecting those timid estimates that gave the object a length of 200 feet, and ignoring those exaggerated views that saw it as a mile wide and three long--you could still assert that this phenomenal creature greatly exceeded the dimensions of anything then known to ichthyologists, if it existed at all.
Now then, it did exist, this was an undeniable fact; and since the human mind dotes on objects of wonder, you can understand the worldwide excitement caused by this unearthly apparition. As for relegating it to the realm of fiction, that charge had to be dropped. Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.
In essence, on July 20, 1866, the steamer Governor Higginson, from the Calcutta & Burnach Steam Navigation Co., encountered this moving mass five miles off the eastern shores of Australia. Captain Baker at first thought he was in the presence of an unknown reef; he was even about to fix its exact position when two waterspouts shot out of this inexplicable object and sprang hissing into the air some 150 feet. So, unless this reef was subject to the intermittent eruptions of a geyser, the Governor Higginson had fair and honest dealings with some aquatic mammal, until then unknown, that could spurt from its blowholes waterspouts mixed with air and steam.
Similar events were likewise observed in Pacific seas, on July 23 of the same year, by the Christopher Columbus from the West India & Pacific Steam Navigation Co. Consequently, this extraordinary cetacean could transfer itself from one locality to another with startling swiftness, since within an interval of just three days, the Governor Higginson and the Christopher Columbus had observed it at two positions on the charts separated by a distance of more than 700 nautical leagues. Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.
Fifteen days later and 2,000 leagues farther, the Helvetia from the Compagnie Nationale and the Shannon from the Royal Mail line, running on opposite tacks in that part of the Atlantic lying between the United States and Europe, respectively signaled each other that the monster had been sighted in latitude 42 degrees 15' north and longitude 60 degrees 35' west of the meridian of Greenwich. From their simultaneous observations, they were able to estimate the mammal's minimum length at more than 350 English feet; this was because both the Shannon and the Helvetia were of smaller dimensions, although each measured 100 meters stem to stern. Now then, the biggest whales, those rorqual whales that frequent the waterways of the Aleutian Islands, have never exceeded a length of 56 meters--if they reach even that.
One after another, reports arrived that would profoundly affect public opinion: new observations taken by the transatlantic liner Pereire, the Inman line's Etna running afoul of the monster, an official report drawn up by officers on the French frigate Normandy, dead-earnest reckonings obtained by the general staff of Commodore Fitz-James aboard the Lord Clyde. In lighthearted countries, people joked about this phenomenon, but such serious, practical countries as England, America, and Germany were deeply concerned. Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.
In every big city the monster was the latest rage; they sang about it in the coffee houses, they ridiculed it in the newspapers, they dramatized it in the theaters. The tabloids found it a fine opportunity for hatching all sorts of hoaxes. In those newspapers short of copy, you saw the reappearance of every gigantic imaginary creature, from "Moby Dick," that dreadful white whale from the High Arctic regions, to the stupendous kraken whose tentacles could entwine a 500-ton craft and drag it into the ocean depths. They even reprinted reports from ancient times: the views of Aristotle and Pliny accepting the existence of such monsters, then the Norwegian stories of Bishop Pontoppidan, the narratives of Paul Egede, and finally the reports of Captain Harrington -- whose good faith is above suspicion--in which he claims he saw, while aboard the Castilian in 1857, one of those enormous serpents that, until then, had frequented only the seas of France's old extremist newspaper, The Constitutionalist.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.
Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.
Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.
Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.
Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.

View File

@ -1,23 +1,23 @@
During the period in which these developments were occurring, I had returned from a scientific undertaking organized to explore the Nebraska badlands in the United States. In my capacity as Assistant Professor at the Paris Museum of Natural History, I had been attached to this expedition by the French government. After spending six months in Nebraska, I arrived in New York laden with valuable collections near the end of March. My departure for France was set for early May. In the meantime, then, I was busy classifying my mineralogical, botanical, and zoological treasures when that incident took place with the Scotia. <p><strong>Lorem ipsum</strong> dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.</p>
I was perfectly abreast of this question, which was the big news of the day, and how could I not have been? I had read and reread every American and European newspaper without being any farther along. This mystery puzzled me. Finding it impossible to form any views, I drifted from one extreme to the other. Something was out there, that much was certain, and any doubting Thomas was invited to place his finger on the Scotia's wound.
When I arrived in New York, the question was at the boiling point. The hypothesis of a drifting islet or an elusive reef, put forward by people not quite in their right minds, was completely eliminated. And indeed, unless this reef had an engine in its belly, how could it move about with such prodigious speed?
Also discredited was the idea of a floating hull or some other enormous wreckage, and again because of this speed of movement.
So only two possible solutions to the question were left, creating two very distinct groups of supporters: on one side, those favoring a monster of colossal strength; on the other, those favoring an "underwater boat" of tremendous motor power.
Now then, although the latter hypothesis was completely admissible, it couldn't stand up to inquiries conducted in both the New World and the Old. That a private individual had such a mechanism at his disposal was less than probable. Where and when had he built it, and how could he have built it in secret?
Only some government could own such an engine of destruction, and in these disaster-filled times, when men tax their ingenuity to build increasingly powerful aggressive weapons, it was possible that, unknown to the rest of the world, some nation could have been testing such a fearsome machine. The Chassepot rifle led to the torpedo, and the torpedo has led to this underwater battering ram, which in turn will lead to the world putting its foot down. At least I hope it will.
But this hypothesis of a war machine collapsed in the face of formal denials from the various governments. Since the public interest was at stake and transoceanic travel was suffering, the sincerity of these governments could not be doubted. Besides, how could the assembly of this underwater boat have escaped public notice? Keeping a secret under such circumstances would be difficult enough for an individual, and certainly impossible for a nation whose every move is under constant surveillance by rival powers.
So, after inquiries conducted in England, France, Russia, Prussia, Spain, Italy, America, and even Turkey, the hypothesis of an underwater Monitor was ultimately rejected.
After I arrived in New York, several people did me the honor of consulting me on the phenomenon in question. In France I had published a two-volume work, in quarto, entitled The Mysteries of the Great Ocean Depths. Well received in scholarly circles, this book had established me as a specialist in this pretty obscure field of natural history. My views were in demand. As long as I could deny the reality of the business, I confined myself to a flat "no comment." But soon, pinned to the wall, I had to explain myself straight out. And in this vein, "the honorable Pierre Aronnax, Professor at the Paris Museum," was summoned by The New York Herald to formulate his views no matter what.
I complied. Since I could no longer hold my tongue, I let it wag. I discussed the question in its every aspect, both political and scientific, and this is an excerpt from the well-padded article I published in the issue of April 30.
"Therefore," I wrote, "after examining these different hypotheses one by one, we are forced, every other supposition having been refuted, to accept the existence of an extremely powerful marine animal. <img src="../images/image_demo.jpg" width="54mm" height="80mm" />
"The deepest parts of the ocean are totally unknown to us. No soundings have been able to reach them. What goes on in those distant depths? What creatures inhabit, or could inhabit, those regions twelve or fifteen miles beneath the surface of the water? What is the constitution of these animals? It's almost beyond conjecture.
"However, the solution to this problem submitted to me can take the form of a choice between two alternatives. <p style="background-color:yellow;"><i>Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.</i></p>
"Either we know every variety of creature populating our planet, or we do not.
"If we do not know every one of them, if nature still keeps ichthyological secrets from us, nothing is more admissible than to accept the existence of fish or cetaceans of new species or even new genera, animals with a basically 'cast-iron' constitution that inhabit strata beyond the reach of our soundings, and which some development or other, an urge or a whim if you prefer, can bring to the upper level of the ocean for long intervals. <p>Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.</p>
"If, on the other hand, we do know every living species, we must look for the animal in question among those marine creatures already cataloged, and in this event I would be inclined to accept the existence of a giant narwhale.
"The common narwhale, or sea unicorn, often reaches a length of sixty feet. Increase its dimensions fivefold or even tenfold, then give this cetacean a strength in proportion to its size while enlarging its offensive weapons, and you have the animal we're looking for. It would have the proportions determined by the officers of the Shannon, the instrument needed to perforate the Scotia, and the power to pierce a steamer's hull. <p style="color:navy;">Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.</p>
"In essence, the narwhale is armed with a sort of ivory sword, or lance, as certain naturalists have expressed it. It's a king-sized tooth as hard as steel. Some of these teeth have been found buried in the bodies of baleen whales, which the narwhale attacks with invariable success. Others have been wrenched, not without difficulty, from the undersides of vessels that narwhales have pierced clean through, as a gimlet pierces a wine barrel. The museum at the Faculty of Medicine in Paris owns one of these tusks with a length of 2.25 meters and a width at its base of forty-eight centimeters!
"All right then! Imagine this weapon to be ten times stronger and the animal ten times more powerful, launch it at a speed of twenty miles per hour, multiply its mass times its velocity, and you get just the collision we need to cause the specified catastrophe. <p>Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.</p>
"So, until information becomes more abundant, I plump for a sea unicorn of colossal dimensions, no longer armed with a mere lance but with an actual spur, like ironclad frigates or those warships called 'rams,' whose mass and motor power it would possess simultaneously.
"This inexplicable phenomenon is thus explained away unless it's something else entirely, which, despite everything that has been sighted, studied, explored and experienced, is still possible!" <p><strong>Lorem ipsum</strong> dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.</p>
<img src="../images/image_demo.jpg" width="54mm" height="80mm" />
<p style="background-color:yellow;"><i>Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.</i></p>
<p>Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.</p>
<p style="color:navy;">Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.</p>
<p>Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.</p>

View File

@ -55,7 +55,7 @@
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -5548,7 +5548,7 @@ $frame)</code>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:18 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:52 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

File diff suppressed because it is too large Load Diff

View File

@ -296,7 +296,7 @@ $type)</code>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -1374,7 +1374,7 @@ $type)</code>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -102,7 +102,7 @@ PHP class to creates array representations for 2D barcodes to be used with TCPDF
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -102,7 +102,7 @@ PHP class to creates array representations for common 1D barcodes to be used wit
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -539,7 +539,7 @@ Configuration file for TCPDF.<br /><br /><br /><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:23 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:57 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -94,7 +94,7 @@ Array of WEB safe colors.<br /><br /><br /><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:18 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:52 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -477,7 +477,7 @@ string $string, [int $split_length = 1])</code>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:18 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:52 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -79,7 +79,7 @@ This is a PHP class for generating PDF documents without requiring external exte
<td><b>author:</b>&nbsp;&nbsp;</td><td>Nicola Asuni</td> <td><b>author:</b>&nbsp;&nbsp;</td><td>Nicola Asuni</td>
</tr> </tr>
<tr> <tr>
<td><b>version:</b>&nbsp;&nbsp;</td><td>5.0.013</td> <td><b>version:</b>&nbsp;&nbsp;</td><td>5.0.014</td>
</tr> </tr>
<tr> <tr>
<td><b>copyright:</b>&nbsp;&nbsp;</td><td>2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com</td> <td><b>copyright:</b>&nbsp;&nbsp;</td><td>2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com</td>
@ -110,7 +110,7 @@ unicode data<br /><br /></div>
<div class="tags"> <div class="tags">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border"> <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code"> <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>PDF_PRODUCER = 'TCPDF 5.0.013 (http://www.tcpdf.org)'</code> <code>PDF_PRODUCER = 'TCPDF 5.0.014 (http://www.tcpdf.org)'</code>
</td></tr></table> </td></tr></table>
</td></tr></table> </td></tr></table>
@ -121,7 +121,7 @@ unicode data<br /><br /></div>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:19 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -243,7 +243,7 @@ Unicode Include file for TCPDF.<br /><br /><br /><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:23 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:57 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -550,9 +550,9 @@
<dt><b>getBarcodeArray</b></dt> <dt><b>getBarcodeArray</b></dt>
<dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBarcodeArray">QRcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a barcode array which is readable by TCPDF</dd> <dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBarcodeArray">QRcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a barcode array which is readable by TCPDF</dd>
<dt><b>getBarcodeArray</b></dt> <dt><b>getBarcodeArray</b></dt>
<dd>in file 2dbarcodes.php, method <a href="com-tecnick-tcpdf/TCPDF2DBarcode.html#methodgetBarcodeArray">TCPDF2DBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file barcodes.php, method <a href="com-tecnick-tcpdf/TCPDFBarcode.html#methodgetBarcodeArray">TCPDFBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd> <dd>in file barcodes.php, method <a href="com-tecnick-tcpdf/TCPDFBarcode.html#methodgetBarcodeArray">TCPDFBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file 2dbarcodes.php, method <a href="com-tecnick-tcpdf/TCPDF2DBarcode.html#methodgetBarcodeArray">TCPDF2DBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBitStream</b></dt> <dt><b>getBitStream</b></dt>
<dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBitStream">QRcode::getBitStream()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a stream of bits.</dd> <dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBitStream">QRcode::getBitStream()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a stream of bits.</dd>
<dt><b>getBorderMode</b></dt> <dt><b>getBorderMode</b></dt>
@ -648,7 +648,7 @@
<dt><b>GetNumChars</b></dt> <dt><b>GetNumChars</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetNumChars">TCPDF::GetNumChars()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the numbero of characters in a string.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetNumChars">TCPDF::GetNumChars()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the numbero of characters in a string.</dd>
<dt><b>getNumLines</b></dt> <dt><b>getNumLines</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetNumLines">TCPDF::getNumLines()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;This method returns the estimated number of lines required to print the text (not the real number just a quick estimation).</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetNumLines">TCPDF::getNumLines()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;This method return the estimated number of lines for print a simple text string in Multicell() method.</dd>
<dt><b>getNumPages</b></dt> <dt><b>getNumPages</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetNumPages">TCPDF::getNumPages()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get the total number of insered pages.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetNumPages">TCPDF::getNumPages()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get the total number of insered pages.</dd>
<dt><b>getObjFilename</b></dt> <dt><b>getObjFilename</b></dt>
@ -685,6 +685,8 @@
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetScaleFactor">TCPDF::getScaleFactor()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the scale factor (number of points in user unit).</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetScaleFactor">TCPDF::getScaleFactor()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the scale factor (number of points in user unit).</dd>
<dt><b>getSpaceString</b></dt> <dt><b>getSpaceString</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetSpaceString">TCPDF::getSpaceString()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the string used to find spaces</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetSpaceString">TCPDF::getSpaceString()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the string used to find spaces</dd>
<dt><b>getStringHeight</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetStringHeight">TCPDF::getStringHeight()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;This method return the estimated needed height for print a simple text string in Multicell() method.</dd>
<dt><b>GetStringWidth</b></dt> <dt><b>GetStringWidth</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetStringWidth">TCPDF::GetStringWidth()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the length of a string in user unit. A font must be selected.<br /></dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetStringWidth">TCPDF::GetStringWidth()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the length of a string in user unit. A font must be selected.<br /></dd>
<dt><b>getSVGTransformMatrix</b></dt> <dt><b>getSVGTransformMatrix</b></dt>
@ -1956,7 +1958,7 @@
<a href="elementindex.html#top">top</a><br> <a href="elementindex.html#top">top</a><br>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -731,9 +731,9 @@
<dt><b>getBarcodeArray</b></dt> <dt><b>getBarcodeArray</b></dt>
<dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBarcodeArray">QRcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a barcode array which is readable by TCPDF</dd> <dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBarcodeArray">QRcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a barcode array which is readable by TCPDF</dd>
<dt><b>getBarcodeArray</b></dt> <dt><b>getBarcodeArray</b></dt>
<dd>in file 2dbarcodes.php, method <a href="com-tecnick-tcpdf/TCPDF2DBarcode.html#methodgetBarcodeArray">TCPDF2DBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file barcodes.php, method <a href="com-tecnick-tcpdf/TCPDFBarcode.html#methodgetBarcodeArray">TCPDFBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd> <dd>in file barcodes.php, method <a href="com-tecnick-tcpdf/TCPDFBarcode.html#methodgetBarcodeArray">TCPDFBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file 2dbarcodes.php, method <a href="com-tecnick-tcpdf/TCPDF2DBarcode.html#methodgetBarcodeArray">TCPDF2DBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBitStream</b></dt> <dt><b>getBitStream</b></dt>
<dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBitStream">QRcode::getBitStream()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a stream of bits.</dd> <dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBitStream">QRcode::getBitStream()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a stream of bits.</dd>
<dt><b>getBorderMode</b></dt> <dt><b>getBorderMode</b></dt>
@ -829,7 +829,7 @@
<dt><b>GetNumChars</b></dt> <dt><b>GetNumChars</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetNumChars">TCPDF::GetNumChars()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the numbero of characters in a string.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetNumChars">TCPDF::GetNumChars()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the numbero of characters in a string.</dd>
<dt><b>getNumLines</b></dt> <dt><b>getNumLines</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetNumLines">TCPDF::getNumLines()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;This method returns the estimated number of lines required to print the text (not the real number just a quick estimation).</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetNumLines">TCPDF::getNumLines()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;This method return the estimated number of lines for print a simple text string in Multicell() method.</dd>
<dt><b>getNumPages</b></dt> <dt><b>getNumPages</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetNumPages">TCPDF::getNumPages()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get the total number of insered pages.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetNumPages">TCPDF::getNumPages()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get the total number of insered pages.</dd>
<dt><b>getObjFilename</b></dt> <dt><b>getObjFilename</b></dt>
@ -866,6 +866,8 @@
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetScaleFactor">TCPDF::getScaleFactor()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the scale factor (number of points in user unit).</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetScaleFactor">TCPDF::getScaleFactor()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the scale factor (number of points in user unit).</dd>
<dt><b>getSpaceString</b></dt> <dt><b>getSpaceString</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetSpaceString">TCPDF::getSpaceString()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the string used to find spaces</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetSpaceString">TCPDF::getSpaceString()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the string used to find spaces</dd>
<dt><b>getStringHeight</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetStringHeight">TCPDF::getStringHeight()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;This method return the estimated needed height for print a simple text string in Multicell() method.</dd>
<dt><b>GetStringWidth</b></dt> <dt><b>GetStringWidth</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetStringWidth">TCPDF::GetStringWidth()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the length of a string in user unit. A font must be selected.<br /></dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetStringWidth">TCPDF::GetStringWidth()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the length of a string in user unit. A font must be selected.<br /></dd>
<dt><b>getSVGTransformMatrix</b></dt> <dt><b>getSVGTransformMatrix</b></dt>
@ -1985,7 +1987,7 @@
<a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br> <a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -35,7 +35,7 @@
<a href="#Post-parsing">Post-parsing</a><br> <a href="#Post-parsing">Post-parsing</a><br>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:23 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:57 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -64,7 +64,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br /> This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -64,7 +64,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br /> This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 19 May 2010 21:31:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Fri, 21 May 2010 18:46:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_001.php // File name : example_001.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 001 for TCPDF class // Description : Example 001 for TCPDF class
// Default Header and Footer // Default Header and Footer
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,28 +62,42 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // Set font
$pdf->SetFont('times', 'BI', 16); // dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 14);
// add a page // Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage(); $pdf->AddPage();
// print a line using Cell() // Set some content to print
$pdf->Cell(0, 12, 'Example 001 - €àèéìòù', 1, 1, 'C'); $html = <<<EOD
<h1>Welcome to <a href="http://www.tcpdf.org" style="text-decoration:none;color:black;"><span style="background-color:#CC0000;"> TC<span style="color:white;">PDF</span> </span></a>!</h1>
<i>This is the first example of TCPDF library.</i>
<p>This text is printed using the <i>writeHTMLCell()</i> method but you can also use: <i>Multicell(), writeHTML(), Write(), Cell() and Text()</i>.</p>
<p>Please check the source code documentation and other examples for further information.</p>
<p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="http://sourceforge.net/donate/index.php?group_id=128076">MAKE A DONATION!</a></p>
EOD;
// Print text using writeHTMLCell()
$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
// --------------------------------------------------------- // ---------------------------------------------------------
//Close and output PDF document // Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('example_001.pdf', 'I'); $pdf->Output('example_001.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_002.php // File name : example_002.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 002 for TCPDF class // Description : Example 002 for TCPDF class
// Removing Header and Footer // Removing Header and Footer
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -57,10 +57,10 @@ $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -70,8 +70,15 @@ $pdf->SetFont('times', 'BI', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// print a line using Cell() // set some text to print
$pdf->Cell(0, 10, 'Example 002', 1, 1, 'C'); $txt = <<<EOD
TCPDF Example 002
Default page header and footer are disabled using setPrintHeader() and setPrintFooter() methods.
EOD;
// print a block of text using Write()
$pdf->Write($h=0, $txt, $link='', $fill=0, $align='C', $ln=true, $stretch=0, $firstline=false, $firstblock=false, $maxh=0);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -79,6 +86,6 @@ $pdf->Cell(0, 10, 'Example 002', 1, 1, 'C');
$pdf->Output('example_002.pdf', 'I'); $pdf->Output('example_002.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_003.php // File name : example_003.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 003 for TCPDF class // Description : Example 003 for TCPDF class
// Custom Header and Footer // Custom Header and Footer
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -36,28 +36,26 @@ require_once('../tcpdf.php');
// Extend the TCPDF class to create custom Header and Footer // Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF { class MYPDF extends TCPDF {
//Page header //Page header
public function Header() { public function Header() {
// Logo // Logo
$this->Image(K_PATH_IMAGES.'logo_example.jpg', 10, 8, 15); $image_file = K_PATH_IMAGES.'logo_example.jpg';
$this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
// Set font // Set font
$this->SetFont('helvetica', 'B', 20); $this->SetFont('helvetica', 'B', 20);
// Move to the right
$this->Cell(80);
// Title // Title
$this->Cell(30, 10, 'Title', 0, 0, 'C'); $this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M');
// Line break
$this->Ln(20);
} }
// Page footer // Page footer
public function Footer() { public function Footer() {
// Position at 1.5 cm from bottom // Position at 15 mm from bottom
$this->SetY(-15); $this->SetY(-15);
// Set font // Set font
$this->SetFont('helvetica', 'I', 8); $this->SetFont('helvetica', 'I', 8);
// Page number // Page number
$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, 0, 'C'); $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
} }
} }
@ -90,10 +88,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -103,8 +101,15 @@ $pdf->SetFont('times', 'BI', 12);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// print a line using Cell() // set some text to print
$pdf->Cell(0, 10, 'Example 003', 0, 1, 'C'); $txt = <<<EOD
TCPDF Example 003
Custom page header and footer are defined by extending the TCPDF class and overriding the Header() and Footer() methods.
EOD;
// print a block of text using Write()
$pdf->Write($h=0, $txt, $link='', $fill=0, $align='C', $ln=true, $stretch=0, $firstline=false, $firstblock=false, $maxh=0);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -112,6 +117,6 @@ $pdf->Cell(0, 10, 'Example 003', 0, 1, 'C');
$pdf->Output('example_003.pdf', 'I'); $pdf->Output('example_003.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_004.php // File name : example_004.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 004 for TCPDF class // Description : Example 004 for TCPDF class
// Cell stretching // Cell stretching
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 004', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -75,6 +75,8 @@ $pdf->SetFont('times', 'B', 12);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
// test Cell stretching // test Cell stretching
$pdf->Cell(0, 10, 'TEST CELL STRETCH: no stretch', 1, 1, 'C', 0, '', 0); $pdf->Cell(0, 10, 'TEST CELL STRETCH: no stretch', 1, 1, 'C', 0, '', 0);
$pdf->Cell(0, 10, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1); $pdf->Cell(0, 10, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1);
@ -82,12 +84,19 @@ $pdf->Cell(0, 10, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2);
$pdf->Cell(0, 10, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3); $pdf->Cell(0, 10, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3);
$pdf->Cell(0, 10, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4); $pdf->Cell(0, 10, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4);
$pdf->Ln(10);
$pdf->Cell(60, 10, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1);
$pdf->Cell(60, 10, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2);
$pdf->Cell(60, 10, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3);
$pdf->Cell(60, 10, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4);
// --------------------------------------------------------- // ---------------------------------------------------------
//Close and output PDF document //Close and output PDF document
$pdf->Output('example_004.pdf', 'I'); $pdf->Output('example_004.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_005.php // File name : example_005.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 005 for TCPDF class // Description : Example 005 for TCPDF class
// Multicell // Multicell
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 005', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -75,21 +75,33 @@ $pdf->SetFont('times', '', 10);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// set color for filler // set color for background
$pdf->SetFillColor(255, 255, 0); $pdf->SetFillColor(255, 255, 127);
// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
// set some text for example
$txt = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
// Multicell test // Multicell test
$pdf->MultiCell(40, 5, 'A test multicell line 1 test multicell line 2 test multicell line 3', 1, 'L', 1, 0, '', '', true); $pdf->MultiCell(55, 5, '[LEFT] '.$txt, 1, 'L', 1, 0, '', '', true);
$pdf->MultiCell(40, 5, 'B test multicell line 1 test multicell line 2 test multicell line 3', 1, 'R', 0, 1, '', '', true); $pdf->MultiCell(55, 5, '[RIGHT] '.$txt, 1, 'R', 0, 1, '', '', true);
$pdf->MultiCell(40, 5, 'C test multicell line 1 test multicell line 2 test multicell line 3', 1, 'C', 0, 0, '', '', true); $pdf->MultiCell(55, 5, '[CENTER] '.$txt, 1, 'C', 0, 0, '', '', true);
$pdf->MultiCell(40, 5, 'D test multicell line 1 test multicell line 2 test multicell line 3'."\n", 1, 'J', 1, 2, '' ,'', true); $pdf->MultiCell(55, 5, '[JUSTIFY] '.$txt."\n", 1, 'J', 1, 2, '' ,'', true);
$pdf->MultiCell(40, 5, 'E test multicell line 1 test multicell line 2 test multicell line 3', 1, 'L', 0, 1, '', '', true); $pdf->MultiCell(55, 5, '[DEFAULT] '.$txt, 1, '', 0, 1, '', '', true);
$pdf->SetFillColor(255, 200, 200); // set color for background
$pdf->SetFillColor(215, 235, 255);
$pdf->MultiCell(40, 5, 'F test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line test multicell line'."\n", 1, 'J', 1, 1, '' ,'', true); // set some text for example
$txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.
// reset pointer to the last page Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.';
// print a blox of text using multicell()
$pdf->MultiCell(80, 5, $txt."\n", 1, 'J', 1, 1, '' ,'', true);
// move pointer to last page
$pdf->lastPage(); $pdf->lastPage();
// --------------------------------------------------------- // ---------------------------------------------------------
@ -98,6 +110,6 @@ $pdf->lastPage();
$pdf->Output('example_005.pdf', 'I'); $pdf->Output('example_005.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_006.php // File name : example_006.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 006 for TCPDF class // Description : Example 006 for TCPDF class
// WriteHTML and RTL support // WriteHTML and RTL support
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -75,17 +75,56 @@ $pdf->SetFont('dejavusans', '', 10);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='')
// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
// create some HTML content // create some HTML content
$htmlcontent = '<h1>HTML Example</h1>&lt; € &euro; &#8364; &amp; è &egrave; &copy; &gt; \\slash \\\\double-slash \\\\\\triple-slash<h2>List</h2>List example:<ol><li><img src="../images/logo_example.png" alt="test alt attribute" width="30" height="30" border="0" /> test image</li><li><b>bold text</b></li><li><i>italic text</i></li><li><u>underlined text</u></li><li><b>b<i>bi<u>biu</u>bi</i>b</b></li><li><a href="http://www.tecnick.com" dir="ltr">link to http://www.tecnick.com</a></li><li>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.<br />Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.</li><li>SUBLIST<ol><li>row one<ul><li>sublist</li></ul></li><li>row two</li></ol></li><li><b>T</b>E<i>S</i><u>T</u> <del>line through</del></li><li><font size="+3">font + 3</font></li><li><small>small text</small> normal <small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal</li></ol><dl><dt>Coffee</dt><dd>Black hot drink</dd><dt>Milk</dt><dd>White cold drink</dd></dl><div style="text-align:center">IMAGES<br /><img src="../images/logo_example.png" alt="test alt attribute" width="100" height="100" border="0" /><img src="../images/tiger.ai" alt="test alt attribute" width="100" height="100" border="0" /><img src="../images/logo_example.jpg" alt="test alt attribute" width="100" height="100" border="0" /></div>'; $html = '<h1>HTML Example</h1>
Some special characters: &lt; &euro; &#8364; &amp; è &egrave; &copy; &gt; \\slash \\\\double-slash \\\\\\triple-slash
<h2>List</h2>
List example:
<ol>
<li><img src="../images/logo_example.png" alt="test alt attribute" width="30" height="30" border="0" /> test image</li>
<li><b>bold text</b></li>
<li><i>italic text</i></li>
<li><u>underlined text</u></li>
<li><b>b<i>bi<u>biu</u>bi</i>b</b></li>
<li><a href="http://www.tecnick.com" dir="ltr">link to http://www.tecnick.com</a></li>
<li>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.<br />Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.</li>
<li>SUBLIST
<ol>
<li>row one
<ul>
<li>sublist</li>
</ul>
</li>
<li>row two</li>
</ol>
</li>
<li><b>T</b>E<i>S</i><u>T</u> <del>line through</del></li>
<li><font size="+3">font + 3</font></li>
<li><small>small text</small> normal <small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal</li>
</ol>
<dl>
<dt>Coffee</dt>
<dd>Black hot drink</dd>
<dt>Milk</dt>
<dd>White cold drink</dd>
</dl>
<div style="text-align:center">IMAGES<br />
<img src="../images/logo_example.png" alt="test alt attribute" width="100" height="100" border="0" /><img src="../images/tiger.ai" alt="test alt attribute" width="100" height="100" border="0" /><img src="../images/logo_example.jpg" alt="test alt attribute" width="100" height="100" border="0" />
</div>';
// output the HTML content // output the HTML content
$pdf->writeHTML($htmlcontent, true, 0, true, 0); $pdf->writeHTML($html, true, false, true, false, '');
// output some RTL HTML content // output some RTL HTML content
$pdf->writeHTML('<div style="text-align:center">The words &#8220;<span dir="rtl">&#1502;&#1494;&#1500; [mazel] &#1496;&#1493;&#1489; [tov]</span>&#8221; mean &#8220;Congratulations!&#8221;</div>', true, 0, true, 0); $html = '<div style="text-align:center">The words &#8220;<span dir="rtl">&#1502;&#1494;&#1500; [mazel] &#1496;&#1493;&#1489; [tov]</span>&#8221; mean &#8220;Congratulations!&#8221;</div>';
$pdf->writeHTML($html, true, false, true, false, '');
// test some inline CSS // test some inline CSS
$inlinecss = '<p>This is just an example of html code to demonstrate some supported CSS inline styles. $html = '<p>This is just an example of html code to demonstrate some supported CSS inline styles.
<span style="font-weight: bold;">bold text</span> <span style="font-weight: bold;">bold text</span>
<span style="text-decoration: line-through;">line-trough</span> <span style="text-decoration: line-through;">line-trough</span>
<span style="text-decoration: underline line-through;">underline and line-trough</span> <span style="text-decoration: underline line-through;">underline and line-trough</span>
@ -101,7 +140,7 @@ $inlinecss = '<p>This is just an example of html code to demonstrate some suppor
<span style="font-size: xx-large;">xx-large</span> <span style="font-size: xx-large;">xx-large</span>
</p>'; </p>';
$pdf->writeHTML($inlinecss, true, 0, true, 0); $pdf->writeHTML($html, true, false, true, false, '');
// reset pointer to the last page // reset pointer to the last page
$pdf->lastPage(); $pdf->lastPage();
@ -115,20 +154,54 @@ $pdf->AddPage();
// create some HTML content // create some HTML content
$subtable = '<table border="1" cellspacing="1" cellpadding="1"><tr><td>a</td><td>b</td></tr><tr><td>c</td><td>d</td></tr></table>'; $subtable = '<table border="1" cellspacing="1" cellpadding="1"><tr><td>a</td><td>b</td></tr><tr><td>c</td><td>d</td></tr></table>';
$htmltable = '<h2>HTML TABLE:</h2><table border="1" cellspacing="2" cellpadding="2"><tr><th>#</th><th align="right">RIGHT align</th><th align="left">LEFT align</th><th>4A</th></tr><tr><td>1</td><td bgcolor="#cccccc" align="center" colspan="2">A1 ex<i>amp</i>le <a href="http://www.tcpdf.org">link</a> column span. One two tree four five six seven eight nine ten.<br />line after br<br /><small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla<ol><li>first<ol><li>sublist</li><li>sublist</li></ol></li><li>second</li></ol><small color="#FF0000" bgcolor="#FFFF00">small small small small small small small small small small small small small small small small small small small small</small></td><td>4B</td></tr><tr><td>'.$subtable.'</td><td bgcolor="#0000FF" color="yellow" align="center">A2 € &euro; &#8364; &amp; è &egrave;<br/>A2 € &euro; &#8364; &amp; è &egrave;</td><td bgcolor="#FFFF00" align="left"><font color="#FF0000">Red</font> Yellow BG</td><td>4C</td></tr><tr><td>1A</td><td rowspan="2" colspan="2" bgcolor="#FFFFCC">2AA<br />2AB<br />2AC</td><td bgcolor="#FF0000">4D</td></tr><tr><td>1B</td><td>4E</td></tr><tr><td>1C</td><td>2C</td><td>3C</td><td>4F</td></tr></table>'; $html = '<h2>HTML TABLE:</h2>
<table border="1" cellspacing="2" cellpadding="2">
<tr>
<th>#</th>
<th align="right">RIGHT align</th>
<th align="left">LEFT align</th>
<th>4A</th>
</tr>
<tr>
<td>1</td>
<td bgcolor="#cccccc" align="center" colspan="2">A1 ex<i>amp</i>le <a href="http://www.tcpdf.org">link</a> column span. One two tree four five six seven eight nine ten.<br />line after br<br /><small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla<ol><li>first<ol><li>sublist</li><li>sublist</li></ol></li><li>second</li></ol><small color="#FF0000" bgcolor="#FFFF00">small small small small small small small small small small small small small small small small small small small small</small></td>
<td>4B</td>
</tr>
<tr>
<td>'.$subtable.'</td>
<td bgcolor="#0000FF" color="yellow" align="center">A2 &euro; &#8364; &amp; è &egrave;<br/>A2 € &euro; &#8364; &amp; è &egrave;</td>
<td bgcolor="#FFFF00" align="left"><font color="#FF0000">Red</font> Yellow BG</td>
<td>4C</td>
</tr>
<tr>
<td>1A</td>
<td rowspan="2" colspan="2" bgcolor="#FFFFCC">2AA<br />2AB<br />2AC</td>
<td bgcolor="#FF0000">4D</td>
</tr>
<tr>
<td>1B</td>
<td>4E</td>
</tr>
<tr>
<td>1C</td>
<td>2C</td>
<td>3C</td>
<td>4F</td>
</tr>
</table>';
// output the HTML content // output the HTML content
$pdf->writeHTML($htmltable, true, 0, true, 0); $pdf->writeHTML($html, true, false, true, false, '');
// Print some HTML Cells // Print some HTML Cells
$cellcontent = '<span color="red">red</span> <span color="green">green</span> <span color="blue">blue</span><br /><span color="red">red</span> <span color="green">green</span> <span color="blue">blue</span>'; $html = '<span color="red">red</span> <span color="green">green</span> <span color="blue">blue</span><br /><span color="red">red</span> <span color="green">green</span> <span color="blue">blue</span>';
$pdf->SetFillColor(255,255,0); $pdf->SetFillColor(255,255,0);
$pdf->writeHTMLCell(0, 0, '', '', $cellcontent, 'LRTB', 1, 0, true, 'L'); $pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'L', true);
$pdf->writeHTMLCell(0, 0, '', '', $cellcontent, 'LRTB', 1, 1, true, 'C'); $pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 1, true, 'C', true);
$pdf->writeHTMLCell(0, 0, '', '', $cellcontent, 'LRTB', 1, 0, true, 'R'); $pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'R', true);
// reset pointer to the last page // reset pointer to the last page
$pdf->lastPage(); $pdf->lastPage();
@ -140,8 +213,8 @@ $pdf->lastPage();
$pdf->AddPage(); $pdf->AddPage();
// create some HTML content // create some HTML content
$html = '<h1>Image alignments on HTML table</h1>
$tablealign = '<h1>Image alignments on HTML table</h1><table cellpadding="1" cellspacing="1" border="1" style="text-align:center;"> <table cellpadding="1" cellspacing="1" border="1" style="text-align:center;">
<tr><td><img src="../images/logo_example.png" border="0" height="41" width="41" /></td></tr> <tr><td><img src="../images/logo_example.png" border="0" height="41" width="41" /></td></tr>
<tr style="text-align:left;"><td><img src="../images/logo_example.png" border="0" height="41" width="41" align="top" /></td></tr> <tr style="text-align:left;"><td><img src="../images/logo_example.png" border="0" height="41" width="41" align="top" /></td></tr>
<tr style="text-align:center;"><td><img src="../images/logo_example.png" border="0" height="41" width="41" align="middle" /></td></tr> <tr style="text-align:center;"><td><img src="../images/logo_example.png" border="0" height="41" width="41" align="middle" /></td></tr>
@ -152,7 +225,7 @@ $tablealign = '<h1>Image alignments on HTML table</h1><table cellpadding="1" cel
</table>'; </table>';
// output the HTML content // output the HTML content
$pdf->writeHTML($tablealign, true, 0, true, 0); $pdf->writeHTML($html, true, false, true, false, '');
// reset pointer to the last page // reset pointer to the last page
$pdf->lastPage(); $pdf->lastPage();
@ -174,31 +247,31 @@ foreach($webcolor as $k => $v) {
} }
// output the HTML content // output the HTML content
$pdf->writeHTML($textcolors, true, 0, true, 0); $pdf->writeHTML($textcolors, true, false, true, false, '');
$pdf->writeHTML($bgcolors, true, 0, true, 0); $pdf->writeHTML($bgcolors, true, false, true, false, '');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Test word-wrap // Test word-wrap
// create some HTML content // create some HTML content
$htmltxt = '<hr /><h1>Various tests</h1><a href="#2">link to page 2</a><br /><font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font>'; $html = '<hr />
<h1>Various tests</h1>
<a href="#2">link to page 2</a><br />
<font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font>';
// output the HTML content // output the HTML content
$pdf->writeHTML($htmltxt, true, 0, true, 0); $pdf->writeHTML($html, true, false, true, false, '');
// Test fonts nesting // Test fonts nesting
$html1 = 'Default <font face="courier">Courier <font face="helvetica">Helvetica <font face="times">Times <font face="dejavusans">dejavusans </font>Times </font>Helvetica </font>Courier </font>Default';
$html2 = '<small>small text</small> normal <small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal';
$html3 = '<font size="10" color="#ff7f50">The</font> <font size="10" color="#6495ed">quick</font> <font size="14" color="#dc143c">brown</font> <font size="18" color="#008000">fox</font> <font size="22"><a href="http://www.tcpdf.org">jumps</a></font> <font size="22" color="#a0522d">over</font> <font size="18" color="#da70d6">the</font> <font size="14" color="#9400d3">lazy</font> <font size="10" color="#4169el">dog</font>.';
$teststr1 = 'Default <font face="courier">Courier <font face="helvetica">Helvetica <font face="times">Times <font face="dejavusans">dejavusans </font>Times </font>Helvetica </font>Courier </font>Default'; $html = $html1.'<br />'.$html2.'<br />'.$html3.'<br />'.$html3.'<br />'.$html2;
$teststr2 = '<small>small text</small> normal <small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal';
$teststr3 = '<font size="10" color="#ff7f50">The</font> <font size="10" color="#6495ed">quick</font> <font size="14" color="#dc143c">brown</font> <font size="18" color="#008000">fox</font> <font size="22"><a href="http://www.tcpdf.org">jumps</a></font> <font size="22" color="#a0522d">over</font> <font size="18" color="#da70d6">the</font> <font size="14" color="#9400d3">lazy</font> <font size="10" color="#4169el">dog</font>.';
$html = $teststr1.'<br />'.$teststr2.'<br />'.$teststr3.'<br />'.$teststr3.'<br />'.$teststr2;
// output the HTML content // output the HTML content
$pdf->writeHTML($html, true, 0, true, 0); $pdf->writeHTML($html, true, false, true, false, '');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// test pre tag // test pre tag
@ -206,7 +279,7 @@ $pdf->writeHTML($html, true, 0, true, 0);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$htmlcontent = <<<EOF $html = <<<EOF
<div style="background-color:#880000;color:white;"> <div style="background-color:#880000;color:white;">
Hello World!<br /> Hello World!<br />
Hello Hello
@ -225,7 +298,7 @@ int main() {
EOF; EOF;
// output the HTML content // output the HTML content
$pdf->writeHTML($htmlcontent, true, 0, true, 0); $pdf->writeHTML($html, true, false, true, false, '');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -238,6 +311,6 @@ $pdf->lastPage();
$pdf->Output('example_006.pdf', 'I'); $pdf->Output('example_006.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_007.php // File name : example_007.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 007 for TCPDF class // Description : Example 007 for TCPDF class
// Two independent columns with WriteHTMLCell // Two independent columns with WriteHTMLCell()
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -22,7 +22,7 @@
/** /**
* Creates an example PDF TEST document using TCPDF * Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Two independent columns with WriteHTMLCell * @abstract TCPDF - Example: Two independent columns with WriteHTMLCell()
* @author Nicola Asuni * @author Nicola Asuni
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com * @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @link http://tcpdf.org * @link http://tcpdf.org
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 007', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -76,22 +76,32 @@ $pdf->SetFont('times', '', 12);
$pdf->AddPage(); $pdf->AddPage();
// create columns content // create columns content
$left_column = '<b>left column</b> left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column'; $left_column = '<b>LEFT COLUMN</b> left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column';
$right_column = '<b>right column</b> right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column'; $right_column = '<b>RIGHT COLUMN</b> right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column';
// set columns width // writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
$first_column_width = 80;
$second_column_width = 80;
// get current vertical position // get current vertical position
$current_y_position = $pdf->getY(); $y = $pdf->getY();
// set color for background
$pdf->SetFillColor(255, 255, 200);
// set color for text
$pdf->SetTextColor(0, 63, 127);
// write the first column // write the first column
$pdf->writeHTMLCell($first_column_width, '', '', $current_y_position, $left_column, 1, 0, 0, true); $pdf->writeHTMLCell(80, '', '', $y, $left_column, 1, 0, 1, true, 'J', true);
// set color for background
$pdf->SetFillColor(215, 235, 255);
// set color for text
$pdf->SetTextColor(127, 31, 0);
// write the second column // write the second column
$pdf->writeHTMLCell($second_column_width, '', '', '', $right_column, 1, 1, 0, true); $pdf->writeHTMLCell(80, '', '', '', $right_column, 1, 1, 1, true, 'J', true);
// reset pointer to the last page // reset pointer to the last page
$pdf->lastPage(); $pdf->lastPage();
@ -102,6 +112,6 @@ $pdf->lastPage();
$pdf->Output('example_007.pdf', 'I'); $pdf->Output('example_007.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_008.php // File name : example_008.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2010-02-24 // Last Update : 2010-05-20
// //
// Description : Example 008 for TCPDF class // Description : Example 008 for TCPDF class
// Include external UTF-8 text file // Include external UTF-8 text file
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 008', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -78,11 +78,14 @@ $pdf->AddPage();
// get esternal file content // get esternal file content
$utf8text = file_get_contents('../cache/utf8test.txt', false); $utf8text = file_get_contents('../cache/utf8test.txt', false);
// set a background color // set color for text
$pdf->SetFillColor(230, 240, 255, true); $pdf->SetTextColor(0, 63, 127);
//Write($h, $txt, $link='', $fill=0, $align='', $ln=false, $stretch=0, $firstline=false, $firstblock=false, $maxh=0)
// write the text // write the text
$pdf->Write(5, $utf8text, '', 1); $pdf->Write(5, $utf8text, '', 0, '', false, 0, false, false, 0);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -90,6 +93,6 @@ $pdf->Write(5, $utf8text, '', 1);
$pdf->Output('example_008.pdf', 'I'); $pdf->Output('example_008.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_009.php // File name : example_009.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 009 for TCPDF class // Description : Example 009 for TCPDF class
// Test Image // Test Image
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 009', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -75,8 +75,10 @@ $pdf->AddPage();
// set JPEG quality // set JPEG quality
$pdf->setJPEGQuality(75); $pdf->setJPEGQuality(75);
// Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
// Image example // Image example
$pdf->Image('../images/image_demo.jpg', 50, 50, 100, 150, '', 'http://www.tcpdf.org', '', true, 150); $pdf->Image('../images/image_demo.jpg', 50, 50, 100, 150, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -84,6 +86,6 @@ $pdf->Image('../images/image_demo.jpg', 50, 50, 100, 150, '', 'http://www.tcpdf.
$pdf->Output('example_009.pdf', 'I'); $pdf->Output('example_009.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_010.php // File name : example_010.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2010-05-11 // Last Update : 2010-05-20
// //
// Description : Example 010 for TCPDF class // Description : Example 010 for TCPDF class
// Text on multiple columns // Text on multiple columns
@ -114,7 +114,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 010', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -139,11 +139,11 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// print a text // print TEXT
$pdf->PrintChapter(1, 'A RUNAWAY REEF', '../cache/chapter_demo_1.txt', false); $pdf->PrintChapter(1, 'LOREM IPSUM [TEXT]', '../cache/chapter_demo_1.txt', false);
// print an html text // print HTML
$pdf->PrintChapter(2, 'THE PROS AND CONS', '../cache/chapter_demo_2.txt', true); $pdf->PrintChapter(2, 'LOREM IPSUM [HTML]', '../cache/chapter_demo_2.txt', true);
// --------------------------------------------------------- // ---------------------------------------------------------

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_011.php // File name : example_011.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 011 for TCPDF class // Description : Example 011 for TCPDF class
// Colored Table // Colored Table
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -35,7 +35,7 @@ require_once('../tcpdf.php');
// extend TCPF with custom functions // extend TCPF with custom functions
class MYPDF extends TCPDF { class MYPDF extends TCPDF {
// Load table data from file // Load table data from file
public function LoadData($file) { public function LoadData($file) {
// Read file lines // Read file lines
@ -46,7 +46,7 @@ class MYPDF extends TCPDF {
} }
return $data; return $data;
} }
// Colored table // Colored table
public function ColoredTable($header,$data) { public function ColoredTable($header,$data) {
// Colors, line width and bold font // Colors, line width and bold font
@ -57,8 +57,10 @@ class MYPDF extends TCPDF {
$this->SetFont('', 'B'); $this->SetFont('', 'B');
// Header // Header
$w = array(40, 35, 40, 45); $w = array(40, 35, 40, 45);
for($i = 0; $i < count($header); $i++) $num_headers = count($header);
$this->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1); for($i = 0; $i < $num_headers; ++$i) {
$this->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1);
}
$this->Ln(); $this->Ln();
// Color and font restoration // Color and font restoration
$this->SetFillColor(224, 235, 255); $this->SetFillColor(224, 235, 255);
@ -89,7 +91,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 011', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -107,10 +109,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -135,6 +137,6 @@ $pdf->ColoredTable($header, $data);
$pdf->Output('example_011.pdf', 'I'); $pdf->Output('example_011.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_012.php // File name : example_012.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2010-05-04 // Last Update : 2010-05-20
// //
// Description : Example 012 for TCPDF class // Description : Example 012 for TCPDF class
// Graphic Functions // Graphic Functions
@ -173,6 +173,8 @@ $pdf->Arrow($x0=200, $y0=280, $x1=200, $y1=260, $head_style=3, $arm_size=5, $arm
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 0, 'Arc of Ellipse');
// center of ellipse // center of ellipse
$xc=100; $xc=100;
$yc=100; $yc=100;

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_013.php // File name : example_013.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2010-04-05 // Last Update : 2010-05-20
// //
// Description : Example 013 for TCPDF class // Description : Example 013 for TCPDF class
// Graphic Transformations // Graphic Transformations
@ -43,15 +43,20 @@ $pdf->SetTitle('TCPDF Example 013');
$pdf->SetSubject('TCPDF Tutorial'); $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// disable header and footer // set default header data
$pdf->setPrintHeader(false); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 013', PDF_HEADER_STRING);
$pdf->setPrintFooter(false);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font // set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins //set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks //set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
@ -65,129 +70,134 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', '', 10); $pdf->SetFont('helvetica', 'B', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
//Scaling $pdf->Write(0, 'Graphic Transformations', '', 0, 'C', 1, 0, false, false, 0);
// set font
$pdf->SetFont('helvetica', '', 10);
// --- Scaling ---------------------------------------------
$pdf->SetDrawColor(200); $pdf->SetDrawColor(200);
$pdf->SetTextColor(200); $pdf->SetTextColor(200);
$pdf->Rect(50, 20, 40, 10, 'D'); $pdf->Rect(50, 70, 40, 10, 'D');
$pdf->Text(50, 16, 'Scale'); $pdf->Text(50, 66, 'Scale');
$pdf->SetDrawColor(0); $pdf->SetDrawColor(0);
$pdf->SetTextColor(0); $pdf->SetTextColor(0);
//Start Transformation // Start Transformation
$pdf->StartTransform(); $pdf->StartTransform();
//Scale by 150% centered by (50,30) which is the lower left corner of the rectangle // Scale by 150% centered by (50,80) which is the lower left corner of the rectangle
$pdf->ScaleXY(150, 50, 30); $pdf->ScaleXY(150, 50, 80);
$pdf->Rect(50, 20, 40, 10, 'D'); $pdf->Rect(50, 70, 40, 10, 'D');
$pdf->Text(50, 16, 'Scale'); $pdf->Text(50, 66, 'Scale');
//Stop Transformation // Stop Transformation
$pdf->StopTransform(); $pdf->StopTransform();
//Translation // --- Translation -----------------------------------------
$pdf->SetDrawColor(200); $pdf->SetDrawColor(200);
$pdf->SetTextColor(200); $pdf->SetTextColor(200);
$pdf->Rect(125, 20, 40, 10, 'D'); $pdf->Rect(125, 70, 40, 10, 'D');
$pdf->Text(125, 16, 'Translate'); $pdf->Text(125, 66, 'Translate');
$pdf->SetDrawColor(0); $pdf->SetDrawColor(0);
$pdf->SetTextColor(0); $pdf->SetTextColor(0);
//Start Transformation // Start Transformation
$pdf->StartTransform(); $pdf->StartTransform();
//Translate 7 to the right, 5 to the bottom // Translate 7 to the right, 5 to the bottom
$pdf->Translate(7, 5); $pdf->Translate(7, 5);
$pdf->Rect(125, 20, 40, 10, 'D'); $pdf->Rect(125, 70, 40, 10, 'D');
$pdf->Text(125, 16, 'Translate'); $pdf->Text(125, 66, 'Translate');
//Stop Transformation // Stop Transformation
$pdf->StopTransform(); $pdf->StopTransform();
//Rotation // --- Rotation --------------------------------------------
$pdf->SetDrawColor(200); $pdf->SetDrawColor(200);
$pdf->SetTextColor(200); $pdf->SetTextColor(200);
$pdf->Rect(50, 50, 40, 10, 'D'); $pdf->Rect(70, 100, 40, 10, 'D');
$pdf->Text(50, 46, 'Rotate'); $pdf->Text(70, 96, 'Rotate');
$pdf->SetDrawColor(0); $pdf->SetDrawColor(0);
$pdf->SetTextColor(0); $pdf->SetTextColor(0);
//Start Transformation // Start Transformation
$pdf->StartTransform(); $pdf->StartTransform();
//Rotate 20 degrees counter-clockwise centered by (50,60) which is the lower left corner of the rectangle // Rotate 20 degrees counter-clockwise centered by (70,110) which is the lower left corner of the rectangle
$pdf->Rotate(20, 50, 60); $pdf->Rotate(20, 70, 110);
$pdf->Rect(50, 50, 40, 10, 'D'); $pdf->Rect(70, 100, 40, 10, 'D');
$pdf->Text(50, 46, 'Rotate'); $pdf->Text(70, 96, 'Rotate');
//Stop Transformation // Stop Transformation
$pdf->StopTransform(); $pdf->StopTransform();
//Skewing // --- Skewing ---------------------------------------------
$pdf->SetDrawColor(200); $pdf->SetDrawColor(200);
$pdf->SetTextColor(200); $pdf->SetTextColor(200);
$pdf->Rect(125, 50, 40, 10, 'D'); $pdf->Rect(125, 100, 40, 10, 'D');
$pdf->Text(125, 46, 'Skew'); $pdf->Text(125, 96, 'Skew');
$pdf->SetDrawColor(0); $pdf->SetDrawColor(0);
$pdf->SetTextColor(0); $pdf->SetTextColor(0);
//Start Transformation // Start Transformation
$pdf->StartTransform(); $pdf->StartTransform();
//skew 30 degrees along the x-axis centered by (125,60) which is the lower left corner of the rectangle // skew 30 degrees along the x-axis centered by (125,110) which is the lower left corner of the rectangle
$pdf->SkewX(30, 125, 60); $pdf->SkewX(30, 125, 110);
$pdf->Rect(125, 50, 40, 10, 'D'); $pdf->Rect(125, 100, 40, 10, 'D');
$pdf->Text(125, 46, 'Skew'); $pdf->Text(125, 96, 'Skew');
//Stop Transformation // Stop Transformation
$pdf->StopTransform(); $pdf->StopTransform();
//Mirroring horizontally // --- Mirroring horizontally ------------------------------
$pdf->SetDrawColor(200); $pdf->SetDrawColor(200);
$pdf->SetTextColor(200); $pdf->SetTextColor(200);
$pdf->Rect(50, 80, 40, 10, 'D'); $pdf->Rect(70, 130, 40, 10, 'D');
$pdf->Text(50, 76, 'MirrorH'); $pdf->Text(70, 126, 'MirrorH');
$pdf->SetDrawColor(0); $pdf->SetDrawColor(0);
$pdf->SetTextColor(0); $pdf->SetTextColor(0);
//Start Transformation // Start Transformation
$pdf->StartTransform(); $pdf->StartTransform();
//mirror horizontally with axis of reflection at x-position 50 (left side of the rectangle) // mirror horizontally with axis of reflection at x-position 70 (left side of the rectangle)
$pdf->MirrorH(50); $pdf->MirrorH(70);
$pdf->Rect(50, 80, 40, 10, 'D'); $pdf->Rect(70, 130, 40, 10, 'D');
$pdf->Text(50, 76, 'MirrorH'); $pdf->Text(70, 126, 'MirrorH');
//Stop Transformation // Stop Transformation
$pdf->StopTransform(); $pdf->StopTransform();
//Mirroring vertically // --- Mirroring vertically --------------------------------
$pdf->SetDrawColor(200); $pdf->SetDrawColor(200);
$pdf->SetTextColor(200); $pdf->SetTextColor(200);
$pdf->Rect(125, 80, 40, 10, 'D'); $pdf->Rect(125, 130, 40, 10, 'D');
$pdf->Text(125, 76, 'MirrorV'); $pdf->Text(125, 126, 'MirrorV');
$pdf->SetDrawColor(0); $pdf->SetDrawColor(0);
$pdf->SetTextColor(0); $pdf->SetTextColor(0);
//Start Transformation // Start Transformation
$pdf->StartTransform(); $pdf->StartTransform();
//mirror vertically with axis of reflection at y-position 90 (bottom side of the rectangle) // mirror vertically with axis of reflection at y-position 140 (bottom side of the rectangle)
$pdf->MirrorV(90); $pdf->MirrorV(140);
$pdf->Rect(125, 80, 40, 10, 'D'); $pdf->Rect(125, 130, 40, 10, 'D');
$pdf->Text(125, 76, 'MirrorV'); $pdf->Text(125, 126, 'MirrorV');
//Stop Transformation // Stop Transformation
$pdf->StopTransform(); $pdf->StopTransform();
//Point reflection // --- Point reflection ------------------------------------
$pdf->SetDrawColor(200); $pdf->SetDrawColor(200);
$pdf->SetTextColor(200); $pdf->SetTextColor(200);
$pdf->Rect(50, 110, 40, 10, 'D'); $pdf->Rect(70, 160, 40, 10, 'D');
$pdf->Text(50, 106, 'MirrorP'); $pdf->Text(70, 156, 'MirrorP');
$pdf->SetDrawColor(0); $pdf->SetDrawColor(0);
$pdf->SetTextColor(0); $pdf->SetTextColor(0);
//Start Transformation // Start Transformation
$pdf->StartTransform(); $pdf->StartTransform();
//point reflection at the lower left point of rectangle // point reflection at the lower left point of rectangle
$pdf->MirrorP(50,120); $pdf->MirrorP(70,170);
$pdf->Rect(50, 110, 40, 10, 'D'); $pdf->Rect(70, 160, 40, 10, 'D');
$pdf->Text(50, 106, 'MirrorP'); $pdf->Text(70, 156, 'MirrorP');
//Stop Transformation // Stop Transformation
$pdf->StopTransform(); $pdf->StopTransform();
//Mirroring against a straigth line described by a point (120, 120) and an angle -20° // --- Mirroring against a straigth line described by a point (120, 120) and an angle -20°
$angle=-20; $angle=-20;
$px=120; $px=120;
$py=120; $py=170;
//just vor visualisation: the straight line to mirror against // just for visualisation: the straight line to mirror against
$pdf->SetDrawColor(200); $pdf->SetDrawColor(200);
$pdf->Line($px-1,$py-1,$px+1,$py+1); $pdf->Line($px-1,$py-1,$px+1,$py+1);
@ -199,16 +209,16 @@ $pdf->StopTransform();
$pdf->SetDrawColor(200); $pdf->SetDrawColor(200);
$pdf->SetTextColor(200); $pdf->SetTextColor(200);
$pdf->Rect(125, 110, 40, 10, 'D'); $pdf->Rect(125, 160, 40, 10, 'D');
$pdf->Text(125, 106, 'MirrorL'); $pdf->Text(125, 156, 'MirrorL');
$pdf->SetDrawColor(0); $pdf->SetDrawColor(0);
$pdf->SetTextColor(0); $pdf->SetTextColor(0);
//Start Transformation //Start Transformation
$pdf->StartTransform(); $pdf->StartTransform();
//mirror against the straight line //mirror against the straight line
$pdf->MirrorL($angle, $px, $py); $pdf->MirrorL($angle, $px, $py);
$pdf->Rect(125, 110, 40, 10, 'D'); $pdf->Rect(125, 160, 40, 10, 'D');
$pdf->Text(125, 106, 'MirrorL'); $pdf->Text(125, 156, 'MirrorL');
//Stop Transformation //Stop Transformation
$pdf->StopTransform(); $pdf->StopTransform();

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_014.php // File name : example_014.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 014 for TCPDF class // Description : Example 014 for TCPDF class
// Javascript Form and user rights (only works on Adobe Acrobat) // Javascript Form and user rights (only works on Adobe Acrobat)
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 014', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -85,7 +85,7 @@ This name allows to manipulate them via JavaScript in order to perform some vali
$pdf->setFormDefaultProp(array('lineWidth'=>1, 'borderStyle'=>'solid', 'fillColor'=>array(255, 255, 200), 'strokeColor'=>array(255, 128, 128))); $pdf->setFormDefaultProp(array('lineWidth'=>1, 'borderStyle'=>'solid', 'fillColor'=>array(255, 255, 200), 'strokeColor'=>array(255, 128, 128)));
$pdf->SetFont('helvetica', 'BI', 18); $pdf->SetFont('helvetica', 'BI', 18);
$pdf->Cell(0, 5, 'Subscription form', 0, 1, 'C'); $pdf->Cell(0, 5, 'Example of Form', 0, 1, 'C');
$pdf->Ln(10); $pdf->Ln(10);
$pdf->SetFont('helvetica', '', 12); $pdf->SetFont('helvetica', '', 12);
@ -186,6 +186,6 @@ $pdf->IncludeJS($js);
$pdf->Output('example_014.pdf', 'I'); $pdf->Output('example_014.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_015.php // File name : example_015.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 015 for TCPDF class // Description : Example 015 for TCPDF class
// Bookmarks (Table of Content) // Bookmarks (Table of Content)
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 015', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,13 +62,15 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// Bookmark($txt, $level=0, $y=-1, $page='')
// set font // set font
$pdf->SetFont('times', 'B', 20); $pdf->SetFont('times', 'B', 20);
@ -81,6 +83,13 @@ $pdf->Bookmark('Chapter 1', 0, 0);
// print a line using Cell() // print a line using Cell()
$pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L'); $pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L');
$pdf->SetFont('times', 'I', 14);
$pdf->Write(0, 'You can set PDF Bookmarks using the Bookmark() method.');
$pdf->SetFont('times', 'B', 20);
// add other pages and bookmarks
$pdf->AddPage(); $pdf->AddPage();
$pdf->Bookmark('Paragraph 1.1', 1, 0); $pdf->Bookmark('Paragraph 1.1', 1, 0);
$pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L'); $pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L');
@ -111,6 +120,6 @@ $pdf->Cell(0, 10, 'Chapter 3', 0, 1, 'L');
$pdf->Output('example_015.pdf', 'I'); $pdf->Output('example_015.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_016.php // File name : example_016.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2010-05-13 // Last Update : 2010-05-20
// //
// Description : Example 016 for TCPDF class // Description : Example 016 for TCPDF class
// Document Encryption / Security // Document Encryption / Security
@ -84,7 +84,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 016', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array('helvetica', '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array('helvetica', '', PDF_FONT_SIZE_MAIN));
@ -110,13 +110,21 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('times', '', 20); $pdf->SetFont('times', '', 16);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// print a line using Cell() // set some text to print
$pdf->Cell(0, 10, 'Encryption Example', 1, 1, 'C'); $txt = <<<EOD
Encryption Example
Consult the source code documentation for the SetProtection() method.
EOD;
// print a block of text using Write()
$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
// --------------------------------------------------------- // ---------------------------------------------------------

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_017.php // File name : example_017.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 017 for TCPDF class // Description : Example 017 for TCPDF class
// Two independent columns with MultiCell // Two independent columns with MultiCell
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 017', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,36 +62,50 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('times', '', 12); $pdf->SetFont('helvetica', '', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->Write(0, 'Example of independent Multicell() columns', '', 0, 'L', true, 0, false, false, 0);
$pdf->Ln(5);
$pdf->SetFont('times', '', 12);
// create columns content // create columns content
$left_column = 'START left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column END'."\n"; // create columns content
$left_column = '[LEFT COLUMN] left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column'."\n";
$right_column = 'START right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column END'."\n"; $right_column = '[RIGHT COLUMN] right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column'."\n";
// set columns width // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
$first_column_width = 80;
$second_column_width = 80;
// get current vertical position // set color for background
$current_y_position = $pdf->getY(); $pdf->SetFillColor(255, 255, 200);
// set color for text
$pdf->SetTextColor(0, 63, 127);
// write the first column // write the first column
$pdf->MultiCell($first_column_width, 0, $left_column, 1, 'J', 0, 0, '', '', true, 0); $pdf->MultiCell(80, 0, $left_column, 1, 'J', 1, 0, '', '', true, 0, false, true, 0);
// set color for background
$pdf->SetFillColor(215, 235, 255);
// set color for text
$pdf->SetTextColor(127, 31, 0);
// write the second column // write the second column
$pdf->MultiCell($second_column_width, 0, $right_column, 1, 'J', 0, 1, '', '', true, 0); $pdf->MultiCell(80, 0, $right_column, 1, 'J', 1, 1, '', '', true, 0, false, true, 0);
// reset pointer to the last page // reset pointer to the last page
$pdf->lastPage(); $pdf->lastPage();
@ -102,6 +116,6 @@ $pdf->lastPage();
$pdf->Output('example_017.pdf', 'I'); $pdf->Output('example_017.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_018.php // File name : example_018.php
// Begin : 2008-03-06 // Begin : 2008-03-06
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 018 for TCPDF class // Description : Example 018 for TCPDF class
// RTL document with Persian language // RTL document with Persian language
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 018', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,7 +62,7 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language dependent data: // set some language dependent data:
$lg = Array(); $lg = Array();
@ -72,7 +72,7 @@ $lg['a_meta_language'] = 'fa';
$lg['w_page'] = 'page'; $lg['w_page'] = 'page';
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($lg); $pdf->setLanguageArray($lg);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -91,6 +91,9 @@ $pdf->setRTL(false);
$pdf->SetFontSize(10); $pdf->SetFontSize(10);
// print newline
$pdf->Ln();
// Persian and English content // Persian and English content
$htmlpersiantranslation = '<span color="#0000ff">Hi, At last Problem of Persian PDF Solved completely. This is a example for it.<br />Problem of "jeh" letter in some word like "ویژه" (=special) fix too.<br />The joining of laa and alf letter fix now.<br />Special thanks to "Nicola Asuni" and "Mohamad Ali Golkar" for Persian support.</span>'; $htmlpersiantranslation = '<span color="#0000ff">Hi, At last Problem of Persian PDF Solved completely. This is a example for it.<br />Problem of "jeh" letter in some word like "ویژه" (=special) fix too.<br />The joining of laa and alf letter fix now.<br />Special thanks to "Nicola Asuni" and "Mohamad Ali Golkar" for Persian support.</span>';
$pdf->WriteHTML($htmlpersiantranslation, true, 0, true, 0); $pdf->WriteHTML($htmlpersiantranslation, true, 0, true, 0);
@ -98,22 +101,26 @@ $pdf->WriteHTML($htmlpersiantranslation, true, 0, true, 0);
// Restore RTL direction // Restore RTL direction
$pdf->setRTL(true); $pdf->setRTL(true);
$pdf->Ln(10); // set font size
$pdf->SetFont('almohanad', '', 18); $pdf->SetFont('almohanad', '', 18);
// print newline
$pdf->Ln();
// Arabic and English content // Arabic and English content
$pdf->Cell(0, 12, 'بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ',0,1,'C'); $pdf->Cell(0, 12, 'بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ',0,1,'C');
$htmlcontent = 'تمَّ بِحمد الله حلّ مشكلة الكتابة باللغة العربية في ملفات الـ<span color="#FF0000">PDF</span> مع دعم الكتابة <span color="#0000FF">من اليمين إلى اليسار</span> و<span color="#009900">الحركَات</span> .<br />تم الحل بواسطة <span color="#993399">صالح المطرفي و Asuni Nicola</span> . '; $htmlcontent = 'تمَّ بِحمد الله حلّ مشكلة الكتابة باللغة العربية في ملفات الـ<span color="#FF0000">PDF</span> مع دعم الكتابة <span color="#0000FF">من اليمين إلى اليسار</span> و<span color="#009900">الحركَات</span> .<br />تم الحل بواسطة <span color="#993399">صالح المطرفي و Asuni Nicola</span> . ';
$pdf->WriteHTML($htmlcontent, true, 0, true, 0); $pdf->WriteHTML($htmlcontent, true, 0, true, 0);
$pdf->Ln(5);
// set LTR direction for english translation // set LTR direction for english translation
$pdf->setRTL(false); $pdf->setRTL(false);
// set font size
$pdf->SetFontSize(18); $pdf->SetFontSize(18);
// print newline
$pdf->Ln();
// Arabic and English content // Arabic and English content
$htmlcontent2 = '<span color="#0000ff">This is Arabic "العربية" Example With TCPDF.</span>'; $htmlcontent2 = '<span color="#0000ff">This is Arabic "العربية" Example With TCPDF.</span>';
$pdf->WriteHTML($htmlcontent2, true, 0, true, 0); $pdf->WriteHTML($htmlcontent2, true, 0, true, 0);
@ -124,6 +131,6 @@ $pdf->WriteHTML($htmlcontent2, true, 0, true, 0);
$pdf->Output('example_018.pdf', 'I'); $pdf->Output('example_018.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_019.php // File name : example_019.php
// Begin : 2008-03-07 // Begin : 2008-03-07
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 019 for TCPDF class // Description : Example 019 for TCPDF class
// Non unicode with alternative config file // Non unicode with alternative config file
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -49,7 +49,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 019', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -67,7 +67,7 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language dependent data: // set some language dependent data:
$lg = Array(); $lg = Array();
@ -77,23 +77,24 @@ $lg['a_meta_language'] = 'en';
$lg['w_page'] = 'page'; $lg['w_page'] = 'page';
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($lg); $pdf->setLanguageArray($lg);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', 'BIU', 20); $pdf->SetFont('helvetica', '', 12);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// print a line using Cell() // set color for background
$pdf->Cell(0, 10, 'Example 019', 1, 1, 'C'); $pdf->SetFillColor(200, 255, 200);
$pdf->Ln(); $txt = 'An alternative configuration file is used on this example.
Check the definition of the K_TCPDF_EXTERNAL_CONFIG constant on the source code.';
$pdf->SetFont('times', '', 10); // print some text
$pdf->MultiCell(80, 0, 'Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.'."\n", 1, 'J', 0, 1, '', '', true, 0); $pdf->MultiCell(0, 0, $txt."\n", 1, 'J', 1, 1, '', '', true, 0, false, true, 0);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -101,6 +102,6 @@ $pdf->MultiCell(80, 0, 'Cras eros leo, porttitor porta, accumsan fermentum, orna
$pdf->Output('example_019.pdf', 'I'); $pdf->Output('example_019.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,10 +2,10 @@
//============================================================+ //============================================================+
// File name : example_020.php // File name : example_020.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 020 for TCPDF class // Description : Example 020 for TCPDF class
// Two columns composed by MultiCell of different // Two columns composed by MultiCell of different
// heights // heights
// //
// Author: Nicola Asuni // Author: Nicola Asuni
@ -35,27 +35,28 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// extend TCPF with custom functions // extend TCPF with custom functions
class MYPDF extends TCPDF { class MYPDF extends TCPDF {
public function MultiRow($left, $right) { public function MultiRow($left, $right) {
//MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0) // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0)
$page_start = $this->getPage(); $page_start = $this->getPage();
$y_start = $this->GetY(); $y_start = $this->GetY();
// write the left cell // write the left cell
$this->MultiCell(40, 0, $left, 1, 'R', 0, 2, '', '', true, 0); $this->MultiCell(40, 0, $left, 1, 'R', 1, 2, '', '', true, 0);
$page_end_1 = $this->getPage(); $page_end_1 = $this->getPage();
$y_end_1 = $this->GetY(); $y_end_1 = $this->GetY();
$this->setPage($page_start); $this->setPage($page_start);
// write the right cell // write the right cell
$this->MultiCell(0, 0, $right, 1, 'J', 0, 1, $this->GetX() ,$y_start, true, 0); $this->MultiCell(0, 0, $right, 1, 'J', 0, 1, $this->GetX() ,$y_start, true, 0);
$page_end_2 = $this->getPage(); $page_end_2 = $this->getPage();
$y_end_2 = $this->GetY(); $y_end_2 = $this->GetY();
// set the new row position by case // set the new row position by case
if (max($page_end_1,$page_end_2) == $page_start) { if (max($page_end_1,$page_end_2) == $page_start) {
$ynew = max($y_end_1, $y_end_2); $ynew = max($y_end_1, $y_end_2);
@ -66,11 +67,11 @@ class MYPDF extends TCPDF {
} else { } else {
$ynew = $y_end_2; $ynew = $y_end_2;
} }
$this->setPage(max($page_end_1,$page_end_2)); $this->setPage(max($page_end_1,$page_end_2));
$this->SetXY($this->GetX(),$ynew); $this->SetXY($this->GetX(),$ynew);
} }
} }
// create new PDF document // create new PDF document
@ -84,7 +85,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 020', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -110,17 +111,28 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('times', '', 9); $pdf->SetFont('helvetica', '', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->Write(0, 'Example of text layout using Multicell()', '', 0, 'L', true, 0, false, false, 0);
$pdf->Ln(5);
$pdf->SetFont('times', '', 9);
//$pdf->SetCellPadding(0); //$pdf->SetCellPadding(0);
//$pdf->SetLineWidth(2); //$pdf->SetLineWidth(2);
$text = 'Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis. Cras nulla nulla, hendrerit et, porttitor eu, adipiscing et, lorem. Pellentesque sit amet augue. Nam lobortis sollicitudin turpis. Sed velit est, mollis non, elementum ac, tempor quis, arcu. Aliquam a pede. Quisque arcu magna, nonummy eget, hendrerit a, lacinia egestas, enim. Donec bibendum. In a ipsum. Sed gravida facilisis sem. Nam tempus, tellus ut tincidunt elementum, augue tellus fermentum quam, sit amet lobortis sem ipsum sed elit.In accumsan ligula nonummy libero. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed vel risus. Vestibulum ut lacus. Proin fermentum, erat a commodo lacinia, lacus dui hendrerit nulla, et pellentesque neque diam at elit. Fusce blandit, dolor pharetra bibendum lacinia, augue sem scelerisque sem, bibendum sodales orci justo et sapien. Etiam nec eros ac turpis lobortis interdum. Integer volutpat nibh a lacus. Duis erat est, rhoncus nec, rhoncus viverra, pulvinar sit amet, leo. Duis blandit. Nunc convallis nisi ac ante. Cras nunc massa, molestie quis, porttitor a, volutpat accumsan, quam. Nullam a erat vitae orci bibendum viverra. Donec tristique leo eget nisl adipiscing pellentesque. Nam vehicula, enim quis aliquet euismod, dolor sem pellentesque libero, nec blandit nisi erat sit amet dui. Integer sapien. Donec molestie metus in neque. Suspendisse porttitor enim a nisl.Maecenas lacinia dolor ornare ligula. Maecenas eu eros. Curabitur non leo non nulla fringilla auctor. Etiam porttitor diam vel quam. Maecenas sed ligula nec massa venenatis faucibus. Curabitur aliquet accumsan tellus. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse vitae eros ac purus fermentum suscipit. Curabitur interdum orci a mi. Nunc placerat diam in elit.Nunc elit. Maecenas vulputate, sem sit amet condimentum lacinia, ipsum eros porta dolor, sed luctus magna ante eu nisl. Proin non nisi. Vivamus sed quam et est lobortis porttitor. Cras sit amet urna sit amet elit ultricies consequat. Praesent blandit elit ut urna. Cras hendrerit rhoncus sapien. Fusce ullamcorper lobortis ipsum. Pellentesque vel velit at sem blandit facilisis. Nulla aliquet orci id metus.'; // set color for background
$pdf->SetFillColor(255, 255, 200);
$text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.
Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.';
// print some rows just as example // print some rows just as example
for ($i = 0; $i < 5; $i++) { for ($i = 0; $i < 7; ++$i) {
$pdf->MultiRow('Row '.($i+1), $text."\n"); $pdf->MultiRow('Row '.($i+1), $text."\n");
} }
@ -133,6 +145,6 @@ $pdf->lastPage();
$pdf->Output('example_020.pdf', 'I'); $pdf->Output('example_020.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_021.php // File name : example_021.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 021 for TCPDF class // Description : Example 021 for TCPDF class
// WriteHTML text flow // WriteHTML text flow
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 021', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -76,7 +76,7 @@ $pdf->SetFont('helvetica', '', 9);
$pdf->AddPage(); $pdf->AddPage();
// create some HTML content // create some HTML content
$html = 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. <em>Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?</em> <em>Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</em><br /><br /><b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i><br /><br /><b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u>'; $html = '<h1>Example of HTML text flow</h1>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. <em>Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?</em> <em>Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</em><br /><br /><b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i> -&gt; &nbsp;&nbsp; <b>A</b> + <b>B</b> = <b>C</b> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>B</i> = <i>A</i> &nbsp;&nbsp; -&gt; &nbsp;&nbsp; <i>C</i> - <i>A</i> = <i>B</i><br /><br /><b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u> <b>Bold</b><i>Italic</i><u>Underlined</u>';
// output the HTML content // output the HTML content
$pdf->writeHTML($html, true, 0, true, 0); $pdf->writeHTML($html, true, 0, true, 0);
@ -90,6 +90,6 @@ $pdf->lastPage();
$pdf->Output('example_021.pdf', 'I'); $pdf->Output('example_021.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_022.php // File name : example_022.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2010-04-05 // Last Update : 2010-05-20
// //
// Description : Example 022 for TCPDF class // Description : Example 022 for TCPDF class
// CMYK colors // CMYK colors
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 022', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -69,61 +69,75 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// check also the following methods:
// SetDrawColorArray()
// SetFillColorArray()
// SetTextColorArray()
// set font // set font
$pdf->SetFont('helvetica', "B", 12); $pdf->SetFont('helvetica', 'B', 18);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->SetLineWidth(1); $pdf->Write(0, 'Example of CMYK, RGB and Grayscale colours', '', 0, 'L', true, 0, false, false, 0);
// define style for border
$border_style = array('all' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'phase' => 0));
// --- CMYK ------------------------------------------------
$pdf->SetDrawColor(50, 0, 0, 0); $pdf->SetDrawColor(50, 0, 0, 0);
$pdf->SetFillColor(100, 0, 0, 0); $pdf->SetFillColor(100, 0, 0, 0);
$pdf->SetTextColor(100, 0, 0, 0); $pdf->SetTextColor(100, 0, 0, 0);
$pdf->Rect(30, 60, 20, 20, 'DF'); $pdf->Rect(30, 60, 30, 30, 'DF', $border_style);
$pdf->Text(30, 82, 'Cyan'); $pdf->Text(30, 92, 'Cyan');
$pdf->SetDrawColor(0, 50, 0, 0); $pdf->SetDrawColor(0, 50, 0, 0);
$pdf->SetFillColor(0, 100, 0, 0); $pdf->SetFillColor(0, 100, 0, 0);
$pdf->SetTextColor(0, 100, 0, 0); $pdf->SetTextColor(0, 100, 0, 0);
$pdf->Rect(60, 60, 20, 20, 'DF'); $pdf->Rect(70, 60, 30, 30, 'DF', $border_style);
$pdf->Text(60, 82, 'Magenta'); $pdf->Text(70, 92, 'Magenta');
$pdf->SetDrawColor(0, 0, 50, 0); $pdf->SetDrawColor(0, 0, 50, 0);
$pdf->SetFillColor(0, 0, 100, 0); $pdf->SetFillColor(0, 0, 100, 0);
$pdf->SetTextColor(0, 0, 100, 0); $pdf->SetTextColor(0, 0, 100, 0);
$pdf->Rect(90, 60, 20, 20, 'DF'); $pdf->Rect(110, 60, 30, 30, 'DF', $border_style);
$pdf->Text(90, 82, 'Yellow'); $pdf->Text(110, 92, 'Yellow');
$pdf->SetDrawColor(0, 0, 0, 50); $pdf->SetDrawColor(0, 0, 0, 50);
$pdf->SetFillColor(0, 0, 0, 100); $pdf->SetFillColor(0, 0, 0, 100);
$pdf->SetTextColor(0, 0, 0, 100); $pdf->SetTextColor(0, 0, 0, 100);
$pdf->Rect(120, 60, 20, 20, 'DF'); $pdf->Rect(150, 60, 30, 30, 'DF', $border_style);
$pdf->Text(120, 82, 'Black'); $pdf->Text(150, 92, 'Black');
$pdf->SetDrawColor(128, 0, 0); // --- RGB -------------------------------------------------
$pdf->SetDrawColor(255, 127, 127);
$pdf->SetFillColor(255, 0, 0); $pdf->SetFillColor(255, 0, 0);
$pdf->SetTextColor(255, 0, 0); $pdf->SetTextColor(255, 0, 0);
$pdf->Rect(30, 100, 20, 20, 'DF'); $pdf->Rect(30, 110, 30, 30, 'DF', $border_style);
$pdf->Text(30, 122, 'Red'); $pdf->Text(30, 142, 'Red');
$pdf->SetDrawColor(0, 127, 0); $pdf->SetDrawColor(127, 255, 127);
$pdf->SetFillColor(0, 255, 0); $pdf->SetFillColor(0, 255, 0);
$pdf->SetTextColor(0, 255, 0); $pdf->SetTextColor(0, 255, 0);
$pdf->Rect(60, 100, 20, 20, 'DF'); $pdf->Rect(70, 110, 30, 30, 'DF', $border_style);
$pdf->Text(60, 122, 'Green'); $pdf->Text(70, 142, 'Green');
$pdf->SetDrawColor(0, 0, 127); $pdf->SetDrawColor(127, 127, 255);
$pdf->SetFillColor(0, 0, 255); $pdf->SetFillColor(0, 0, 255);
$pdf->SetTextColor(0, 0, 255); $pdf->SetTextColor(0, 0, 255);
$pdf->Rect(90, 100, 20, 20, 'DF'); $pdf->Rect(110, 110, 30, 30, 'DF', $border_style);
$pdf->Text(90, 122, 'Blue'); $pdf->Text(110, 142, 'Blue');
$pdf->SetDrawColor(50); // --- GRAY ------------------------------------------------
$pdf->SetFillColor(128);
$pdf->SetTextColor(128); $pdf->SetDrawColor(191);
$pdf->Rect(30, 140, 20, 20, 'DF'); $pdf->SetFillColor(127);
$pdf->Text(30, 162, 'Gray'); $pdf->SetTextColor(127);
$pdf->Rect(30, 160, 30, 30, 'DF', $border_style);
$pdf->Text(30, 192, 'Gray');
// --------------------------------------------------------- // ---------------------------------------------------------

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_023.php // File name : example_023.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 023 for TCPDF class // Description : Example 023 for TCPDF class
// Page Groups // Page Groups
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 023', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,32 +62,49 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('times', 'BI', 12); $pdf->SetFont('times', 'BI', 14);
// Start First Page Group // Start First Page Group
$pdf->startPageGroup(); $pdf->startPageGroup();
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'Start of group 1', 0, 1, 'L');
// set some text to print
$txt = <<<EOD
Example of page groups.
Check the page numbers on the page footer.
This is the first page of group 1.
EOD;
// print a block of text using Write()
$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
// add second page
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'This is the second page of group 1', 0, 1, 'L');
// Start Second Page Group // Start Second Page Group
$pdf->startPageGroup(); $pdf->startPageGroup();
// add some pages
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'Start of group 2', 0, 1, 'L'); $pdf->Cell(0, 10, 'This is the first page of group 2', 0, 1, 'L');
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'This is the second page of group 2', 0, 1, 'L');
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'This is the third page of group 2', 0, 1, 'L');
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'This is the fourth page of group 2', 0, 1, 'L');
// --------------------------------------------------------- // ---------------------------------------------------------
@ -95,6 +112,6 @@ $pdf->AddPage();
$pdf->Output('example_023.pdf', 'I'); $pdf->Output('example_023.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_024.php // File name : example_024.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 024 for TCPDF class // Description : Example 024 for TCPDF class
// Object Visibility // Object Visibility
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 024', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,33 +62,51 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('times', '', 40); $pdf->SetFont('times', '', 18);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
/* /*
* setVisibility() allows to restrict the rendering of some * setVisibility() allows to restrict the rendering of some
* elements to screen or printout. This can be useful, for * elements to screen or printout. This can be useful, for
* instance, to put a background image or color that will * instance, to put a background image or color that will
* show on screen but won't print. * show on screen but won't print.
*/ */
$txt = 'You can limit the visibility of PDF objects to screen or printer by using the setVisibility() method.
Check the print preview of this document to display the alternative text.';
$pdf->Write(0, $txt, '', 0, '', true, 0, false, false, 0);
// change font size
$pdf->SetFontSize(40);
// change text color
$pdf->SetTextColor(0,63,127);
// set visibility only for screen // set visibility only for screen
$pdf->setVisibility('screen'); $pdf->setVisibility('screen');
$pdf->Write(6, "This line is for display.\n");
// write something only for screen
$pdf->Write(0, '[This line is for display]', '', 0, 'C', true, 0, false, false, 0);
// set visibility only for print // set visibility only for print
$pdf->setVisibility('print'); $pdf->setVisibility('print');
$pdf->Write(6, "This line is for printout.\n");
// change text color
$pdf->SetTextColor(127,0,0);
// write something only for print
$pdf->Write(0, '[This line is for printout]', '', 0, 'C', true, 0, false, false, 0);
// restore visibility // restore visibility
$pdf->setVisibility('all'); $pdf->setVisibility('all');
@ -99,6 +117,6 @@ $pdf->setVisibility('all');
$pdf->Output('example_024.pdf', 'I'); $pdf->Output('example_024.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_025.php // File name : example_025.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2010-04-05 // Last Update : 2010-05-20
// //
// Description : Example 025 for TCPDF class // Description : Example 025 for TCPDF class
// Object Transparency // Object Transparency
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 025', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -70,11 +70,14 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', 'BI', 8); $pdf->SetFont('helvetica', '', 12);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$txt = 'You can set the transparency of PDF objects using the setAlpha() method.';
$pdf->Write(0, $txt, '', 0, '', true, 0, false, false, 0);
/* /*
* setAlpha() gives transparency support. You can set the * setAlpha() gives transparency support. You can set the
* alpha channel from 0 (fully transparent) to 1 (fully * alpha channel from 0 (fully transparent) to 1 (fully
@ -82,28 +85,32 @@ $pdf->AddPage();
* images). * images).
*/ */
$pdf->SetLineWidth(1.5); $pdf->SetLineWidth(2);
// draw opaque red square // draw opaque red square
$pdf->SetFillColor(255, 0, 0); $pdf->SetFillColor(255, 0, 0);
$pdf->Rect(30, 60, 40, 40, 'DF'); $pdf->SetDrawColor(127, 0, 0);
$pdf->Rect(30, 40, 60, 60, 'DF');
// set alpha to semi-transparency // set alpha to semi-transparency
$pdf->SetAlpha(0.5); $pdf->SetAlpha(0.5);
// draw green square // draw green square
$pdf->SetFillColor(0, 255, 0); $pdf->SetFillColor(0, 255, 0);
$pdf->Rect(40, 70, 40, 40, 'DF'); $pdf->SetDrawColor(0, 127, 0);
$pdf->Rect(50, 60, 60, 60, 'DF');
// draw blue square
$pdf->SetFillColor(0, 0, 255);
$pdf->SetDrawColor(0, 0, 127);
$pdf->Rect(70, 80, 60, 60, 'DF');
// draw jpeg image // draw jpeg image
$pdf->Image('../images/image_demo.jpg', 50, 80, 40, 40, '', 'http://www.tcpdf.org', '', true, 72); $pdf->Image('../images/image_demo.jpg', 90, 100, 60, 60, '', 'http://www.tcpdf.org', '', true, 72);
// restore full opacity // restore full opacity
$pdf->SetAlpha(1); $pdf->SetAlpha(1);
// print name
$pdf->Text(55, 82, 'TRANSPARENCY');
// --------------------------------------------------------- // ---------------------------------------------------------
//Close and output PDF document //Close and output PDF document

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_026.php // File name : example_026.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2010-04-03 // Last Update : 2010-05-20
// //
// Description : Example 026 for TCPDF class // Description : Example 026 for TCPDF class
// Text Rendering Modes and Text Clipping // Text Rendering Modes and Text Clipping
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 026', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_027.php // File name : example_027.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2010-05-02 // Last Update : 2010-05-20
// //
// Description : Example 027 for TCPDF class // Description : Example 027 for TCPDF class
// 1D Barcodes // 1D Barcodes
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 027', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -312,7 +312,7 @@ $style = array(
// CODE 39 EXTENDED + CHECKSUM // CODE 39 EXTENDED + CHECKSUM
$pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1); $pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1);
$pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', 80, 15, 0.4, $style, 'N'); $pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', 100, 15, 0.4, $style, 'N');
// --------------------------------------------------------- // ---------------------------------------------------------

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_028.php // File name : example_028.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 028 for TCPDF class // Description : Example 028 for TCPDF class
// Changing page formats // Changing page formats
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -57,10 +57,10 @@ $pdf->SetMargins(10, PDF_MARGIN_TOP, 10);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -137,6 +137,6 @@ $pdf->lastPage();
$pdf->Output('example_028.pdf', 'I'); $pdf->Output('example_028.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_029.php // File name : example_029.php
// Begin : 2008-06-09 // Begin : 2008-06-09
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 029 for TCPDF class // Description : Example 029 for TCPDF class
// Set PDF viewer display preferences. // Set PDF viewer display preferences.
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 029', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,13 +62,14 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set array for viewer preferences
$preferences = array( $preferences = array(
'HideToolbar' => true, 'HideToolbar' => true,
'HideMenubar' => true, 'HideMenubar' => true,
@ -88,6 +89,8 @@ $preferences = array(
'NumCopies' => 2 'NumCopies' => 2
); );
// Check the example n. 60 for advanced page settings
// set pdf viewer preferences // set pdf viewer preferences
$pdf->setViewerPreferences($preferences); $pdf->setViewerPreferences($preferences);
@ -96,8 +99,13 @@ $pdf->SetFont('times', '', 14);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// print a line // print a line
$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 1', 0, 0, 'C'); $pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 1', 1, 1, 'C');
$pdf->Ln(5);
$pdf->Write(0, 'You can use the setViewerPreferences() method to change viewer preferences.', '', 0, 'L', true, 0, false, false, 0);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
@ -115,6 +123,6 @@ $pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 3', 0, 0, 'C');
$pdf->Output('example_029.pdf', 'I'); $pdf->Output('example_029.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_030.php // File name : example_030.php
// Begin : 2008-06-09 // Begin : 2008-06-09
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 030 for TCPDF class // Description : Example 030 for TCPDF class
// Colour gradients // Colour gradients
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -43,36 +43,43 @@ $pdf->SetTitle('TCPDF Example 030');
$pdf->SetSubject('TCPDF Tutorial'); $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// disable header and footer // set default header data
$pdf->setPrintHeader(false); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 030', PDF_HEADER_STRING);
$pdf->setPrintFooter(false);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font // set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins //set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks //set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', '', 14); $pdf->SetFont('helvetica', 'B', 20);
// --- first page ------------------------------------------
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
//first page $pdf->Cell(0, 0, 'TCPDF Gradients', 0, 1, 'C', 0, '', 0, false, 'T', 'M');
//set colors for gradients (r,g,b) or (grey 0-255) // set colors for gradients (r,g,b) or (grey 0-255)
$red = array(255, 0, 0); $red = array(255, 0, 0);
$blue = array(0, 0, 200); $blue = array(0, 0, 200);
$yellow = array(255, 255, 0); $yellow = array(255, 255, 0);
@ -80,22 +87,31 @@ $green = array(0, 255, 0);
$white = array(255); $white = array(255);
$black = array(0); $black = array(0);
//set the coordinates x1,y1,x2,y2 of the gradient (see linear_gradient_coords.jpg) // set the coordinates x1,y1,x2,y2 of the gradient (see linear_gradient_coords.jpg)
$coords = array(0, 0, 1, 0); $coords = array(0, 0, 1, 0);
//paint a linear gradient // paint a linear gradient
$pdf->LinearGradient(20, 25, 80, 80, $red, $blue, $coords); $pdf->LinearGradient(20, 45, 80, 80, $red, $blue, $coords);
//set the coordinates fx,fy,cx,cy,r of the gradient (see radial_gradient_coords.jpg) // write label
$pdf->Text(20, 130, 'LinearGradient()');
// set the coordinates fx,fy,cx,cy,r of the gradient (see radial_gradient_coords.jpg)
$coords = array(0.5, 0.5, 1, 1, 1.2); $coords = array(0.5, 0.5, 1, 1, 1.2);
//paint a radial gradient // paint a radial gradient
$pdf->RadialGradient(110, 25, 80, 80, $white, $black, $coords); $pdf->RadialGradient(110, 45, 80, 80, $white, $black, $coords);
//paint a coons patch mesh with default coordinates // write label
$pdf->CoonsPatchMesh(20, 115, 80, 80, $yellow, $blue, $green, $red); $pdf->Text(110, 130, 'RadialGradient()');
//set the coordinates for the cubic Bézier points x1,y1 ... x12, y12 of the patch (see coons_patch_mesh_coords.jpg) // paint a coons patch mesh with default coordinates
$pdf->CoonsPatchMesh(20, 155, 80, 80, $yellow, $blue, $green, $red);
// write label
$pdf->Text(20, 240, 'CoonsPatchMesh()');
// set the coordinates for the cubic Bézier points x1,y1 ... x12, y12 of the patch (see coons_patch_mesh_coords.jpg)
$coords = array( $coords = array(
0.00,0.00, 0.33,0.20, //lower left 0.00,0.00, 0.33,0.20, //lower left
0.67,0.00, 1.00,0.00, 0.80,0.33, //lower right 0.67,0.00, 1.00,0.00, 0.80,0.33, //lower right
@ -105,13 +121,16 @@ $coords = array(
$coords_min = 0; //minimum value of the coordinates $coords_min = 0; //minimum value of the coordinates
$coords_max = 1; //maximum value of the coordinates $coords_max = 1; //maximum value of the coordinates
//paint a coons patch gradient with the above coordinates // paint a coons patch gradient with the above coordinates
$pdf->CoonsPatchMesh(110, 115, 80, 80, $yellow, $blue, $green, $red, $coords, $coords_min, $coords_max); $pdf->CoonsPatchMesh(110, 155, 80, 80, $yellow, $blue, $green, $red, $coords, $coords_min, $coords_max);
//second page // write label
$pdf->Text(110, 240, 'CoonsPatchMesh()');
// --- second page -----------------------------------------
$pdf->AddPage(); $pdf->AddPage();
//first patch: f = 0 // first patch: f = 0
$patch_array[0]['f'] = 0; $patch_array[0]['f'] = 0;
$patch_array[0]['points'] = array( $patch_array[0]['points'] = array(
0.00,0.00, 0.33,0.00, 0.00,0.00, 0.33,0.00,
@ -124,7 +143,7 @@ $patch_array[0]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 255);
$patch_array[0]['colors'][2] = array('r' => 0, 'g' => 255,'b' => 0); $patch_array[0]['colors'][2] = array('r' => 0, 'g' => 255,'b' => 0);
$patch_array[0]['colors'][3] = array('r' => 255, 'g' => 0,'b' => 0); $patch_array[0]['colors'][3] = array('r' => 255, 'g' => 0,'b' => 0);
//second patch - above the other: f = 2 // second patch - above the other: f = 2
$patch_array[1]['f'] = 2; $patch_array[1]['f'] = 2;
$patch_array[1]['points'] = array( $patch_array[1]['points'] = array(
0.00,1.33, 0.00,1.33,
@ -134,7 +153,7 @@ $patch_array[1]['points'] = array(
$patch_array[1]['colors'][0]=array('r' => 0, 'g' => 0, 'b' => 0); $patch_array[1]['colors'][0]=array('r' => 0, 'g' => 0, 'b' => 0);
$patch_array[1]['colors'][1]=array('r' => 255, 'g' => 0, 'b' => 255); $patch_array[1]['colors'][1]=array('r' => 255, 'g' => 0, 'b' => 255);
//third patch - right of the above: f = 3 // third patch - right of the above: f = 3
$patch_array[2]['f'] = 3; $patch_array[2]['f'] = 3;
$patch_array[2]['points'] = array( $patch_array[2]['points'] = array(
1.33,0.80, 1.33,0.80,
@ -144,7 +163,7 @@ $patch_array[2]['points'] = array(
$patch_array[2]['colors'][0] = array('r' => 0, 'g' => 255, 'b' => 255); $patch_array[2]['colors'][0] = array('r' => 0, 'g' => 255, 'b' => 255);
$patch_array[2]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 0); $patch_array[2]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 0);
//fourth patch - below the above, which means left(?) of the above: f = 1 // fourth patch - below the above, which means left(?) of the above: f = 1
$patch_array[3]['f'] = 1; $patch_array[3]['f'] = 1;
$patch_array[3]['points'] = array( $patch_array[3]['points'] = array(
2.00,0.67, 2.00,0.67,
@ -157,7 +176,10 @@ $patch_array[3]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 255);
$coords_min = 0; $coords_min = 0;
$coords_max = 2; $coords_max = 2;
$pdf->CoonsPatchMesh(10, 25, 190, 200, '', '', '', '', $patch_array, $coords_min, $coords_max); $pdf->CoonsPatchMesh(10, 45, 190, 200, '', '', '', '', $patch_array, $coords_min, $coords_max);
// write label
$pdf->Text(10, 250, 'CoonsPatchMesh()');
// --------------------------------------------------------- // ---------------------------------------------------------
@ -165,6 +187,6 @@ $pdf->CoonsPatchMesh(10, 25, 190, 200, '', '', '', '', $patch_array, $coords_min
$pdf->Output('example_030.pdf', 'I'); $pdf->Output('example_030.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_031.php // File name : example_031.php
// Begin : 2008-06-09 // Begin : 2008-06-09
// Last Update : 2010-05-04 // Last Update : 2010-05-20
// //
// Description : Example 031 for TCPDF class // Description : Example 031 for TCPDF class
// Pie Chart // Pie Chart
@ -43,15 +43,20 @@ $pdf->SetTitle('TCPDF Example 031');
$pdf->SetSubject('TCPDF Tutorial'); $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// disable header and footer // set default header data
$pdf->setPrintHeader(false); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 031', PDF_HEADER_STRING);
$pdf->setPrintFooter(false);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font // set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins //set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks //set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
@ -65,22 +70,32 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', '', 14); $pdf->SetFont('helvetica', 'B', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$xc = 105; $pdf->Write(0, 'Example of PieSector() method.');
$yc = 55;
$r = 40;
$pdf->SetFillColor(120, 120, 255); $xc = 105;
$yc = 100;
$r = 50;
$pdf->SetFillColor(0, 0, 255);
$pdf->PieSector($xc, $yc, $r, 20, 120, 'FD', false, 0, 2); $pdf->PieSector($xc, $yc, $r, 20, 120, 'FD', false, 0, 2);
$pdf->SetFillColor(120, 255, 120);
$pdf->SetFillColor(0, 255, 0);
$pdf->PieSector($xc, $yc, $r, 120, 250, 'FD', false, 0, 2); $pdf->PieSector($xc, $yc, $r, 120, 250, 'FD', false, 0, 2);
$pdf->SetFillColor(255, 120, 120);
$pdf->SetFillColor(255, 0, 0);
$pdf->PieSector($xc, $yc, $r, 250, 20, 'FD', false, 0, 2); $pdf->PieSector($xc, $yc, $r, 250, 20, 'FD', false, 0, 2);
// write labels
$pdf->SetTextColor(255,255,255);
$pdf->Text(105, 65, 'BLUE');
$pdf->Text(60, 95, 'GREEN');
$pdf->Text(120, 115, 'RED');
// --------------------------------------------------------- // ---------------------------------------------------------
//Close and output PDF document //Close and output PDF document

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_032.php // File name : example_032.php
// Begin : 2008-06-09 // Begin : 2008-06-09
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 032 for TCPDF class // Description : Example 032 for TCPDF class
// EPS/AI image // EPS/AI image
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -43,40 +43,47 @@ $pdf->SetTitle('TCPDF Example 032');
$pdf->SetSubject('TCPDF Tutorial'); $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// disable header and footer // set default header data
$pdf->setPrintHeader(false); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 032', PDF_HEADER_STRING);
$pdf->setPrintFooter(false);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font // set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins //set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks //set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', '', 14); $pdf->SetFont('helvetica', '', 12);
// Page 1: AI
$pdf->AddPage(); $pdf->AddPage();
$pdf->ImageEps('../images/tiger.ai', 10, 50, 190);
// Page 2: EPS, with link $pdf->Write(0, 'Example of ImageEPS() method for AI and EPS images');
$pdf->ImageEps($file='../images/tiger.ai', $x=10, $y=50, $w=190, $h=190, $link='', $useBoundingBox=true, $align='', $palign='', $border=0, $fitonpage=false);
$pdf->AddPage(); $pdf->AddPage();
$pdf->ImageEps('../images/bug.eps', 0, 25, 0, 240, "http://www.tcpdf.org", true, 'T', 'C'); $pdf->ImageEps('../images/bug.eps', 0, 25, 0, 240, "http://www.tcpdf.org", true, 'T', 'C');
// Page 3: AI
$pdf->AddPage(); $pdf->AddPage();
$pdf->ImageEps('../images/pelican.ai', 15, 70, 180); $pdf->ImageEps('../images/pelican.ai', 15, 70, 180);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -85,6 +92,6 @@ $pdf->ImageEps('../images/pelican.ai', 15, 70, 180);
$pdf->Output('example_032.pdf', 'I'); $pdf->Output('example_032.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_033.php // File name : example_033.php
// Begin : 2008-06-24 // Begin : 2008-06-24
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 033 for TCPDF class // Description : Example 033 for TCPDF class
// Mixed font types // Mixed font types
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 033', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,27 +62,36 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->SetFont('dejavusans', '', 10); $pdf->SetFont('helvetica', 'B', 20);
$pdf->MultiCell(80, 0, "[True Type Unicode font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0);
$pdf->Ln(2); $pdf->Write(0, 'Font Types', '', 0, 'C', 1, 0, false, false, 0);
$pdf->Ln(10);
$pdf->SetFont('times', '', 10); $pdf->SetFont('times', '', 10);
$pdf->MultiCell(80, 0, "[Core font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0); $pdf->MultiCell(80, 0, "[Core font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0);
$pdf->Ln(2); $pdf->Ln(2);
$pdf->SetFont('dejavusans', '', 10);
$pdf->MultiCell(80, 0, "[True Type Unicode font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0);
$pdf->Ln(2);
$pdf->SetFont('arialunicid0', '', 9); $pdf->SetFont('arialunicid0', '', 9);
$pdf->MultiCell(80, 0, "[CID-0 font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0); $pdf->MultiCell(80, 0, "[CID-0 font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0);
@ -92,6 +101,6 @@ $pdf->MultiCell(80, 0, "[CID-0 font] : Cras eros leo, porttitor porta, accumsan
$pdf->Output('example_033.pdf', 'I'); $pdf->Output('example_033.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_034.php // File name : example_034.php
// Begin : 2008-07-18 // Begin : 2008-07-18
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 034 for TCPDF class // Description : Example 034 for TCPDF class
// Clipping // Clipping
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 034', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,27 +62,29 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', 'BI', 50); $pdf->SetFont('helvetica', 'B', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->Write(0, 'Image Clipping using geometric functions', '', 0, 'C', 1, 0, false, false, 0);
//Start Graphic Transformation //Start Graphic Transformation
$pdf->StartTransform(); $pdf->StartTransform();
// set clipping mask // set clipping mask
$pdf->StarPolygon(50, 70, 30, 10, 3, 0, 1, 'CNZ'); $pdf->StarPolygon(105, 100, 30, 10, 3, 0, 1, 'CNZ');
// draw jpeg image to be clipped // draw jpeg image to be clipped
$pdf->Image('../images/image_demo.jpg', 20, 40, 60, 60, '', 'http://www.tcpdf.org', '', true, 72); $pdf->Image('../images/image_demo.jpg', 75, 70, 60, 60, '', 'http://www.tcpdf.org', '', true, 72);
//Stop Graphic Transformation //Stop Graphic Transformation
$pdf->StopTransform(); $pdf->StopTransform();
@ -93,6 +95,6 @@ $pdf->StopTransform();
$pdf->Output('example_034.pdf', 'I'); $pdf->Output('example_034.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_035.php // File name : example_035.php
// Begin : 2008-07-22 // Begin : 2008-07-22
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 035 for TCPDF class // Description : Example 035 for TCPDF class
// Line styles with cells and multicells // Line styles with cells and multicells
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 035', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -75,8 +75,7 @@ $pdf->SetFont('times', 'BI', 16);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// print a line using Cell() $pdf->Write(0, 'Example of SetLineStyle() method', '', 0, 'L', true, 0, false, false, 0);
$pdf->Cell(0, 12, 'Example 035', 1, 1, 'C');
$pdf->Ln(); $pdf->Ln();
@ -111,6 +110,6 @@ $pdf->MultiCell(60, 4, $text, 1, 'C', 1, 1);
$pdf->Output('example_035.pdf', 'I'); $pdf->Output('example_035.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_036.php // File name : example_036.php
// Begin : 2008-08-08 // Begin : 2008-08-08
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 036 for TCPDF class // Description : Example 036 for TCPDF class
// Annotations // Annotations
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 036', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -75,11 +75,12 @@ $pdf->SetFont('times', '', 16);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// print a line using Cell() $txt = 'Example of Text Annotation.
$pdf->Cell(0, 12, 'Example 036', 1, 1, 'C'); Move your mouse over the yellow box or double click on it to display the annotation text.';
$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
// text annotation // text annotation
$pdf->Annotation(124, 30, 10, 10, "Text annotation example\naccented letters test: àèéìòù", array('Subtype'=>'Text', 'Name' => 'Comment', 'T' => 'title example', 'Subj' => 'example', 'C' => array(255, 255, 0))); $pdf->Annotation(83, 27, 10, 10, "Text annotation example\naccented letters test: àèéìòù", array('Subtype'=>'Text', 'Name' => 'Comment', 'T' => 'title example', 'Subj' => 'example', 'C' => array(255, 255, 0)));
// --------------------------------------------------------- // ---------------------------------------------------------
@ -87,6 +88,6 @@ $pdf->Annotation(124, 30, 10, 10, "Text annotation example\naccented letters tes
$pdf->Output('example_036.pdf', 'I'); $pdf->Output('example_036.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_037.php // File name : example_037.php
// Begin : 2008-09-12 // Begin : 2008-09-12
// Last Update : 2010-04-05 // Last Update : 2010-05-20
// //
// Description : Example 037 for TCPDF class // Description : Example 037 for TCPDF class
// Spot colors // Spot colors
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 037', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -70,13 +70,21 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', '', 8); $pdf->SetFont('helvetica', '', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->Write(0, 'Example of Spot Colors', '', 0, 'L', true, 0, false, false, 0);
$pdf->Ln(5);
$pdf->SetFont('helvetica', '', 8);
// Define some new spot colors // Define some new spot colors
// where c, m, y and k (2nd, 3rd, 4th and 5th parameter) are the equivalent CMYK components. // $c, $m, $y and $k (2nd, 3rd, 4th and 5th parameter) are the CMYK color components.
// AddSpotColor($name, $c, $m, $y, $k)
$pdf->AddSpotColor('Pantone 116 C', 0, 20, 100, 0); $pdf->AddSpotColor('Pantone 116 C', 0, 20, 100, 0);
$pdf->AddSpotColor('HKS 16 K', 30, 100, 90, 10); $pdf->AddSpotColor('HKS 16 K', 30, 100, 90, 10);
$pdf->AddSpotColor('Pantone 505 C', 57, 100, 85, 55); $pdf->AddSpotColor('Pantone 505 C', 57, 100, 85, 55);
@ -93,12 +101,16 @@ $pdf->AddSpotColor('NovaSpace-Black', 50, 0, 0, 100);
$pdf->AddSpotColor('Pantone 601 C', 0, 0, 55, 0); $pdf->AddSpotColor('Pantone 601 C', 0, 0, 55, 0);
$pdf->AddSpotColor('Pantone 659 C', 50, 20, 0, 10); $pdf->AddSpotColor('Pantone 659 C', 50, 20, 0, 10);
// select the spot color // Select the spot color
// where tint (the second parameter) is the intensity of the color (full intensity by default). // $tint (the second parameter) is the intensity of the color (0-100).
// SetTextSpotColor($name, $tint=100)
// SetDrawSpotColor($name, $tint=100)
// SetFillSpotColor($name, $tint=100)
$pdf->SetTextSpotColor('NovaSpace-Black', 100); $pdf->SetTextSpotColor('NovaSpace-Black', 100);
$pdf->SetDrawSpotColor('NovaSpace-Black', 100); $pdf->SetDrawSpotColor('NovaSpace-Black', 100);
$starty = 30; $starty = 50;
// print some spot colors // print some spot colors
$pdf->SetFillSpotColor('Pantone 116 C', 100); $pdf->SetFillSpotColor('Pantone 116 C', 100);

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_038.php // File name : example_038.php
// Begin : 2008-09-15 // Begin : 2008-09-15
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 038 for TCPDF class // Description : Example 038 for TCPDF class
// CID-0 CJK Fonts without embedding // CID-0 CJK unembedded font
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -22,7 +22,7 @@
/** /**
* Creates an example PDF TEST document using TCPDF * Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @abstract TCPDF - Example: CID-0 CJK Fonts without embedding * @abstract TCPDF - Example: CID-0 CJK unembedded font
* @author Nicola Asuni * @author Nicola Asuni
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com * @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @link http://tcpdf.org * @link http://tcpdf.org
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 038', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,21 +62,23 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('arialunicid0', 'U', 20); $pdf->SetFont('arialunicid0', '', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// print a line using Cell() $txt = 'Example of CID-0 CJK unembedded font.
$pdf->Cell(0, 10, 'こんにちは世界', 1, 1, 'C'); To display extended text you must have CJK fonts for your PDF reader: こんにちは世界';
$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -84,6 +86,6 @@ $pdf->Cell(0, 10, 'こんにちは世界', 1, 1, 'C');
$pdf->Output('example_038.pdf', 'I'); $pdf->Output('example_038.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_039.php // File name : example_039.php
// Begin : 2008-10-16 // Begin : 2008-10-16
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 039 for TCPDF class // Description : Example 039 for TCPDF class
// HTML justification // HTML justification
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 039', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,28 +62,33 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// add a page
$pdf->AddPage();
// set font
$pdf->SetFont('helvetica', 'B', 20);
$pdf->Write(0, 'Example of HTML Justification', '', 0, 'L', true, 0, false, false, 0);
// create some HTML content // create some HTML content
$html = '<span style="text-align:justify;">a <u>abc</u> abcdefghijkl abcdef abcdefg <b>abcdefghi</b> a abc abcd <img src="../images/logo_example.png" border="0" height="41" width="41" /> <img src="../images/tiger.ai" alt="test alt attribute" width="100" height="100" border="0" /> abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a <u>abc</u> abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg abcdefghi a abc abcd <a href="http://tcpdf.org">abcdef abcdefg</a> start a abc before <span style="background-color:yellow">yellow color</span> after a abc abcd abcdef abcdefg abcdefghi a abc abcd end abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi<br />abcd abcdef abcdefg abcdefghi<br />abcd abcde abcdef</span>'; $html = '<span style="text-align:justify;">a <u>abc</u> abcdefghijkl abcdef abcdefg <b>abcdefghi</b> a abc abcd <img src="../images/logo_example.png" border="0" height="41" width="41" /> <img src="../images/tiger.ai" alt="test alt attribute" width="100" height="100" border="0" /> abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a <u>abc</u> abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg <b>abcdefghi</b> a abc abcd abcdef abcdefg abcdefghi a abc abcd <a href="http://tcpdf.org">abcdef abcdefg</a> start a abc before <span style="background-color:yellow">yellow color</span> after a abc abcd abcdef abcdefg abcdefghi a abc abcd end abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi<br />abcd abcdef abcdefg abcdefghi<br />abcd abcde abcdef</span>';
// set core font // set core font
$pdf->SetFont('helvetica', '', 10); $pdf->SetFont('helvetica', '', 10);
// add a page
$pdf->AddPage();
// output the HTML content // output the HTML content
$pdf->writeHTML($html, true, 0, true, true); $pdf->writeHTML($html, true, 0, true, true);
$pdf->Ln(); $pdf->Ln();
// set UTF-8 font // set UTF-8 Unicode font
$pdf->SetFont('dejavusans', '', 10); $pdf->SetFont('dejavusans', '', 10);
// output the HTML content // output the HTML content
@ -98,6 +103,6 @@ $pdf->lastPage();
$pdf->Output('example_039.pdf', 'I'); $pdf->Output('example_039.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_040.php // File name : example_040.php
// Begin : 2008-10-28 // Begin : 2008-10-28
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 040 for TCPDF class // Description : Example 040 for TCPDF class
// Booklet mode (double-sided pages) // Booklet mode (double-sided pages)
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 040', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,13 +62,19 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set display mode
$pdf->SetDisplayMode($zoom='fullpage', $layout='TwoColumnRight', $mode='UseNone');
// set pdf viewer preferences
$pdf->setViewerPreferences(array('Duplex' => 'DuplexFlipLongEdge'));
// set booklet mode // set booklet mode
$pdf->SetBooklet(true, 10, 30); $pdf->SetBooklet(true, 10, 30);
@ -78,9 +84,12 @@ $pdf->SetFont('helvetica', '', 18);
// add a page (left page) // add a page (left page)
$pdf->AddPage(); $pdf->AddPage();
$pdf->Write(0, 'Example of booklet mode', '', 0, 'L', true, 0, false, false, 0);
// print a line using Cell() // print a line using Cell()
$pdf->Cell(0, 0, 'LEFT PAGE 1', 1, 1, 'C'); $pdf->Cell(0, 0, 'LEFT PAGE 1', 1, 1, 'C');
// add a page (right page) // add a page (right page)
$pdf->AddPage(); $pdf->AddPage();
@ -106,6 +115,6 @@ $pdf->Cell(0, 0, 'RIGHT PAGE 4', 1, 1, 'C');
$pdf->Output('example_040.pdf', 'I'); $pdf->Output('example_040.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_041.php // File name : example_041.php
// Begin : 2008-12-07 // Begin : 2008-12-07
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 041 for TCPDF class // Description : Example 041 for TCPDF class
// Annotation - FileAttachment // Annotation - FileAttachment
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 041', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -75,11 +75,13 @@ $pdf->SetFont('times', '', 16);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// print a line using Cell()
$pdf->Cell(0, 12, 'File Attachment', 1, 1, 'C'); $txt = 'Example of File Attachment.
Double click on the icon to open the attached file.';
$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
// attach an external file // attach an external file
$pdf->Annotation(78, 30, 4, 4, 'text file', array('Subtype'=>'FileAttachment', 'Name' => 'PushPin', 'FS' => '../cache/utf8test.txt')); $pdf->Annotation(85, 27, 5, 5, 'text file', array('Subtype'=>'FileAttachment', 'Name' => 'PushPin', 'FS' => '../cache/utf8test.txt'));
// --------------------------------------------------------- // ---------------------------------------------------------
@ -87,6 +89,6 @@ $pdf->Annotation(78, 30, 4, 4, 'text file', array('Subtype'=>'FileAttachment', '
$pdf->Output('example_041.pdf', 'I'); $pdf->Output('example_041.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_042.php // File name : example_042.php
// Begin : 2008-12-23 // Begin : 2008-12-23
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 042 for TCPDF class // Description : Example 042 for TCPDF class
// Test Image with alpha channel // Test Image with alpha channel
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 042', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -81,16 +81,17 @@ $pdf->AddPage();
$background_text = str_repeat('TCPDF test PNG Alpha Channel ', 50); $background_text = str_repeat('TCPDF test PNG Alpha Channel ', 50);
$pdf->MultiCell(0, 5, $background_text, 0, 'J', 0, 2, '', '', true, 0, false); $pdf->MultiCell(0, 5, $background_text, 0, 'J', 0, 2, '', '', true, 0, false);
// --- Method (A) ------------------------------------------
// [A] The Image() method recognizes the alpha channel embedded on the image: // the Image() method recognizes the alpha channel embedded on the image:
$pdf->Image('../images/image_with_alpha.png', 50, 50, 100, '', '', 'http://www.tcpdf.org', '', false, 300); $pdf->Image('../images/image_with_alpha.png', 50, 50, 100, '', '', 'http://www.tcpdf.org', '', false, 300);
// --- Method (B) ------------------------------------------
// [B] provide image + separate 8-bit mask // provide image + separate 8-bit mask
// first embed mask image (w, h, x and y will be ignored, the image will be scaled to the target image's size) // first embed mask image (w, h, x and y will be ignored, the image will be scaled to the target image's size)
$mask = $pdf->Image('../images/alpha.png', 50, 140, 100, '', '', '', '', false, 300, '', true); $mask = $pdf->Image('../images/alpha.png', 50, 140, 100, '', '', '', '', false, 300, '', true);
// embed image, masked with previously embedded mask // embed image, masked with previously embedded mask
$pdf->Image('../images/img.png', 50, 140, 100, '', '', 'http://www.tcpdf.org', '', false, 300, '', false, $mask); $pdf->Image('../images/img.png', 50, 140, 100, '', '', 'http://www.tcpdf.org', '', false, 300, '', false, $mask);
@ -100,6 +101,6 @@ $pdf->Image('../images/img.png', 50, 140, 100, '', '', 'http://www.tcpdf.org', '
$pdf->Output('example_042.pdf', 'I'); $pdf->Output('example_042.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_043.php // File name : example_043.php
// Begin : 2009-01-02 // Begin : 2009-01-02
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 043 for TCPDF class // Description : Example 043 for TCPDF class
// Disk caching // Disk caching
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 043', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,21 +62,21 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('times', '', 10); $pdf->SetFont('helvetica', '', 16);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// Multicell test // Multicell test
$pdf->MultiCell(0, 0, "DISK CACHING TEST: check the parameters on class constructor.", 1, 'L', 0, 0, '', '', true); $pdf->MultiCell(0, 0, 'DISK CACHING TEST: check the parameters of the class constructor.', 1, 'L', 0, 0, '', '', true);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -84,6 +84,6 @@ $pdf->MultiCell(0, 0, "DISK CACHING TEST: check the parameters on class construc
$pdf->Output('example_043.pdf', 'I'); $pdf->Output('example_043.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_044.php // File name : example_044.php
// Begin : 2009-01-02 // Begin : 2009-01-02
// Last Update : 2010-04-20 // Last Update : 2010-05-20
// //
// Description : Example 044 for TCPDF class // Description : Example 044 for TCPDF class
// Move, copy and delete pages // Move, copy and delete pages
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 044', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -70,32 +70,42 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', '', 18); $pdf->SetFont('helvetica', 'B', 40);
// print a line using Cell() // print a line using Cell()
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE A', 0, 1, 'L'); $pdf->Cell(0, 10, 'PAGE: A', 0, 1, 'L');
// add some vertical space
$pdf->Ln(10);
// print some text
$pdf->SetFont('times', 'I', 16);
$txt = 'TCPDF allows you to Copy, Move and Delete pages.';
$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', 'B', 40);
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE B', 0, 1, 'L'); $pdf->Cell(0, 10, 'PAGE: B', 0, 1, 'L');
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE D', 0, 1, 'L'); $pdf->Cell(0, 10, 'PAGE: D', 0, 1, 'L');
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE E', 0, 1, 'L'); $pdf->Cell(0, 10, 'PAGE: E', 0, 1, 'L');
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE E-2', 0, 1, 'L'); $pdf->Cell(0, 10, 'PAGE: E-2', 0, 1, 'L');
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE F', 0, 1, 'L'); $pdf->Cell(0, 10, 'PAGE: F', 0, 1, 'L');
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE C', 0, 1, 'L'); $pdf->Cell(0, 10, 'PAGE: C', 0, 1, 'L');
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE G', 0, 1, 'L'); $pdf->Cell(0, 10, 'PAGE: G', 0, 1, 'L');
// Move page 7 to page 3 // Move page 7 to page 3
$pdf->movePage(7, 3); $pdf->movePage(7, 3);
@ -104,7 +114,7 @@ $pdf->movePage(7, 3);
$pdf->deletePage(6); $pdf->deletePage(6);
$pdf->AddPage(); $pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE H', 0, 1, 'L'); $pdf->Cell(0, 10, 'PAGE: H', 0, 1, 'L');
// copy the second page // copy the second page
$pdf->copyPage(2); $pdf->copyPage(2);

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_045.php // File name : example_045.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2010-05-06 // Last Update : 2010-05-20
// //
// Description : Example 045 for TCPDF class // Description : Example 045 for TCPDF class
// Bookmarks and Table of Content // Bookmarks and Table of Content
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 045', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -97,6 +97,7 @@ $pdf->AddPage();
$pdf->Bookmark('Paragraph 1.3', 1, 0); $pdf->Bookmark('Paragraph 1.3', 1, 0);
$pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L'); $pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L');
// add some pages and bookmarks
for ($i = 2; $i < 12; $i++) { for ($i = 2; $i < 12; $i++) {
$pdf->AddPage(); $pdf->AddPage();
$pdf->Bookmark('Chapter '.$i, 0, 0); $pdf->Bookmark('Chapter '.$i, 0, 0);
@ -115,7 +116,8 @@ $pdf->Ln();
$pdf->SetFont('dejavusans', '', 12); $pdf->SetFont('dejavusans', '', 12);
// add table of content at page 1 // add a simple Table Of Content at first page
// (check the example n. 59 for the HTML version)
$pdf->addTOC(1, 'courier', '.', 'INDEX'); $pdf->addTOC(1, 'courier', '.', 'INDEX');
// end of TOC page // end of TOC page
@ -127,6 +129,6 @@ $pdf->endTOCPage();
$pdf->Output('example_045.pdf', 'I'); $pdf->Output('example_045.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_046.php // File name : example_046.php
// Begin : 2009-02-28 // Begin : 2009-02-28
// Last Update : 2010-04-12 // Last Update : 2010-05-20
// //
// Description : Example 046 for TCPDF class // Description : Example 046 for TCPDF class
// Text Hyphenation // Text Hyphenation
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 046', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -70,11 +70,15 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('times', '', 10); $pdf->SetFont('helvetica', 'B', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->Write(0, 'Example of Text Hyphenation', '', 0, 'L', true, 0, false, false, 0);
$pdf->Ln(10);
/* /*
Unicode Data for SHY: Unicode Data for SHY:
Name : SOFT HYPHEN, commonly abbreviated as SHY Name : SOFT HYPHEN, commonly abbreviated as SHY
@ -105,6 +109,10 @@ $html = $pdf->hyphenateText($html, $hyphen_patterns, $dictionary=array(), $leftm
// HTML text with soft hyphens (&shy;) // HTML text with soft hyphens (&shy;)
$html = 'On the other hand, we de&shy;nounce with righ&shy;teous in&shy;dig&shy;na&shy;tion and dis&shy;like men who are so be&shy;guiled and de&shy;mo&shy;r&shy;al&shy;ized by the charms of plea&shy;sure of the mo&shy;ment, so blind&shy;ed by de&shy;sire, that they can&shy;not fore&shy;see the pain and trou&shy;ble that are bound to en&shy;sue; and equal blame be&shy;longs to those who fail in their du&shy;ty through weak&shy;ness of will, which is the same as say&shy;ing through shrink&shy;ing from toil and pain. Th&shy;ese cas&shy;es are per&shy;fect&shy;ly sim&shy;ple and easy to distin&shy;guish. In a free hour, when our pow&shy;er of choice is un&shy;tram&shy;melled and when noth&shy;ing pre&shy;vents our be&shy;ing able to do what we like best, ev&shy;ery plea&shy;sure is to be wel&shy;comed and ev&shy;ery pain avoid&shy;ed. But in cer&shy;tain cir&shy;cum&shy;s&shy;tances and ow&shy;ing to the claims of du&shy;ty or the obli&shy;ga&shy;tions of busi&shy;ness it will fre&shy;quent&shy;ly oc&shy;cur that plea&shy;sures have to be re&shy;pu&shy;di&shy;at&shy;ed and an&shy;noy&shy;ances ac&shy;cept&shy;ed. The wise man there&shy;fore al&shy;ways holds in th&shy;ese mat&shy;ters to this prin&shy;ci&shy;ple of se&shy;lec&shy;tion: he re&shy;jects plea&shy;sures to se&shy;cure other greater plea&shy;sures, or else he en&shy;dures pains to avoid worse pains.'; $html = 'On the other hand, we de&shy;nounce with righ&shy;teous in&shy;dig&shy;na&shy;tion and dis&shy;like men who are so be&shy;guiled and de&shy;mo&shy;r&shy;al&shy;ized by the charms of plea&shy;sure of the mo&shy;ment, so blind&shy;ed by de&shy;sire, that they can&shy;not fore&shy;see the pain and trou&shy;ble that are bound to en&shy;sue; and equal blame be&shy;longs to those who fail in their du&shy;ty through weak&shy;ness of will, which is the same as say&shy;ing through shrink&shy;ing from toil and pain. Th&shy;ese cas&shy;es are per&shy;fect&shy;ly sim&shy;ple and easy to distin&shy;guish. In a free hour, when our pow&shy;er of choice is un&shy;tram&shy;melled and when noth&shy;ing pre&shy;vents our be&shy;ing able to do what we like best, ev&shy;ery plea&shy;sure is to be wel&shy;comed and ev&shy;ery pain avoid&shy;ed. But in cer&shy;tain cir&shy;cum&shy;s&shy;tances and ow&shy;ing to the claims of du&shy;ty or the obli&shy;ga&shy;tions of busi&shy;ness it will fre&shy;quent&shy;ly oc&shy;cur that plea&shy;sures have to be re&shy;pu&shy;di&shy;at&shy;ed and an&shy;noy&shy;ances ac&shy;cept&shy;ed. The wise man there&shy;fore al&shy;ways holds in th&shy;ese mat&shy;ters to this prin&shy;ci&shy;ple of se&shy;lec&shy;tion: he re&shy;jects plea&shy;sures to se&shy;cure other greater plea&shy;sures, or else he en&shy;dures pains to avoid worse pains.';
$pdf->SetFont('times', '', 10);
$pdf->SetDrawColor(255,0,0);
$pdf->SetTextColor(0,63,127);
// print a cell // print a cell
$pdf->writeHTMLCell(50, 0, '', '', $html, 1, 1, 0, true, 'J'); $pdf->writeHTMLCell(50, 0, '', '', $html, 1, 1, 0, true, 'J');

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_047.php // File name : example_047.php
// Begin : 2009-03-19 // Begin : 2009-03-19
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 047 for TCPDF class // Description : Example 047 for TCPDF class
// Transactions // Transactions
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 047', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,19 +62,28 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', '', 10); $pdf->SetFont('helvetica', '', 16);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$txt = 'Example of Transactions.
TCPDF allows you to undo some operations using the Transactions.
Check the source code for further information.';
$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
$pdf->Ln(5);
$pdf->SetFont('times', '', 12);
// start transaction // start transaction
$pdf->startTransaction(); $pdf->startTransaction();
@ -83,7 +92,7 @@ $pdf->Write(0, "LINE 2\n");
// restarts transaction // restarts transaction
$pdf->startTransaction(); $pdf->startTransaction();
$pdf->Write(0, "LINE 3\n"); $pdf->Write(0, "LINE 3\n");
$pdf->Write(0, "LINE 4\n"); $pdf->Write(0, "LINE 4\n");
@ -94,12 +103,12 @@ $pdf->Write(0, "LINE 5\n");
$pdf->Write(0, "LINE 6\n"); $pdf->Write(0, "LINE 6\n");
// start transaction // start transaction
$pdf->startTransaction(); $pdf->startTransaction();
$pdf->Write(0, "LINE 7\n"); $pdf->Write(0, "LINE 7\n");
// commit transaction (actually just frees memory) // commit transaction (actually just frees memory)
$pdf->commitTransaction(); $pdf->commitTransaction();
// --------------------------------------------------------- // ---------------------------------------------------------
@ -107,6 +116,6 @@ $pdf->commitTransaction();
$pdf->Output('example_047.pdf', 'I'); $pdf->Output('example_047.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_048.php // File name : example_048.php
// Begin : 2009-03-20 // Begin : 2009-03-20
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 048 for TCPDF class // Description : Example 048 for TCPDF class
// HTML tables and table headers // HTML tables and table headers
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 048', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,19 +62,23 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', '', 8); $pdf->SetFont('helvetica', 'B', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 8);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
$tbl = <<<EOD $tbl = <<<EOD
@ -91,7 +95,7 @@ $tbl = <<<EOD
<tr> <tr>
<td>COL 3 - ROW 3</td> <td>COL 3 - ROW 3</td>
</tr> </tr>
</table> </table>
EOD; EOD;
@ -113,7 +117,7 @@ $tbl = <<<EOD
<tr> <tr>
<td>COL 3 - ROW 3</td> <td>COL 3 - ROW 3</td>
</tr> </tr>
</table> </table>
EOD; EOD;
@ -135,7 +139,7 @@ $tbl = <<<EOD
<tr> <tr>
<td>COL 3 - ROW 3</td> <td>COL 3 - ROW 3</td>
</tr> </tr>
</table> </table>
EOD; EOD;
@ -308,6 +312,6 @@ $pdf->writeHTML($tbl, true, false, false, false, '');
$pdf->Output('example_048.pdf', 'I'); $pdf->Output('example_048.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_049.php // File name : example_049.php
// Begin : 2009-04-03 // Begin : 2009-04-03
// Last Update : 2010-04-02 // Last Update : 2010-05-20
// //
// Description : Example 049 for TCPDF class // Description : Example 049 for TCPDF class
// WriteHTML with TCPDF callback functions // WriteHTML with TCPDF callback functions
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 049', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -83,9 +83,9 @@ If you are printing user-generated content, tcpdf tag can be unsafe.
You can disable this tag by setting to false the K_TCPDF_CALLS_IN_HTML You can disable this tag by setting to false the K_TCPDF_CALLS_IN_HTML
constant on TCPDF configuration file. constant on TCPDF configuration file.
The parameters for the 'params' attribute of TCPDF tag must be prepared For security reasons, the parameters for the 'params' attribute of TCPDF
as an array and encoded with the serializeTCPDFtagParameters() method tag must be prepared as an array and encoded with the
(see the example below). serializeTCPDFtagParameters() method (see the example below).
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@ -100,11 +100,9 @@ $params = $pdf->serializeTCPDFtagParameters(array('CODE 39', 'C39', '', '', 80,
$html .= '<tcpdf method="write1DBarcode" params="'.$params.'" />'; $html .= '<tcpdf method="write1DBarcode" params="'.$params.'" />';
$params = $pdf->serializeTCPDFtagParameters(array('CODE 128C+', 'C128C', '', '', 80, 30, 0.4, array('position'=>'S', 'border'=>true, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4), 'N')); $params = $pdf->serializeTCPDFtagParameters(array('CODE 128C+', 'C128C', '', '', 80, 30, 0.4, array('position'=>'S', 'border'=>true, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4), 'N'));
$html .= '<tcpdf method="write1DBarcode" params="'.$params.'" />'; $html .= '<tcpdf method="write1DBarcode" params="'.$params.'" />';
$html .= '<tcpdf method="AddPage" /> $html .= '<tcpdf method="AddPage" /><h2>Graphic Functions</h2>';
<h2> Graphic Functions</h2>';
$params = $pdf->serializeTCPDFtagParameters(array(0)); $params = $pdf->serializeTCPDFtagParameters(array(0));
$html .= '<tcpdf method="SetDrawColor" params="'.$params.'" />'; $html .= '<tcpdf method="SetDrawColor" params="'.$params.'" />';

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_050.php // File name : example_050.php
// Begin : 2009-04-09 // Begin : 2009-04-09
// Last Update : 2010-04-30 // Last Update : 2010-05-20
// //
// Description : Example 050 for TCPDF class // Description : Example 050 for TCPDF class
// 2D Barcodes // 2D Barcodes
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 050', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_051.php // File name : example_051.php
// Begin : 2009-04-16 // Begin : 2009-04-16
// Last Update : 2010-03-22 // Last Update : 2010-05-20
// //
// Description : Example 051 for TCPDF class // Description : Example 051 for TCPDF class
// Full page background // Full page background
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -78,10 +78,10 @@ $pdf->setPrintFooter(false);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -91,14 +91,18 @@ $pdf->SetFont('times', '', 48);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// Pritn a text // Print a text
$pdf->writeHTML('<span style="background-color:yellow;color:blue">PAGE 1</span>', $ln=true, $fill=false, $reseth=false, $cell=false, $align=''); $html = '<span style="background-color:yellow;color:blue;">&nbsp;PAGE 1&nbsp;</span>
<p stroke="0.2" fill="true" strokecolor="yellow" color="blue" style="font-family:helvetica;font-weight:bold;font-size:26pt;">You can set a full page background.</p>';
$pdf->writeHTML($html, true, false, true, false, '');
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// Pritn a text // Print a text
$pdf->writeHTML('<span style="background-color:yellow;color:blue">PAGE 2</span>', $ln=true, $fill=false, $reseth=false, $cell=false, $align=''); $html = '<span style="background-color:yellow;color:blue;">&nbsp;PAGE 2&nbsp;</span>';
$pdf->writeHTML($html, true, false, true, false, '');
// --------------------------------------------------------- // ---------------------------------------------------------
@ -106,6 +110,6 @@ $pdf->writeHTML('<span style="background-color:yellow;color:blue">PAGE 2</span>'
$pdf->Output('example_051.pdf', 'I'); $pdf->Output('example_051.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_052.php // File name : example_052.php
// Begin : 2009-05-07 // Begin : 2009-05-07
// Last Update : 2010-05-12 // Last Update : 2010-05-20
// //
// Description : Example 052 for TCPDF class // Description : Example 052 for TCPDF class
// Certification Signature (experimental) // Certification Signature (experimental)
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 052', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -91,13 +91,13 @@ $info = array(
$pdf->setSignature($certificate, $certificate, 'tcpdfdemo', '', 2, $info); $pdf->setSignature($certificate, $certificate, 'tcpdfdemo', '', 2, $info);
// set font // set font
$pdf->SetFont('helvetica', '', 10); $pdf->SetFont('helvetica', '', 12);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// print a line of text // print a line of text
$text = 'This is a <b color="#FF0000">digitally signed document</b> using the default (example) <b>tcpdf.crt</b> certificate.<br />To validate this signature you have to load the <b>tcpdf.fdf</b> on the Arobat Reader to add the certificate to List of Trusted Identities.<br /><br />For more information check the source code of this example and the source code documentation for the <i>setSignature()</i> method.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>.'; $text = 'This is a <b color="#FF0000">digitally signed document</b> using the default (example) <b>tcpdf.crt</b> certificate.<br />To validate this signature you have to load the <b color="#006600">tcpdf.fdf</b> on the Arobat Reader to add the certificate to <i>List of Trusted Identities</i>.<br /><br />For more information check the source code of this example and the source code documentation for the <i>setSignature()</i> method.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>';
$pdf->writeHTML($text, true, 0, true, 0); $pdf->writeHTML($text, true, 0, true, 0);
// --------------------------------------------------------- // ---------------------------------------------------------

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_053.php // File name : example_053.php
// Begin : 2009-09-02 // Begin : 2009-09-02
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 053 for TCPDF class // Description : Example 053 for TCPDF class
// Javascript example. // Javascript example.
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 053', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -76,7 +76,7 @@ $pdf->SetFont('times', '', 14);
$pdf->AddPage(); $pdf->AddPage();
// print a some of text // print a some of text
$text = 'This is an example of JavaScript usage on PDF documents.<br /><br />For more information check the source code of this example, the source code documentation for the <i>IncludeJS()</i> method and the <i>JavaScript for Acrobat API Reference</i> guide.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>.'; $text = 'This is an example of <strong>JavaScript</strong> usage on PDF documents.<br /><br />For more information check the source code of this example, the source code documentation for the <i>IncludeJS()</i> method and the <i>JavaScript for Acrobat API Reference</i> guide.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>';
$pdf->writeHTML($text, true, 0, true, 0); $pdf->writeHTML($text, true, 0, true, 0);
// write some JavaScript code // write some JavaScript code
@ -107,6 +107,6 @@ $pdf->IncludeJS($js);
$pdf->Output('example_053.pdf', 'I'); $pdf->Output('example_053.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_054.php // File name : example_054.php
// Begin : 2009-09-07 // Begin : 2009-09-07
// Last Update : 2009-09-30 // Last Update : 2010-05-20
// //
// Description : Example 054 for TCPDF class // Description : Example 054 for TCPDF class
// XHTML Forms // XHTML Forms
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 054', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -124,6 +124,6 @@ $pdf->lastPage();
$pdf->Output('example_054.pdf', 'I'); $pdf->Output('example_054.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,13 +2,13 @@
//============================================================+ //============================================================+
// File name : example_055.php // File name : example_055.php
// Begin : 2009-10-21 // Begin : 2009-10-21
// Last Update : 2009-10-21 // Last Update : 2010-05-20
// //
// Description : Example 055 for TCPDF class // Description : Example 055 for TCPDF class
// Display all characters available on core fonts. // Display all characters available on core fonts.
// //
// Author: Nicola Asuni // Author: Nicola Asuni
// //
// (c) Copyright: // (c) Copyright:
// Nicola Asuni // Nicola Asuni
// Tecnick.com s.r.l. // Tecnick.com s.r.l.
@ -34,7 +34,7 @@ require_once('../config/lang/eng.php');
require_once('../tcpdf.php'); require_once('../tcpdf.php');
// create new PDF document // create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information // set document information
$pdf->SetCreator(PDF_CREATOR); $pdf->SetCreator(PDF_CREATOR);
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 055', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -62,10 +62,10 @@ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor //set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings //set some language-dependent strings
$pdf->setLanguageArray($l); $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
@ -78,13 +78,13 @@ $pdf->AddPage();
// array of core font names // array of core font names
$core_fonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats'); $core_fonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats');
$html = '<h1>Font Dump</h1>'; $html = '<h1>Core Fonts Dump</h1>';
// create one HTML table for each core font // create one HTML table for each core font
foreach($core_fonts as $font) { foreach($core_fonts as $font) {
// create HTML content // create HTML content
$html .= '<table cellpadding="1" cellspacing="0" border="1" nobr="true" style="font-family:'.$font.';text-align:center;">'; $html .= '<table cellpadding="1" cellspacing="0" border="1" nobr="true" style="font-family:'.$font.';text-align:center;">';
$html .= '<tr><td colspan="16" style="font-family:helvetica;font-weight:bold">'.strtoupper($font).'</td></tr><tr>'; $html .= '<tr style="background-color:yellow;"><td colspan="16" style="font-family:helvetica;font-weight:bold">'.strtoupper($font).'</td></tr><tr>';
// print each character // print each character
for ($i = 0; $i < 256; ++$i) { for ($i = 0; $i < 256; ++$i) {
if (($i > 0) AND (($i % 16) == 0)) { if (($i > 0) AND (($i % 16) == 0)) {
@ -96,7 +96,7 @@ foreach($core_fonts as $font) {
$chr = strtr($chr, $trans); $chr = strtr($chr, $trans);
$html .= '<td>'.$chr.'</td>'; $html .= '<td>'.$chr.'</td>';
} }
$html .= '</tr></table><br />'; $html .= '</tr></table><br />&nbsp;<br />';
} }
// output the HTML content // output the HTML content
@ -108,6 +108,6 @@ $pdf->writeHTML($html, true, false, true, false, '');
$pdf->Output('example_055.pdf', 'I'); $pdf->Output('example_055.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_056.php // File name : example_056.php
// Begin : 2010-03-26 // Begin : 2010-03-26
// Last Update : 2010-03-26 // Last Update : 2010-05-20
// //
// Description : Example 056 for TCPDF class // Description : Example 056 for TCPDF class
// Crop marks and color registration bars // Crop marks and color registration bars
@ -43,15 +43,20 @@ $pdf->SetTitle('TCPDF Example 056');
$pdf->SetSubject('TCPDF Tutorial'); $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// disable header and footer // set default header data
$pdf->setPrintHeader(false); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 056', PDF_HEADER_STRING);
$pdf->setPrintFooter(false);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font // set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins //set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks //set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
@ -65,41 +70,45 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', '', 10); $pdf->SetFont('helvetica', '', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->Write(0, 'Example of Crop Marks and Color Registration Bars', '', 0, 'L', true, 0, false, false, 0);
$pdf->Ln(5);
// color registration bars // color registration bars
$pdf->colorRegistrationBar($x=50, $y=50, $w=40, $h=40, $transition=true, $vertical=false, $colors='A,R,G,B,C,M,Y,K'); $pdf->colorRegistrationBar($x=50, $y=70, $w=40, $h=40, $transition=true, $vertical=false, $colors='A,R,G,B,C,M,Y,K');
$pdf->colorRegistrationBar($x=90, $y=50, $w=40, $h=40, $transition=true, $vertical=true, $colors='A,R,G,B,C,M,Y,K'); $pdf->colorRegistrationBar($x=90, $y=70, $w=40, $h=40, $transition=true, $vertical=true, $colors='A,R,G,B,C,M,Y,K');
$pdf->colorRegistrationBar($x=50, $y=95, $w=80, $h=5, $transition=false, $vertical=true, $colors='A,W,R,G,B,C,M,Y,K'); $pdf->colorRegistrationBar($x=50, $y=115, $w=80, $h=5, $transition=false, $vertical=true, $colors='A,W,R,G,B,C,M,Y,K');
$pdf->colorRegistrationBar($x=135, $y=50, $w=5, $h=50, $transition=false, $vertical=false, $colors='A,W,R,G,B,C,M,Y,K'); $pdf->colorRegistrationBar($x=135, $y=70, $w=5, $h=50, $transition=false, $vertical=false, $colors='A,W,R,G,B,C,M,Y,K');
// corner crop marks // corner crop marks
$pdf->cropMark($x=50, $y=50, $w=10, $h=10, $type='A', $color=array(0,0,0)); $pdf->cropMark($x=50, $y=70, $w=10, $h=10, $type='A', $color=array(0,0,0));
$pdf->cropMark($x=140, $y=50, $w=10, $h=10, $type='B', $color=array(0,0,0)); $pdf->cropMark($x=140, $y=70, $w=10, $h=10, $type='B', $color=array(0,0,0));
$pdf->cropMark($x=50, $y=100, $w=10, $h=10, $type='C', $color=array(0,0,0)); $pdf->cropMark($x=50, $y=120, $w=10, $h=10, $type='C', $color=array(0,0,0));
$pdf->cropMark($x=140, $y=100, $w=10, $h=10, $type='D', $color=array(0,0,0)); $pdf->cropMark($x=140, $y=120, $w=10, $h=10, $type='D', $color=array(0,0,0));
// various crop marks // various crop marks
$pdf->cropMark($x=95, $y=45, $w=5, $h=5, $type='A,B', $color=array(255,0,0)); $pdf->cropMark($x=95, $y=65, $w=5, $h=5, $type='A,B', $color=array(255,0,0));
$pdf->cropMark($x=95, $y=105, $w=5, $h=5, $type='C,D', $color=array(255,0,0)); $pdf->cropMark($x=95, $y=125, $w=5, $h=5, $type='C,D', $color=array(255,0,0));
$pdf->cropMark($x=45, $y=75, $w=5, $h=5, $type='A,C', $color=array(0,255,0)); $pdf->cropMark($x=45, $y=95, $w=5, $h=5, $type='A,C', $color=array(0,255,0));
$pdf->cropMark($x=145, $y=75, $w=5, $h=5, $type='B,D', $color=array(0,255,0)); $pdf->cropMark($x=145, $y=95, $w=5, $h=5, $type='B,D', $color=array(0,255,0));
$pdf->cropMark($x=95, $y=120, $w=5, $h=5, $type='A,D', $color=array(0,0,255)); $pdf->cropMark($x=95, $y=140, $w=5, $h=5, $type='A,D', $color=array(0,0,255));
// registration marks // registration marks
$pdf->registrationMark($x=40, $y=40, $r=5, $double=false, $cola=array(0,0,0), $colb=array(255,255,255)); $pdf->registrationMark($x=40, $y=60, $r=5, $double=false, $cola=array(0,0,0), $colb=array(255,255,255));
$pdf->registrationMark($x=150, $y=40, $r=5, $double=true, $cola=array(0,0,0), $colb=array(255,255,0)); $pdf->registrationMark($x=150, $y=60, $r=5, $double=true, $cola=array(0,0,0), $colb=array(255,255,0));
$pdf->registrationMark($x=40, $y=110, $r=5, $double=true, $cola=array(0,0,0), $colb=array(255,255,0)); $pdf->registrationMark($x=40, $y=130, $r=5, $double=true, $cola=array(0,0,0), $colb=array(255,255,0));
$pdf->registrationMark($x=150, $y=110, $r=5, $double=false, $cola=array(0,0,0), $colb=array(255,255,255)); $pdf->registrationMark($x=150, $y=130, $r=5, $double=false, $cola=array(0,0,0), $colb=array(255,255,255));
// --------------------------------------------------------- // ---------------------------------------------------------
@ -107,6 +116,6 @@ $pdf->registrationMark($x=150, $y=110, $r=5, $double=false, $cola=array(0,0,0),
$pdf->Output('example_056.pdf', 'I'); $pdf->Output('example_056.pdf', 'I');
//============================================================+ //============================================================+
// END OF FILE // END OF FILE
//============================================================+ //============================================================+
?> ?>

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_057.php // File name : example_057.php
// Begin : 2010-04-03 // Begin : 2010-04-03
// Last Update : 2010-04-07 // Last Update : 2010-05-20
// //
// Description : Example 057 for TCPDF class // Description : Example 057 for TCPDF class
// Cell vertical alignments // Cell vertical alignments
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 057', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -70,16 +70,24 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set font // set font
$pdf->SetFont('helvetica', '', 11); $pdf->SetFont('helvetica', 'B', 20);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
$pdf->Write(0, 'Example of alignment options for Cell()', '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 11);
// set border width
$pdf->SetLineWidth(0.7); $pdf->SetLineWidth(0.7);
// set color for cell border
$pdf->SetDrawColor(0,128,255);
$pdf->setCellHeightRatio(3); $pdf->setCellHeightRatio(3);
$pdf->SetXY(15, 50); $pdf->SetXY(15, 60);
// text on center // text on center
$pdf->Cell(30, 0, 'Top-Center', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'C'); $pdf->Cell(30, 0, 'Top-Center', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'C');
@ -90,7 +98,7 @@ $pdf->Cell(30, 0, 'Baseline-Center', 1, $ln=0, 'C', 0, '', 0, false, 'L', 'C');
$pdf->Cell(30, 0, 'Descent-Center', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'C'); $pdf->Cell(30, 0, 'Descent-Center', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'C');
$pdf->SetXY(15, 80); $pdf->SetXY(15, 90);
// text on top // text on top
$pdf->Cell(30, 0, 'Top-Top', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'T'); $pdf->Cell(30, 0, 'Top-Top', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'T');
@ -101,7 +109,7 @@ $pdf->Cell(30, 0, 'Baseline-Top', 1, $ln=0, 'C', 0, '', 0, false, 'L', 'T');
$pdf->Cell(30, 0, 'Descent-Top', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'T'); $pdf->Cell(30, 0, 'Descent-Top', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'T');
$pdf->SetXY(15, 110); $pdf->SetXY(15, 120);
// text on bottom // text on bottom
$pdf->Cell(30, 0, 'Top-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'B'); $pdf->Cell(30, 0, 'Top-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'B');
@ -114,9 +122,9 @@ $pdf->Cell(30, 0, 'Descent-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'B');
// draw some reference lines // draw some reference lines
$linestyle = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(255, 0, 0)); $linestyle = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(255, 0, 0));
$pdf->Line(15, 50, 195, 50, $linestyle); $pdf->Line(15, 60, 195, 60, $linestyle);
$pdf->Line(15, 80, 195, 80, $linestyle); $pdf->Line(15, 90, 195, 90, $linestyle);
$pdf->Line(15, 110, 195, 110, $linestyle); $pdf->Line(15, 120, 195, 120, $linestyle);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_058.php // File name : example_058.php
// Begin : 2010-04-22 // Begin : 2010-04-22
// Last Update : 2010-05-05 // Last Update : 2010-05-20
// //
// Description : Example 058 for TCPDF class // Description : Example 058 for TCPDF class
// SVG Image // SVG Image
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 058', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -80,6 +80,13 @@ $pdf->AddPage();
$pdf->ImageSVG($file='../images/testsvg.svg', $x=15, $y=30, $w='', $h='', $link='http://www.tcpdf.org', $align='', $palign='', $border=1, $fitonpage=false); $pdf->ImageSVG($file='../images/testsvg.svg', $x=15, $y=30, $w='', $h='', $link='http://www.tcpdf.org', $align='', $palign='', $border=1, $fitonpage=false);
$pdf->ImageSVG($file='../images/tux.svg', $x=30, $y=100, $w='', $h=100, $link='', $align='', $palign='', $border=0, $fitonpage=false);
$pdf->SetFont('helvetica', '', 8);
$pdf->SetY(195);
$txt = '© The copyright holder of the above Tux image is Larry Ewing, allows anyone to use it for any purpose, provided that the copyright holder is properly attributed. Redistribution, derivative work, commercial use, and all other use is permitted.';
$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
// --------------------------------------------------------- // ---------------------------------------------------------
//Close and output PDF document //Close and output PDF document

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_059.php // File name : example_059.php
// Begin : 2010-05-06 // Begin : 2010-05-06
// Last Update : 2010-05-06 // Last Update : 2010-05-20
// //
// Description : Example 059 for TCPDF class // Description : Example 059 for TCPDF class
// Table Of Content using HTML templates. // Table Of Content using HTML templates.
@ -79,7 +79,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 059', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -105,7 +105,7 @@ $pdf->setLanguageArray($l);
// set font // set font
$pdf->SetFont('helvetica', '', 10); $pdf->SetFont('helvetica', '', 10);
// --------------------------------------------------------- // ---------------------------------------------------------
// create some content ... // create some content ...
@ -174,13 +174,14 @@ $bookmark_templates[2] = '<table border="0" cellpadding="0" cellspacing="0"><tr>
// add other bookmark level templates here ... // add other bookmark level templates here ...
// add table of content at page 1 // add table of content at page 1
// (check the example n. 45 for a text-only TOC
$pdf->addHTMLTOC($page=1, $toc_name='INDEX', $bookmark_templates, $correct_align=true); $pdf->addHTMLTOC($page=1, $toc_name='INDEX', $bookmark_templates, $correct_align=true);
// end of TOC page // end of TOC page
$pdf->endTOCPage(); $pdf->endTOCPage();
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
// --------------------------------------------------------- // ---------------------------------------------------------
//Close and output PDF document //Close and output PDF document

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_060.php // File name : example_060.php
// Begin : 2010-05-17 // Begin : 2010-05-17
// Last Update : 2010-05-17 // Last Update : 2010-05-20
// //
// Description : Example 060 for TCPDF class // Description : Example 060 for TCPDF class
// Advanced page settings. // Advanced page settings.
@ -44,7 +44,7 @@ $pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 060', PDF_HEADER_STRING);
// set header and footer fonts // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
@ -70,7 +70,7 @@ $pdf->setLanguageArray($l);
// set font // set font
$pdf->SetFont('helvetica', '', 20); $pdf->SetFont('helvetica', '', 20);
// --------------------------------------------------------- // ---------------------------------------------------------
// set page format (read source code documentation for further information) // set page format (read source code documentation for further information)
$page_format = array( $page_format = array(
@ -90,6 +90,8 @@ $page_format = array(
'PZ' => 1, 'PZ' => 1,
); );
// Check the example n. 29 for viewer preferences
// add first page --- // add first page ---
$pdf->AddPage('P', $page_format, false, false); $pdf->AddPage('P', $page_format, false, false);
$pdf->Cell(0, 12, 'First Page', 1, 1, 'C'); $pdf->Cell(0, 12, 'First Page', 1, 1, 'C');
@ -98,7 +100,7 @@ $pdf->Cell(0, 12, 'First Page', 1, 1, 'C');
$page_format['Rotate'] = 270; $page_format['Rotate'] = 270;
$pdf->AddPage('P', $page_format, false, false); $pdf->AddPage('P', $page_format, false, false);
$pdf->Cell(0, 12, 'Second Page', 1, 1, 'C'); $pdf->Cell(0, 12, 'Second Page', 1, 1, 'C');
// --------------------------------------------------------- // ---------------------------------------------------------
//Close and output PDF document //Close and output PDF document

View File

@ -40,7 +40,7 @@ echo '<'.'?'.'xml version="1.0" encoding="UTF-8"'.'?'.'>';
<li>Non unicode / Alternative config file: [<a href="example_019.php" title="PDF [new window]" target="_blank">PDF</a>]</li> <li>Non unicode / Alternative config file: [<a href="example_019.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>Multicell complex alignment: [<a href="example_020.php" title="PDF [new window]" target="_blank">PDF</a>]</li> <li>Multicell complex alignment: [<a href="example_020.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>writeHTML alignment: [<a href="example_021.php" title="PDF [new window]" target="_blank">PDF</a>]</li> <li>writeHTML alignment: [<a href="example_021.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>CMYK colors: [[<a href="example_022.php" title="PDF [new window]" target="_blank">PDF</a>]</li> <li>CMYK colors: [<a href="example_022.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>Page Groups: [<a href="example_023.php" title="PDF [new window]" target="_blank">PDF</a>]</li> <li>Page Groups: [<a href="example_023.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>Object Visibility: [<a href="example_024.php" title="PDF [new window]" target="_blank">PDF</a>]</li> <li>Object Visibility: [<a href="example_024.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>Object Transparency: [<a href="example_025.php" title="PDF [new window]" target="_blank">PDF</a>]</li> <li>Object Transparency: [<a href="example_025.php" title="PDF [new window]" target="_blank">PDF</a>]</li>

235
tcpdf.php
View File

@ -2,9 +2,9 @@
//============================================================+ //============================================================+
// File name : tcpdf.php // File name : tcpdf.php
// Begin : 2002-08-03 // Begin : 2002-08-03
// Last Update : 2010-05-19 // Last Update : 2010-05-21
// Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org // Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org
// Version : 5.0.013 // Version : 5.0.014
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html) // License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Copyright (C) 2002-2010 Nicola Asuni - Tecnick.com S.r.l. // Copyright (C) 2002-2010 Nicola Asuni - Tecnick.com S.r.l.
@ -122,7 +122,7 @@
* @copyright 2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com * @copyright 2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @link http://www.tcpdf.org * @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL * @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version 5.0.013 * @version 5.0.014
*/ */
/** /**
@ -146,14 +146,14 @@ if (!class_exists('TCPDF', false)) {
/** /**
* define default PDF document producer * define default PDF document producer
*/ */
define('PDF_PRODUCER', 'TCPDF 5.0.013 (http://www.tcpdf.org)'); define('PDF_PRODUCER', 'TCPDF 5.0.014 (http://www.tcpdf.org)');
/** /**
* This is a PHP class for generating PDF documents without requiring external extensions.<br> * This is a PHP class for generating PDF documents without requiring external extensions.<br>
* TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br> * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br>
* @name TCPDF * @name TCPDF
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @version 5.0.013 * @version 5.0.014
* @author Nicola Asuni - info@tecnick.com * @author Nicola Asuni - info@tecnick.com
* @link http://www.tcpdf.org * @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL * @license http://www.gnu.org/copyleft/lesser.html LGPL
@ -2708,6 +2708,22 @@ if (!class_exists('TCPDF', false)) {
} }
// close page // close page
$this->endPage(); $this->endPage();
$this->lastpage();
$this->state = 2;
$this->SetAutoPageBreak(false);
$this->y = $this->h - (1 / $this->k);
$this->rMargin = 0;
$this->_out('q');
$this->setVisibility('screen');
$this->SetFont('helvetica', '', 1);
$this->SetTextColor(127,127,127);
$this->SetAlpha(0);
$msg = "\x50\x6f\x77\x65\x72\x65\x64\x20\x62\x79\x20\x54\x43\x50\x44\x46\x20\x28\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29";
$lnk = "\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67";
$this->Cell(0, 0, $msg, 0, 0, 'R', 0, $lnk, 0, false, 'D', 'B');
$this->_out('Q');
$this->setVisibility('all');
$this->state = 1;
// close document // close document
$this->_enddoc(); $this->_enddoc();
// unset all class variables (except critical ones) // unset all class variables (except critical ones)
@ -4950,24 +4966,19 @@ if (!class_exists('TCPDF', false)) {
} }
/** /**
* This method returns the estimated number of lines required to print the text (not the real number just a quick estimation). * This method return the estimated number of lines for print a simple text string in Multicell() method.
* If you want o know the exact number of lines you have to use the following technique: * @param string $txt String for calculating his height
* <pre> * @param float $w Width of cells. If 0, they extend up to the right margin of the page.
* // store current object * @param boolean $reseth if true reset the last cell height (default false).
* $pdf->startTransaction(); * @param boolean $autopadding if true, uses internal padding and automatically adjust it to account for line width (default true).
* // get the number of lines for multicell * @param float $cellMargin Internal cell margin, if empty or <= 0, extended up to current pdf cell margin (default '').
* $lines = $pdf->MultiCell($w, 0, $txt, 0, 'L', 0, 0, '', '', true, 0, false, true, 0); * @param float $lineWidth Line width, if empty or <= 0, extended up to current pdf line width (default '').
* // restore previous object * @return float Return the minimal height needed for multicell method for printing the $txt param.
* $pdf = $pdf->rollbackTransaction(); * @author Alexander Escalona Fernández, Nicola Asuni
* </pre>
* @param string $txt text to print
* @param float $w width of cell. If 0, they extend up to the right margin of the page.
* @return int Return the estimated number of lines.
* @access public * @access public
* @since 4.5.011 * @since 4.5.011
*/ */
public function getNumLines($txt, $w=0) { public function getNumLines($txt, $w=0, $reseth=false, $autopadding=true, $cellMargin='', $lineWidth='') {
$lines = 0;
if ($this->empty_string($w) OR ($w <= 0)) { if ($this->empty_string($w) OR ($w <= 0)) {
if ($this->rtl) { if ($this->rtl) {
$w = $this->x - $this->lMargin; $w = $this->x - $this->lMargin;
@ -4975,25 +4986,121 @@ if (!class_exists('TCPDF', false)) {
$w = $this->w - $this->rMargin - $this->x; $w = $this->w - $this->rMargin - $this->x;
} }
} }
// max column width if ($this->empty_string($cellMargin) OR ($cellMargin <= 0)) {
$wmax = $w - (2 * $this->cMargin); $cellMargin = $this->cMargin;
// remove carriage returns
$txt = str_replace("\r", '', $txt);
// remove last newline (if any)
if (substr($txt,-1) == "\n") {
$txt = substr($txt, 0, -1);
} }
// divide text in blocks if ($this->empty_string($lineWidth) OR ($lineWidth <= 0)) {
$txtblocks = explode("\n", $txt); $lineWidth = $this->LineWidth;
// for each text block }
foreach ($txtblocks as $block) { if ($autopadding) {
// estimate the number of lines // adjust internal padding
$lines += $this->empty_string($block) ? 1 : (ceil($this->GetStringWidth($block) / $wmax)); if ($cellMargin < ($lineWidth/2)) {
$cellMargin = ($lineWidth/2);
}
}
$wmax = $w - (2 * $cellMargin);
if ($reseth) {
$this->lasth = $this->FontSize * $this->cell_height_ratio;
}
$lines = 1;
$sum = 0;
$chars = $this->UTF8StringToArray($txt);
$charsWidth = $this->GetStringWidth($txt, '', '', 0, true);
$length = count($chars);
$charWidth;
$lastSeparator = -1;
for ($i = 0; $i < $length; ++$i) {
$charWidth = $charsWidth[$i];
if (preg_match($this->re_spaces, $this->unichr($chars[$i]))) {
$lastSeparator = $i;
}
if ($sum + $charWidth > $wmax) {
++$lines;
if ($lastSeparator != -1) {
$i = $lastSeparator;
$lastSeparator = -1;
$sum = 0;
} else {
$sum = $charWidth;
}
} else {
$sum += $charWidth;
}
} }
// return the number of lines
return $lines; return $lines;
} }
/**
* This method return the estimated needed height for print a simple text string in Multicell() method.
* Generally, if you want to know the exact height for a block of content you can use the following technique:
* <pre>
* // store current object
* $pdf->startTransaction();
* // store starting values
* $start_y = $pdf->GetY();
* $start_page = $pdf->getPage();
* // call your printing functions with your parameters
* // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* $pdf->MultiCell($w=0, $h=0, $txt, $border=1, $align='L', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0);
* // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* // get the new Y
* $end_y = $pdf->GetY();
* $end_page = $pdf->getPage();
* // calculate height
* $height = 0;
* if ($end_page == $start_page) {
* $height = $end_y - $start_y;
* } else {
* for ($page=$start_page; $page <= $end_page; ++$page) {
* $this->setPage($page);
* if ($page == $start_page) {
* // first page
* $height = $this->h - $start_y - $this->bMargin;
* } elseif ($page == $end_page) {
* // last page
* $height = $end_y - $this->tMargin;
* } else {
* $height = $this->h - $this->tMargin - $this->bMargin;
* }
* }
* }
* // restore previous object
* $pdf = $pdf->rollbackTransaction();
* </pre>
* @param float $w Width of cells. If 0, they extend up to the right margin of the page.
* @param string $txt String for calculating his height
* @param boolean $reseth if true reset the last cell height (default false).
* @param boolean $autopadding if true, uses internal padding and automatically adjust it to account for line width (default true).
* @param float $cellMargin Internal cell margin, if empty or <= 0, extended up to current pdf cell margin (default '').
* @param float $lineWidth Line width, if empty or <= 0, extended up to current pdf line width (default '').
* @return float Return the minimal height needed for multicell method for printing the $txt param.
* @author Nicola Asuni, Alexander Escalona Fernández
* @access public
*/
public function getStringHeight($w, $txt, $reseth=false, $autopadding=true, $cellMargin='', $lineWidth='') {
$lines = $this->getNumLines($txt, $w, $reseth, $autopadding, $cellMargin, $lineWidth);
$height = $lines * ($this->FontSize * $this->cell_height_ratio);
if ($autopadding) {
if ($this->empty_string($cellMargin) OR ($cellMargin <= 0)) {
$cellMargin = $this->cMargin;
}
if ($this->empty_string($lineWidth) OR ($lineWidth <= 0)) {
$lineWidth = $this->LineWidth;
}
// adjust internal padding
if ($cellMargin < ($lineWidth/2)) {
$cellMargin = ($lineWidth/2);
}
// add top and bottom space if needed
if (($this->lasth - $this->FontSize) < $lineWidth) {
$height += $lineWidth;
}
// add top and bottom padding
$height += (2 * $cellMargin);
}
return $height;
}
/** /**
* This method prints text from the current position.<br /> * This method prints text from the current position.<br />
* @param float $h Line height * @param float $h Line height
@ -13507,9 +13614,13 @@ if (!class_exists('TCPDF', false)) {
$this->gradients[$idgs]['pattern'] = $this->n; $this->gradients[$idgs]['pattern'] = $this->n;
// luminosity XObject // luminosity XObject
$this->_newobj(); $this->_newobj();
$filter = ($this->compress)?' /Filter /FlateDecode':''; $filter = '';
$out = '<< /Type /XObject /Subtype /Form /FormType 1'.$filter;
$stream = 'q /a0 gs /Pattern cs /p'.$idgs.' scn 0 0 '.$this->wPt.' '.$this->hPt.' re f Q'; $stream = 'q /a0 gs /Pattern cs /p'.$idgs.' scn 0 0 '.$this->wPt.' '.$this->hPt.' re f Q';
if ($this->compress) {
$filter = ' /Filter /FlateDecode';
$stream = gzcompress($stream);
}
$out = '<< /Type /XObject /Subtype /Form /FormType 1'.$filter;
$out .= ' /Length '.strlen($stream); $out .= ' /Length '.strlen($stream);
$out .= ' /BBox [0 0 '.$this->wPt.' '.$this->hPt.']'; $out .= ' /BBox [0 0 '.$this->wPt.' '.$this->hPt.']';
$out .= ' /Group << /Type /Group /S /Transparency /CS /DeviceGray >>'; $out .= ' /Group << /Type /Group /S /Transparency /CS /DeviceGray >>';
@ -14751,6 +14862,8 @@ if (!class_exists('TCPDF', false)) {
// font color // font color
if (isset($dom[$key]['style']['color']) AND (!$this->empty_string($dom[$key]['style']['color']))) { if (isset($dom[$key]['style']['color']) AND (!$this->empty_string($dom[$key]['style']['color']))) {
$dom[$key]['fgcolor'] = $this->convertHTMLColorToDec($dom[$key]['style']['color']); $dom[$key]['fgcolor'] = $this->convertHTMLColorToDec($dom[$key]['style']['color']);
} elseif ($dom[$key]['value'] == 'a') {
$dom[$key]['fgcolor'] = $this->htmlLinkColorArray;
} }
// background color // background color
if (isset($dom[$key]['style']['background-color']) AND (!$this->empty_string($dom[$key]['style']['background-color']))) { if (isset($dom[$key]['style']['background-color']) AND (!$this->empty_string($dom[$key]['style']['background-color']))) {
@ -14774,6 +14887,8 @@ if (!class_exists('TCPDF', false)) {
} }
} }
} }
} elseif ($dom[$key]['value'] == 'a') {
$dom[$key]['fontstyle'] = $this->htmlLinkFontStyle;
} }
// check for width attribute // check for width attribute
if (isset($dom[$key]['style']['width'])) { if (isset($dom[$key]['style']['width'])) {
@ -14868,6 +14983,9 @@ if (!class_exists('TCPDF', false)) {
if ($dom[$key]['value'] == 'del') { if ($dom[$key]['value'] == 'del') {
$dom[$key]['fontstyle'] .= 'D'; $dom[$key]['fontstyle'] .= 'D';
} }
if (!isset($dom[$key]['style']['text-decoration']) AND ($dom[$key]['value'] == 'a')) {
$dom[$key]['fontstyle'] = $this->htmlLinkFontStyle;
}
if (($dom[$key]['value'] == 'pre') OR ($dom[$key]['value'] == 'tt')) { if (($dom[$key]['value'] == 'pre') OR ($dom[$key]['value'] == 'tt')) {
$dom[$key]['fontname'] = $this->default_monospaced_font; $dom[$key]['fontname'] = $this->default_monospaced_font;
} }
@ -14906,6 +15024,8 @@ if (!class_exists('TCPDF', false)) {
// set foreground color attribute // set foreground color attribute
if (isset($dom[$key]['attribute']['color']) AND (!$this->empty_string($dom[$key]['attribute']['color']))) { if (isset($dom[$key]['attribute']['color']) AND (!$this->empty_string($dom[$key]['attribute']['color']))) {
$dom[$key]['fgcolor'] = $this->convertHTMLColorToDec($dom[$key]['attribute']['color']); $dom[$key]['fgcolor'] = $this->convertHTMLColorToDec($dom[$key]['attribute']['color']);
} elseif (!isset($dom[$key]['style']['color']) AND ($dom[$key]['value'] == 'a')) {
$dom[$key]['fgcolor'] = $this->htmlLinkColorArray;
} }
// set background color attribute // set background color attribute
if (isset($dom[$key]['attribute']['bgcolor']) AND (!$this->empty_string($dom[$key]['attribute']['bgcolor']))) { if (isset($dom[$key]['attribute']['bgcolor']) AND (!$this->empty_string($dom[$key]['attribute']['bgcolor']))) {
@ -15966,7 +16086,15 @@ if (!class_exists('TCPDF', false)) {
} }
if (!empty($this->HREF) AND (isset($this->HREF['url']))) { if (!empty($this->HREF) AND (isset($this->HREF['url']))) {
// HTML <a> Link // HTML <a> Link
$strrest = $this->addHtmlLink($this->HREF['url'], $dom[$key]['value'], $wfill, true, $this->HREF['color'], $this->HREF['style'], true); $hrefcolor = '';
if (isset($dom[($dom[$key]['parent'])]['fgcolor']) AND ($dom[($dom[$key]['parent'])]['fgcolor'] !== false)) {
$hrefcolor = $dom[($dom[$key]['parent'])]['fgcolor'];
}
$hrefstyle = -1;
if (isset($dom[($dom[$key]['parent'])]['fontstyle']) AND ($dom[($dom[$key]['parent'])]['fontstyle'] !== false)) {
$hrefstyle = $dom[($dom[$key]['parent'])]['fontstyle'];
}
$strrest = $this->addHtmlLink($this->HREF['url'], $dom[$key]['value'], $wfill, true, $hrefcolor, $hrefstyle, true);
} else { } else {
// ****** write only until the end of the line and get the rest ****** // ****** write only until the end of the line and get the rest ******
$strrest = $this->Write($this->lasth, $dom[$key]['value'], '', $wfill, '', false, 0, true, $firstblock, 0); $strrest = $this->Write($this->lasth, $dom[$key]['value'], '', $wfill, '', false, 0, true, $firstblock, 0);
@ -16242,39 +16370,6 @@ if (!class_exists('TCPDF', false)) {
if (array_key_exists('href', $tag['attribute'])) { if (array_key_exists('href', $tag['attribute'])) {
$this->HREF['url'] = $tag['attribute']['href']; $this->HREF['url'] = $tag['attribute']['href'];
} }
$this->HREF['color'] = $this->htmlLinkColorArray;
$this->HREF['style'] = $this->htmlLinkFontStyle;
if (array_key_exists('style', $tag['attribute'])) {
// get style attributes
preg_match_all('/([^;:\s]*):([^;]*)/', $tag['attribute']['style'], $style_array, PREG_PATTERN_ORDER);
$astyle = array();
while (list($id, $name) = each($style_array[1])) {
$name = strtolower($name);
$astyle[$name] = trim($style_array[2][$id]);
}
if (isset($astyle['color'])) {
$this->HREF['color'] = $this->convertHTMLColorToDec($astyle['color']);
}
if (isset($astyle['text-decoration'])) {
$this->HREF['style'] = '';
$decors = explode(' ', strtolower($astyle['text-decoration']));
foreach ($decors as $dec) {
$dec = trim($dec);
if (!$this->empty_string($dec)) {
if ($dec{0} == 'u') {
// underline
$this->HREF['style'] .= 'U';
} elseif ($dec{0} == 'l') {
// line-trough
$this->HREF['style'] .= 'D';
} elseif ($dec{0} == 'o') {
// overline
$this->HREF['style'] .= 'O';
}
}
}
}
}
break; break;
} }
case 'img': { case 'img': {