maximize printing area of client data
-
Dear friends!
Just need help to maximize the printing area of the client data at the invoice, like tagged at the imagem bellow: https://mlu0gdl3fyv4.i.optimole.com/w:auto/h:auto/q:mauto/process:3640/id:7017ef0e856ed9445791dba3e8fe5ad5/https://telecris.app/exemplo-impressao-print-invoice.png
As seen, the printing area is limited to the half of page. Just need to use all of the page weight. It occurred after several modificatons at the original code. At this point cannnot see anymore where I can adjust that. Thanks a lot!
Thank a lot!
The page I need help with: [log in to see the link]
-
Hi @dannwagner,
Thanks for providing the screenshot.
Could you please inform us of the paper size you are using for printing?
Additionally, can you confirm if you are utilizing the custom code mentioned below to meet this requirement? If not, we recommend trying the provided code snippet to see if the text prints correctly on the page.
You can insert this code snippet into the “functions.php” file of the currently active theme. Adjustments to the CSS code can also be made according to your needs.
/** * Print in 80mm size. */ function print_paper_resize() { ?> <style> /* CSS Media Queries for Print ------------------------------------------*/ @media print { body { font-size: 8.5pt; max-width: 80mm; margin: auto!important; font-weight: 550; } .shipping-address{ width:80%!important; } .billing-address{ width:70%!important; margin-bottom:1em!important; } h2,h3{ margin-bottom:0!important; } th{ padding-bottom:0!important; padding-left:0.5em!important; } td{ padding:0.35em 0.35em 0!important; } .order-addresses{ margin-bottom:1em!important; } .order-info li strong { font-weight:600!important; display:inline!important; padding-right:1.4em!important; } .order-info{ margin-bottom:0!important; } .order-branding{ margin-bottom:0!important; } .product-quantity, .total-quantity{ padding-left:1.8em!important; } .includes_tax { white-space:nowrap!important; } .content { /* Remove padding to not generate empty follow up pages */ padding-bottom: 0; } } </style> <?php } add_action( 'wcdn_head', 'print_paper_resize', 10, 1 );
Please check and let us know if this code snippet helps you to print the text correctly or not.
thanks a lot for the code! it helped a lot to improve using less paper! but still the cliente address is using half of page. I am sending you all the code is modificated for it. Maybe you can identify whats is causing it. thanks a lot! also sendind a new print of how it is working now!
/**
- para regular as margens da impress?o da folha
- mudar os dados margin left e right
*/
function example_serif_font_and_large_address() {
?> <style> #page { font-size: 1.5em; font-style: bold; font-family: arial, serif; column-width: 5500mm; column-gap: 2000mm; margin-left: 1mm; margin-right: 10mm; line-height: 100%; font-weight: bold; font-weight: capitalize; } .order-addresses address { font-size: 1.4em; line-height: 99%; font-weight: bold column-width: 950mm; } .wcdn_head { font-size: 0.5em; line-height: 99%; font-weight: bold display: none; } </style> <?php
}
add_action( ‘wcdn_head’, ‘example_serif_font_and_large_address’, 20 );
function Remove_shipping_address() {
?> <style> .order-addresses .shipping-address { display: none; } </style> <style> .order-addresses .billing-address .state { display: none; } </style> <style> .order-addresses .billing-address .billing_number { display: none; } </style> <style> .billing-address .state { display: none; } </style> <style> .order-addresses .billing-address .state { display: none; } </style> <style> .order-addresses .head-price { display: none; } </style> <?php
}
add_action( ‘wcdn_head’, ‘Remove_shipping_address’, 20);
function Remove_head_price() {
?> <style> .head-item-price { display: none; } </style> <style> .product-item-price { display: none; } </style> <style> .order-items .product-name { width: 50%; column-width: 2000mm; column-rule-width: 1000; margin-right: 100mm; font-weight: bold; font-size: 1.4em; } </style> <style> .order-items .head-name { width: 50%; column-width: 2950mm; margin-right: 150mm; font-weight: bold; } </style> <style> .order-items .product-price { width: 50%; column-width: 2000mm; column-rule-width: 1000; margin-right: 100mm; font-weight: bold; font-size: 1.3em; line-height: 100%; } </style>
<style> .order-items .total-quantity { display: none; } </style> <style> .order-items .product-quantity { font-weight: bold; font-weight: italic; font-size: 1.9em; margin-left: 1500mm; column-gap: align-items; padding-left: 20mm; } </style> <style> .order-items .shipped_via { display: none; } </style> <?php
}
add_action( ‘wcdn_head’, ‘Remove_head_price’, 20);
add_filter( ‘wcdn_order_item_fields’, ‘wcdn_remove_sku’, PHP_INT_MAX, 3 );
function wcdn_remove_sku( $fields, $product, $order ) {
unset( $fields['sku'] ); return $fields;
}
function example_logo_with() {
?> <style> .order-branding .company-logo img { width: 300px; height: auto; column-width: 950mm; } </style> <?php
}
add_action( ‘wcdn_head’, ‘example_logo_with’, 20 );
/**
- Add this code snippet in functions.php file of your currently active theme.
- Hide invoice title in invoice print.
*/
function hide_print_invoice_title( $title ) {
if ( strtolower( $title ) === ‘fatura’ ) {
return ”;
}
return $title;
}
add_filter( ‘wcdn_document_title’, ‘hide_print_invoice_title’ );function hide_print_invoice_country( $country ) {
if ( strtolower( $country ) === ‘brasil’ ) {
return ”;
}
return $country;
}
add_filter( ‘wcdn_document_country’, ‘hide_print_invoice_country’ );function hide_shipping( $shipping_method ) {
if ( strtolower( $shipping_method ) !== ‘@’ ) {
return ”;
}
return $shipping_method;
}
add_filter( ‘wcdn_shipping_method’, ‘hide_shipping’ );HERE IS THE PRINT
Dear friend! Please ignore what I have written above. Made a simples change at the code as bellow (width to 150%) and the address is now all at the width, its fine! There is a print bellow. Just need to adjust the right side of the printed invoice, because it is cutting lik 0.4mm of this side, as you can see:
.billing-address{
width:150%!important;Hi @dannwagner,
Sorry for the delay in response to this.It appears that you are attempting to print on a POS machine. Unfortunately, we do not have a POS machine available to test and provide a solution for you. However, we have previously provided you with a custom code for printing on 80mm paper size which should be functioning correctly. If any filters are not working as intended, you can adjust them in the “style.css” file located at woocommerce-delivery-notes/template/print-order/style.css.
You can modify the width under the class .billing-address at this location: https://prnt.sc/J5XHYSXIdD_- and see if it helps meet your requirements.
Please feel free to reach out if you have any further questions or concerns.
Hi there guys! I waited so much to reach this and the printscreen isnt available anymore. Can you send it again, please? Thx a lot!
Hi @dannwagner,
Do you mean the screenshot I sent you in the previous response is not accessible to you?
If yes, then here I’m sending the screenshot again: https://app.screencast.com/wJbr0F1JNZkqZ
Please let me know if I have misunderstood it.
- You must be logged in to reply to this topic.