Does anyone have an Envelope Printing module ?

Does anyone have an Envelope Printing module ?

Postby Rick Lipkin » Fri Mar 01, 2024 4:10 pm

To All

I have a Customer that I have built a Contact database .. and my customer is replacing a Sage product and the Sage product has an envelope Printing module for various size envelopes .. I was hoping someone may have a pre-built Envelope printing FW code module that I can chose to print multiple size envelopes ... ??

I would be very grateful for any contrinutions ..

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Does anyone have an Envelope Printing module ?

Postby Otto » Fri Mar 01, 2024 4:43 pm

Hello Rick,
I would use HTML and webview.
Best regards,
Otto

Image


Code: Select all  Expand view  RUN


function Main()

   local oWebView := TWebView():New(1)
local cHtml := memoread( "c:\fwh2023\samples\envelope.html" )
 
   oWebView:SetHtml( cHtml )
   
   oWebView:SetTitle( "Microsoft Edge WebView working from FWH" )
   oWebView:SetSize( 1200, 800 )
   oWebView:SetUserAgent( "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Mobile Safari/537.36" )
   sleep( 600 )
   oWebView:Run()
   oWebView:Destroy()

return nil


 



and the HTML file:



Code: Select all  Expand view  RUN


<!DOCTYPE html>
<html lang="de">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Umschlagdruckmodul</title>
  <link rel="shortcut icon" href="icons/azzomax.ico">
  <!-- Bootstrap CSS -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
  <!-- jQuery und jQuery UI -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
  <!-- Bootstrap JS -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
</head>
<body>
  <div class="container">
    <h2>Umschlagdruckmodul</h2>
    <form id="envelopeForm">
      <div class="mb-3">
        <label for="envelopeSize" class="form-label">Umschlaggröße:</label>
        <select class="form-select" id="envelopeSize">
          <option value="C4">C4</option>
  <option value="C5">C5</option>
  <option value="C6">C6</option>
  <option value="DL">DL</option>
  <option value="A4">A4</option>
  <option value="Letter">Letter</option>
          <select class="form-select" id="envelopeSize">

</select>

        </select>
      </div>
      <button type="button" class="btn btn-primary" id="printButton">Drucken</button>
    </form>
  </div>

  <script>
    $(document).ready(function() {
      $('#printButton').click(function() {
        var size = $('#envelopeSize').val();
        var content = prepareContent(size);
     
        printEnvelope(content);
      });

      function prepareContent(size) {
  var address = "Max Mustermann<br>Musterstraße 123<br>12345 Musterstadt";
  var returnAddress = "Return: Musterfirma GmbH<br>Kurzweg 2<br>12345 Musterstadt";
  var sizeText = "Größe: " + size;

  var content = '<div style="font-family: Arial, sans-serif; padding: 20px;">' +
                '<p><strong>' + returnAddress + '</strong></p>' +
                '<h2 style="text-align: center; margin-top: ';

  // Größenabhängige Anpassungen
  switch(size) {
    case 'C4':
      content += '200px;">';
      break;
    case 'C5':
      content += '150px;">';
      break;
    case 'C6':
      content += '100px;">';
      break;
    case 'DL':
      content += '120px;">';
      break;
    case 'A4':
      content += '250px;">';
      break;
    case 'Letter':
      content += '240px;">';
      break;
    default:
      content += '150px;">';
  }

  content += address + '</h2>' +
             '<p style="position: absolute; bottom: 20px; right: 20px;">' + sizeText + '</p>' +
             '</div>';
  return content;
}


      function printEnvelope(content) {
       
        var printWindow = window.open('', '', 'height=600,width=800');
        printWindow.document.write('<html><head><title>Umschlag Drucken</title>');
        printWindow.document.write('</head><body >');
        printWindow.document.write(content);
        printWindow.document.write('</body></html>');
        printWindow.document.close();
        printWindow.print();
      }
    });
  </script>
</body>
</html>


 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: Does anyone have an Envelope Printing module ?

Postby karinha » Fri Mar 01, 2024 7:37 pm

Good afternoon Rick, what do you use? WORD to print? Is this Envelope printing for Direct Mail? Explain better, please.

Buenas tardes Rick, ¿qué usas? WORD para imprimir? ¿Este Envelope se imprime para correo directo? Explícate mejor, por favor.

Gracias, thanks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Does anyone have an Envelope Printing module ?

Postby Otto » Fri Mar 01, 2024 8:57 pm

Dear Joao,
We use Word and Outlook extensively with our software. However, we are preparing because we believe that the automation we have done so far (ActiveX) will not be supported by Word and Office in the future. It is already difficult to buy appropriate versions for Remote Desktop, for example.

Consider using APIs (Application Programming Interfaces) instead of ActiveX for integration with Office applications. Microsoft, for example, offers the Office 365 API. We are starting with that now.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: Does anyone have an Envelope Printing module ?

Postby Rick Lipkin » Fri Mar 01, 2024 10:22 pm

Gentleman

I have a customer that had a contact database in SAGE and SAGE has quit supporting their Contact info of products. I was fortunant enough to export my Customers data into an Excel file which I imported into MS Access. I have all the usual fields like

Company
Contact
Street
City, State and Zipcode

In my Customers old Sage Product it allowed him to print envelops in all the Standard sizes and I was hoping Someone had an Envelope routine that I could select a "standard size" and print a return address on the Left Side and Center the Company name, Contact, Address, City and state in the Center right of the Envelope.

My printer does not accept envelopes, just Standard paper and I guess I can test print on plain paper .. but it would be nice if I did not have to re-invent the "wheel" ... I would appreciate any Envelope printing routines anyone might like to donate for a good cause ..

I can embelish the field names .. it is the layout for multiple envelope sizes that present a nightmare for me ..

Thanks to All

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Does anyone have an Envelope Printing module ?

Postby Otto » Fri Mar 01, 2024 11:26 pm

Rick,
expand the WebView example, then you will be pioneering work for the group and not reinventing the "wheel".
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: Does anyone have an Envelope Printing module ?

Postby karinha » Sat Mar 02, 2024 12:31 pm

Otto wrote:Dear Joao,
We use Word and Outlook extensively with our software. However, we are preparing because we believe that the automation we have done so far (ActiveX) will not be supported by Word and Office in the future. It is already difficult to buy appropriate versions for Remote Desktop, for example.

Consider using APIs (Application Programming Interfaces) instead of ActiveX for integration with Office applications. Microsoft, for example, offers the Office 365 API. We are starting with that now.
Best regards,
Otto


Good morning Master Otto. I'm sure you're right. But I think it's difficult to help Mr. Rick, as I've never seen anything about printing envelopes, either on a desktop or via webview. I always printed labels that were placed on the envelope, but directly on the envelope, I never saw anything. Perhaps, if Mr. Rick had an image of how to print, it would help. Or maybe there is a specific printer model for this...

Buenos días Maestro Otto. Estoy seguro de que tienes razón. Pero creo que es difícil ayudar al Sr. Rick, ya que nunca he visto nada sobre la impresión de Envelopes, ni en una computadora de escritorio ni a través de la vista web. Siempre imprimía etiquetas que se colocaban en el Envelope, pero directamente en el Envelope, nunca vi nada. Quizás, si el Sr. Rick tuviera una imagen de cómo imprimir, sería útil. O tal vez haya un modelo de impresora específico para esto...

https://www.youtube.com/watch?v=Ge94bDA7LDw

Gracias, thanks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Does anyone have an Envelope Printing module ?

Postby TimStone » Sat Mar 02, 2024 9:28 pm

Rick,

Envelopes load into ( adjustable ) paper trays, face down, seal to the right. They would print in landscape mode.

I think that could be done very easily. What sizes does your client currently use ? We could start with those, and then expand.

Since I work with the Printer class a lot, I believe I can actually create this quickly. I put it on my Agenda to do it Monday, and then after testing, I will post it here. Most envelopes are pretty standard, and you can easily print it on regular paper to test it.

Your client will need to have a printer that will feed envelopes. Otherwise they would have to manually hand feed them, and that would be very slow.

Personally, I use a Demo label printer, and it was easy to program that from FW. The only complication is finding the right way to print the address barcode. I researched it a few years back but didn't bother to implement it. That would make sending the envelopes faster. Otherwise the PO has to feed them through a machine that prints the barcodes IF it can read the address.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Does anyone have an Envelope Printing module ?

Postby Rick Lipkin » Mon Mar 04, 2024 2:03 pm

Tim

I had a meeting with my Client last Friday and he is not really so concerned with automating envelopes .. He tells me he just cuts and pastes the address into Word and then prints his envelope and an automated envelope routine would be nice to have but not a requirement ..

I plan on expermenting with creating something that prints on plain paper and matching the text up to fit certain size envelopes ..

Thanks for everyones suggestions ..

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Does anyone have an Envelope Printing module ?

Postby TimStone » Mon Mar 04, 2024 6:30 pm

Rick,

I still plan to create the routine ... already have it mapped out in my mind, and am confident it should be easy.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Does anyone have an Envelope Printing module ?

Postby Rick Lipkin » Mon Mar 04, 2024 9:00 pm

Tim

Thank you ... I would be most honored if you would share your code with me when you get a chance ..

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 100 guests