Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

PDF from HTML - Send to Xbasic and email.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PDF from HTML - Send to Xbasic and email.

    First post. I did have a speech prepared heaping praise upon all you regulars for providing such a valuable resource of knowledge - but worried I may lose your interest with my ramblings. Suffice to say, help me with what could be a minor problem and much praise will be heaped.

    With help from forum member Ricky, my little project successfully sends reports via email (Mandrill). I understand the xbasic code used -Similar to Selwyn's video.

    My dilemma right now is the action javascript function of "pdf from HTML" or even "Absolute Layout Container - Create PDF". Selwyn comes tantalizing close in his other video - but in that, the choice selected was Download. Other posts here also skirted around this function.

    What I need to do is send the pdf to an xbasic function to email the pdf. And I guess I'm using a twisted version of "Whats good for the goose.....etc." I'm looking at this the same way as "Open Report, Letter, Layout" and sending it to an xbasic function. But, unless I'm mistaken, this is not the same approach.

    After hours of trial and error, i scaled back the function so all it does is debug(1). Thats when I realized the function wasn't even being called/fired. I've tried appending (), appending (e), appending (e.filename) etc.. to no avail. I was beginning to think I may have a corrupted installation of AA (happened before). But an install on another computer had the same result.

    I feel guilty asking any of you for code....just a nudge in the right direction about how to call this function (that I will create) correctly.

    Thanks for reading.Untitled.png

  • #2
    Re: PDF from HTML - Send to Xbasic and email.

    Ok So i've thrown this issue out to Elance / Upwork. 2 of the experts have already suggested that I ditch the function altogether and use the tried and tested "Open a Report, Label,Letter etc..." because they couldnt get any xbasic function to fire using either "Pdf from HTML" or "Absolute Layout Container - Create PDF".

    I have one last candidate but this is looking more and more like a bug issue ? Really ?

    Untitled.png

    Comment


    • #3
      Re: PDF from HTML - Send to Xbasic and email.

      I'm confused: You want to generate a PDF file from some HTML source and then e-mail that PDF? Is that correct? If so this may be of some help: http://wkhtmltopdf.org/
      Mike Brown - Contact Me
      Programmatic Technologies, LLC
      Programmatic-Technologies.com
      Independent Developer & Consultant

      Comment


      • #4
        Re: PDF from HTML - Send to Xbasic and email.

        Thanks for replying Mike. I'm just trying to use the built-in Action Javascript function "HTML to PDF" or even "Absolute Layout Container - Create PDF" which Selwyn https://www.youtube.com/watch?v=IVCHP3outww describes in this video. (but in the video, he chooses to download the pdf.)

        Even in the description of the function which I have attached previously (sorry it went to inline) states " Grab the HTML in a container and convert to PDF. Then download the PDF file, or call a custom Xbasic function to process the file. For example, the Xbasic function can send an e-mail with the file as an attachment"

        Yet no matter what the Xbasic is/does....its not getting fired.

        Comment


        • #5
          Re: PDF from HTML - Send to Xbasic and email.

          Even the download feature of the pdf is not capturing the signature once it is downloaded.

          Comment


          • #6
            Re: PDF from HTML - Send to Xbasic and email.

            The solution for now is to create a report (predefined) then use the xbasic function that you know to convert the report and send it as an email because it is working very well. Why would you look for another solution that is not working? Even the donwload that Selwyn suggested on the video is not capturing the Signature that you want to send.

            Comment


            • #7
              Re: PDF from HTML - Send to Xbasic and email.

              Code found on one of the tutorial by Selwyn

              function xbsendEmail as c (e as p)
              'This function is called after the report has printed
              'The e object that is passed in includes:
              'e.tmpl - the component definition
              'e.dataSubmitted - data from the component
              'e.fileSessionKey - the key where the binary data for the report that was printed is stored in session storage.

              'The function can return Javascript to execute in the browser.

              'Using the e.fileSessionKey value you can retrieve the binary data for the report
              'For example
              'dim b as b
              'session.GetDataFromFile(b,e.fileSessionKey)
              'dim size as n
              'size = b.size()
              'if size = 0 then
              '' ---- there must have been an error - no data was retrieved
              'end if


              'Sample code to e-mail the report using the Mandril email service -----
              dim key as c
              key = e.fileSessionKey
              dim b as b
              'get the binary day for the report
              session.GetDataFromFile(b,key)
              dim size as n
              size = b.size()
              if size = 0 then
              xbsendEmail = "alert('Report was not sent.');"
              exit function
              end if
              'If you don't have a Mandrill secret key, sign up at Mandrill.com
              dim mysecretkey as c = "WlgtKV0HJF_bWoiQxspc3Q" 'if you leave this blank the key value is read from a setting in Project Properties
              dim ms as p
              ms.send_to = "[email protected]"
              ms.from_email = "[email protected]"
              ms.subject = "Test Email"
              ms.message_html = "Content"
              dim ms.attachmentsArray[1] as p
              ms.attachmentsArray[1].name = "YourPDFFilename.pdf" 'if the report was an html report, use the .html extension
              ms.attachmentsArray[1].type = resolve_mime_type("pdf") 'if the report was an html report, use the 'html'
              ms.attachmentsArray[1].content = base64encode(b)
              dim pResult as p
              pResult = email_send_mandrill(mysecretkey,ms)
              if pResult.error = .f. then
              xbsendEmail = "alert('Report sent.');"
              else
              __name = "alert('Report was not sent.');"
              end if
              end function

              Link: http://www.screencast.com/users/Door...b-b230199daab6
              Last edited by JetLi; 09-22-2015, 01:17 AM.

              Comment


              • #8
                Re: PDF from HTML - Send to Xbasic and email.

                Thank you for all replies.Xbasic function is Ok.But here xbasic function is not getting call.


                Originally posted by JetLi View Post
                Code found on one of the tutorial by Selwyn

                function xbsendEmail as c (e as p)
                'This function is called after the report has printed
                'The e object that is passed in includes:
                'e.tmpl - the component definition
                'e.dataSubmitted - data from the component
                'e.fileSessionKey - the key where the binary data for the report that was printed is stored in session storage.

                'The function can return Javascript to execute in the browser.

                'Using the e.fileSessionKey value you can retrieve the binary data for the report
                'For example
                'dim b as b
                'session.GetDataFromFile(b,e.fileSessionKey)
                'dim size as n
                'size = b.size()
                'if size = 0 then
                '' ---- there must have been an error - no data was retrieved
                'end if


                'Sample code to e-mail the report using the Mandril email service -----
                dim key as c
                key = e.fileSessionKey
                dim b as b
                'get the binary day for the report
                session.GetDataFromFile(b,key)
                dim size as n
                size = b.size()
                if size = 0 then
                xbsendEmail = "alert('Report was not sent.');"
                exit function
                end if
                'If you don't have a Mandrill secret key, sign up at Mandrill.com
                dim mysecretkey as c = "WlgtKV0HJF_bWoiQxspc3Q" 'if you leave this blank the key value is read from a setting in Project Properties
                dim ms as p
                ms.send_to = "[email protected]"
                ms.from_email = "[email protected]"
                ms.subject = "Test Email"
                ms.message_html = "Content"
                dim ms.attachmentsArray[1] as p
                ms.attachmentsArray[1].name = "YourPDFFilename.pdf" 'if the report was an html report, use the .html extension
                ms.attachmentsArray[1].type = resolve_mime_type("pdf") 'if the report was an html report, use the 'html'
                ms.attachmentsArray[1].content = base64encode(b)
                dim pResult as p
                pResult = email_send_mandrill(mysecretkey,ms)
                if pResult.error = .f. then
                xbsendEmail = "alert('Report sent.');"
                else
                __name = "alert('Report was not sent.');"
                end if
                end function

                Comment


                • #9
                  Re: PDF from HTML - Send to Xbasic and email.

                  Originally posted by Parveen View Post
                  Thank you for all replies.Xbasic function is Ok.But here xbasic function is not getting call.
                  Here is the link to call the xbasic Function : http://www.screencast.com/users/Door...b-b230199daab6

                  Pls. note. An alternative only.
                  1 Create a report
                  2 follow the one on the image to call the xbasic function

                  Comment


                  • #10
                    Re: PDF from HTML - Send to Xbasic and email.

                    Originally posted by mikeallenbrown View Post
                    I'm confused: You want to generate a PDF file from some HTML source and then e-mail that PDF? Is that correct? If so this may be of some help: http://wkhtmltopdf.org/
                    Me too. I'm so confused. What could be the reason? Hmmmmmm.

                    Comment


                    • #11
                      Re: PDF from HTML - Send to Xbasic and email.

                      I submitted a bug report late last night along with Juniper, who's been helping me with this. Woke up this morning to response from Selwyn along with a patch !

                      It was indeed a bug and after applying the patch all works well. Being new to this...surely there are no restrictions to me redistributing the patch ?
                      Glad its resolved, and hope to help others who stumble upon this page....but after the next stable release, well...I hope my thread is removed...

                      -Dave

                      Comment


                      • #12
                        Re: PDF from HTML - Send to Xbasic and email.

                        a
                        Last edited by JetLi; 09-24-2015, 02:48 AM.

                        Comment


                        • #13
                          Re: PDF from HTML - Send to Xbasic and email.

                          b
                          Last edited by JetLi; 09-24-2015, 02:48 AM.

                          Comment


                          • #14
                            Re: PDF from HTML - Send to Xbasic and email.

                            I know this is an old thread, but since Mandrill has stopped their free access to send emails, does anyone have the correct code to send a attached report via SMTP email? I can get an email to be sent using SMTP but it will not send the attachment.
                            Here is my Xbasic Function....
                            ----------------------------
                            function emailreport as c (e as p)

                            dim key as c
                            key = e.filesessionKey
                            dim b as b
                            session.GetDataFromFile(b,key)
                            dim size as n
                            size = b.size()
                            if size = 0 then
                            emailreport = "alert('Report was not sent.');"
                            exit function
                            end if
                            dim pm as P
                            dim ms as P
                            if (email_smtp_open(ps ,"mail.mydomain.com" ,26 ,"username" ,"password" ,"None")) then
                            pm.to = "[email protected]"
                            pm.from = "[email protected]"
                            pm.subject = "New Review"
                            pm.html_message = "Please proof read this review"
                            pm.attachmentsArray[1].name = "new-review.pdf" 'if the report was an html report, use the .html extension
                            pm.attachmentsArray[1].type = resolve_mime_type("pdf") 'if the report was an html report, use the 'html'
                            pm.attachmentsArray[1].content = base64encode(b)

                            email_smtp_send(pm, ps)
                            end if
                            email_smtp_close(ps)
                            end function
                            -----------------------------------
                            Thanks, Dan

                            Comment


                            • #15
                              Re: PDF from HTML - Send to Xbasic and email.

                              My friend lost a customer because of this bug in Alpha. the client asked him to solve how to send to xbasic and email, he tried to look for solution for hours but could not find out how to make it work, he then created an alternative, but the client refuse to pay because it is not what he wants, only to find out that he could not do it because of an alpha bug. Worse thing he can't download the patch because it is for current subscribers only. So...... there goes my friends client, he refunded the payment of the client because the client got angry for being charged with an alternative solution.
                              Last edited by JetLi; 03-31-2016, 07:59 AM.

                              Comment

                              Working...
                              X