Add #10 envelope printing option
@ -3,7 +3,7 @@
|
|||||||
<div class="copyright">
|
<div class="copyright">
|
||||||
<a href="{{site_root}}refunds">Refund Policy and Instructions</a>
|
<a href="{{site_root}}refunds">Refund Policy and Instructions</a>
|
||||||
<br />
|
<br />
|
||||||
© 2021-2023 <a href="https://postalportal.net">PostalPortal LLC</a>.<br>
|
© 2021-2025 <a href="https://postalportal.net">PostalPortal LLC</a>.<br>
|
||||||
Developed and hosted by <a href="https://netsyms.com">Netsyms Technologies</a>.
|
Developed and hosted by <a href="https://netsyms.com">Netsyms Technologies</a>.
|
||||||
<br />
|
<br />
|
||||||
<a href="https://postalportal.net/#contact">Contact Us</a>
|
<a href="https://postalportal.net/#contact">Contact Us</a>
|
||||||
|
@ -181,7 +181,7 @@
|
|||||||
<input id="postagetype_plain" type="radio" name="postageservice" value="plain" />
|
<input id="postagetype_plain" type="radio" name="postageservice" value="plain" />
|
||||||
<label for="postagetype_plain"><b>No Extras</b>
|
<label for="postagetype_plain"><b>No Extras</b>
|
||||||
<br />
|
<br />
|
||||||
Make an envelope with no special features or signature.
|
Make an envelope with no special features or signature, just regular postage.
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -210,6 +210,13 @@
|
|||||||
Use a USPS-provided red and white Flat Rate envelope for Priority Mail. You can pick one up at any post office.
|
Use a USPS-provided red and white Flat Rate envelope for Priority Mail. You can pick one up at any post office.
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-4 col-12-small">
|
||||||
|
<input id="no10_envelope" type="checkbox" name="no10_envelope" value="no10_envelope" />
|
||||||
|
<label for="no10_envelope"><b>Print on an #10 Envelope</b>
|
||||||
|
<br />
|
||||||
|
If you want to print directly to a #10 envelope, select this option and we'll adjust the PDF accordingly.
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
@ -6,3 +6,9 @@ the options you choose. Click the image to get a PDF for a test print.
|
|||||||
<a href="{{site_root}}sample.pdf">
|
<a href="{{site_root}}sample.pdf">
|
||||||
<img src="{{site_root}}sample.png" alt="Sample" style="border: 1px solid #aaa; box-shadow: 0 3px 10px rgb(0 0 0 / 0.2); max-width: 100%;"/>
|
<img src="{{site_root}}sample.png" alt="Sample" style="border: 1px solid #aaa; box-shadow: 0 3px 10px rgb(0 0 0 / 0.2); max-width: 100%;"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
Sample for printing on a #10 envelope:
|
||||||
|
|
||||||
|
<a href="{{site_root}}sample_no10.pdf">
|
||||||
|
<img src="{{site_root}}sample_no10.png" alt="#10 sample" style="border: 1px solid #aaa; box-shadow: 0 3px 10px rgb(0 0 0 / 0.2); max-width: 100%;"/>
|
||||||
|
</a>
|
@ -113,7 +113,8 @@ function submitPayment() {
|
|||||||
"rateid": rateid,
|
"rateid": rateid,
|
||||||
"stripeid": result.paymentMethod.id,
|
"stripeid": result.paymentMethod.id,
|
||||||
"price": price,
|
"price": price,
|
||||||
"label_only": document.getElementById('label_only').checked ? "1" : ""
|
"label_only": document.getElementById('label_only').checked ? "1" : "",
|
||||||
|
"no10_envelope": document.getElementById('no10_envelope').checked ? "1" : ""
|
||||||
},
|
},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
timeout: 1000 * 30,
|
timeout: 1000 * 30,
|
||||||
|
@ -78,6 +78,9 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_REQUEST["flat_rate"]) && $_REQUEST["flat_rate"] == "flat_rate") {
|
if (!empty($_REQUEST["flat_rate"]) && $_REQUEST["flat_rate"] == "flat_rate") {
|
||||||
|
if (!empty($_REQUEST["no10_envelope"]) && $_REQUEST["no10_envelope"] == "no10_envelope") {
|
||||||
|
throw new Exception("You can't use your own envelope with Priority Mail Flat Rate. Use a USPS-provided Flat Rate envelope instead.");
|
||||||
|
}
|
||||||
$shipmentinfo["parcel"] = \EasyPost\Parcel::create([
|
$shipmentinfo["parcel"] = \EasyPost\Parcel::create([
|
||||||
"predefined_package" => "FlatRateEnvelope",
|
"predefined_package" => "FlatRateEnvelope",
|
||||||
"weight" => $weight
|
"weight" => $weight
|
||||||
|
BIN
source/static/papertemplate_no10.png
Normal file
After Width: | Height: | Size: 16 KiB |
82
source/static/papertemplate_no10.svg
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
source/static/papertemplate_no10_4x6_certified.png
Normal file
After Width: | Height: | Size: 34 KiB |
91
source/static/papertemplate_no10_4x6_certified.svg
Normal file
After Width: | Height: | Size: 111 KiB |
BIN
source/static/papertemplate_no10_certified.png
Normal file
After Width: | Height: | Size: 31 KiB |
142
source/static/papertemplate_no10_certified.svg
Normal file
After Width: | Height: | Size: 97 KiB |
@ -57,7 +57,37 @@ try {
|
|||||||
// load postage image
|
// load postage image
|
||||||
$labelimage = imagecreatefrompng($labelurl);
|
$labelimage = imagecreatefrompng($labelurl);
|
||||||
|
|
||||||
if ($shipment->postage_label->label_size == "4x6") {
|
$paperSize = "Letter";
|
||||||
|
$paperOrientation = "P";
|
||||||
|
if (!empty($_REQUEST["no10_envelope"]) && $_REQUEST["no10_envelope"] == "1") {
|
||||||
|
$paperSize = [9.5, 4.125];
|
||||||
|
$paperOrientation = "L";
|
||||||
|
if ($shipment->postage_label->label_size == "4x6") {
|
||||||
|
if (!empty($shipment->options->certified_mail)) {
|
||||||
|
// envelope with banner
|
||||||
|
$paperimage = imagecreatefrompng(__DIR__ . "/papertemplate_no10_4x6_certified.png");
|
||||||
|
} else {
|
||||||
|
// plain envelope
|
||||||
|
$paperimage = imagecreatefrompng(__DIR__ . "/papertemplate_no10.png");
|
||||||
|
}
|
||||||
|
$labelimage = imagerotate($labelimage, 270, 0);
|
||||||
|
imagecopyresampled($paperimage, $labelimage, 525, 19, 0, 0, 1200, 1800, 1200, 1800);
|
||||||
|
} else {
|
||||||
|
if (!empty($shipment->options->certified_mail)) {
|
||||||
|
// envelope with banner
|
||||||
|
$paperimage = imagecreatefrompng(__DIR__ . "/papertemplate_no10_certified.png");
|
||||||
|
imagecopyresampled($paperimage, $labelimage, 375, 190, 0, 0, 2100, 900, 2100, 900);
|
||||||
|
if ($shipment->options->delivery_confirmation == "SIGNATURE_RESTRICTED") {
|
||||||
|
$restrictedstamp = imagecreatefrompng(__DIR__ . "/restricted_delivery.png");
|
||||||
|
imagecopyresampled($paperimage, $restrictedstamp, 450, 825, 0, 0, 600, 225, 600, 225);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// plain envelope
|
||||||
|
$paperimage = imagecreatefrompng(__DIR__ . "/papertemplate_no10.png");
|
||||||
|
imagecopyresampled($paperimage, $labelimage, 375, 90, 0, 0, 2100, 900, 2100, 900);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ($shipment->postage_label->label_size == "4x6") {
|
||||||
if ((!empty($_REQUEST["label_only"]) && $_REQUEST["label_only"] == "1") || $shipment->parcel->predefined_package == "FlatRateEnvelope") {
|
if ((!empty($_REQUEST["label_only"]) && $_REQUEST["label_only"] == "1") || $shipment->parcel->predefined_package == "FlatRateEnvelope") {
|
||||||
if (!empty($shipment->options->certified_mail)) {
|
if (!empty($shipment->options->certified_mail)) {
|
||||||
// label and banner only
|
// label and banner only
|
||||||
@ -109,7 +139,7 @@ try {
|
|||||||
imagepng($paperimage, $tmpfile);
|
imagepng($paperimage, $tmpfile);
|
||||||
|
|
||||||
// Generate PDF from image
|
// Generate PDF from image
|
||||||
$pdf = new FPDF('P', 'in', 'Letter');
|
$pdf = new FPDF($paperOrientation, 'in', $paperSize);
|
||||||
$pdf->AddPage();
|
$pdf->AddPage();
|
||||||
$pdf->Image($tmpfile, 0, 0, -300, -300, "PNG");
|
$pdf->Image($tmpfile, 0, 0, -300, -300, "PNG");
|
||||||
|
|
||||||
|
BIN
source/static/sample_no10.pdf
Normal file
BIN
source/static/sample_no10.png
Normal file
After Width: | Height: | Size: 64 KiB |
202
source/static/sample_no10.svg
Normal file
After Width: | Height: | Size: 101 KiB |
BIN
source/static/sample_no10_300dpi.png
Normal file
After Width: | Height: | Size: 162 KiB |