-
Notifications
You must be signed in to change notification settings - Fork 865
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from mike42/testing
Update master w/ margins, spacing, Vietnamese text support, bug fix
- Loading branch information
Showing
15 changed files
with
180 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/* Left margin & page width demo. */ | ||
require __DIR__ . '/../autoload.php'; | ||
use Mike42\Escpos\Printer; | ||
use Mike42\Escpos\PrintConnectors\FilePrintConnector; | ||
|
||
$connector = new FilePrintConnector("php://stdout"); // Add connector for your printer here. | ||
$printer = new Printer($connector); | ||
|
||
/* Line spacing */ | ||
/* | ||
$printer -> setEmphasis(true); | ||
$printer -> text("Line spacing\n"); | ||
$printer -> setEmphasis(false); | ||
foreach(array(16, 32, 64, 128, 255) as $spacing) { | ||
$printer -> setLineSpacing($spacing); | ||
$printer -> text("Spacing $spacing: The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.\n"); | ||
} | ||
$printer -> setLineSpacing(); // Back to default | ||
*/ | ||
|
||
/* Stuff around with left margin */ | ||
$printer -> setEmphasis(true); | ||
$printer -> text("Left margin\n"); | ||
$printer -> setEmphasis(false); | ||
$printer -> text("Default left\n"); | ||
foreach(array(1, 2, 4, 8, 16, 32, 64, 128, 256, 512) as $margin) { | ||
$printer -> setPrintLeftMargin($margin); | ||
$printer -> text("left margin $margin\n"); | ||
} | ||
/* Reset left */ | ||
$printer -> setPrintLeftMargin(0); | ||
|
||
/* Stuff around with page width */ | ||
$printer -> setEmphasis(true); | ||
$printer -> text("Page width\n"); | ||
$printer -> setEmphasis(false); | ||
$printer -> setJustification(Printer::JUSTIFY_RIGHT); | ||
$printer -> text("Default width\n"); | ||
foreach(array(512, 256, 128, 64) as $width) { | ||
$printer -> setPrintWidth($width); | ||
$printer -> text("page width $width\n"); | ||
} | ||
|
||
/* Printer shutdown */ | ||
$printer -> cut(); | ||
$printer -> close(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+965 Bytes
(110%)
src/Mike42/Escpos/PrintBuffers/cache/Characters-DefaultCapabilityProfile.ser.z
Binary file not shown.
Binary file modified
BIN
+965 Bytes
(110%)
src/Mike42/Escpos/PrintBuffers/cache/Characters-EposTepCapabilityProfile.ser.z
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+150 Bytes
(110%)
test/integration/resources/output/character-encodings.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
use Mike42\Escpos\EscposImage; | ||
|
||
class EscposImageTest extends PHPUnit_Framework_TestCase | ||
{ | ||
public function testImageMissingException() | ||
{ | ||
$this -> setExpectedException('Exception'); | ||
$img = EscposImage::load('not-a-real-file.png'); | ||
} | ||
public function testImageNotSupportedException() | ||
{ | ||
$this -> setExpectedException('InvalidArgumentException'); | ||
$img = EscposImage::load('/dev/null', false, array()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters