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

A5W to PDF

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

    A5W to PDF

    I have some A5W pages that are very custom reports. Is there any way to send the html it creates as a PDF?

    #2
    Re: A5W to PDF

    The a5w page in this instance would work just like an HTML page for printing purposes.

    If you can print to a PDF from your browser, you should be able to print your a5w page to a PDF. (May require Adobe Acrobat or similar software)

    Alternatively, rewrite the page in a report and then run the report to get your PDF.

    Comment


      #3
      Re: A5W to PDF

      Yeah, the problem is that the html document is about 450-500 pages long. Firefox and Chrome seem to hang when I try to print them.

      I have tried using the report writer and it isn't as flexible as I need for these reports, LOTS of SQL lookups and custom functions and calculations in them.

      Comment


        #4
        Re: A5W to PDF

        Originally posted by Sparticuz View Post
        I have some A5W pages that are very custom reports. Is there any way to send the html it creates as a PDF?
        If you want to convert web page (url) directly to pdf try CutyCapt. It is easy to use and fast.

        edit: 450-500 pages is too much for this tool. So forget.

        Comment


          #5
          Re: A5W to PDF

          I think I'm looking for a way that Alpha can do it in xbasic, maybe I can hook into the report.saveas function somehow. Another avenue I'm exploring is this: http://www.fpdf.org/ , but my initial, quick install and test didn't work. I will look more into this, but more suggestions welcome.

          Comment


            #6
            Re: A5W to PDF

            Originally posted by Sparticuz View Post
            I think I'm looking for a way that Alpha can do it in xbasic, maybe I can hook into the report.saveas function somehow. Another avenue I'm exploring is this: http://www.fpdf.org/ , but my initial, quick install and test didn't work. I will look more into this, but more suggestions welcome.
            Just info: You use CutyCapt of course with xbasic.

            Comment


              #7
              Re: A5W to PDF

              My guess is that Alpha isn't your problem, it's the size of the web page. Trying to convert 500 pages of html code into a PDF is probably not going to work no matter what you do.

              Can't you break it down into smaller chunks?

              Comment


                #8
                Re: A5W to PDF

                Originally posted by lgrupido View Post
                My guess is that Alpha isn't your problem, it's the size of the web page.
                Agreed, It is the web browser breaking down. It's probably hitting some kind of upper file size limit. I am also looking into breaking the file down into manageable segments, BUT I also want to be able to do this for single page documents.

                Comment


                  #9
                  Re: A5W to PDF

                  Use your xbasic scripts that you already wrote to produce the report, but instead of writing the results to html, write those to a temp table, then use the report generator to create the report based on that temp table.
                  Gary S. Traub, Ph.D.

                  Comment


                    #10
                    Re: A5W to PDF

                    +1 for drgarytraubs answer

                    Just have a
                    custom_report_html table

                    report_id
                    report_html

                    ASSUMING ALPHA ALLOWS FOR OUTPUT BUFFERING:

                    Start a bufffer, write your page content then dump your buffer into the database . Here is php: http://stackoverflow.com/questions/3...html-to-server
                    Code:
                    <?php
                    // Start the buffering //
                    ob_start();
                    ?>
                    Your page content bla bla bla bla ...
                    
                    <?php
                    echo '1';
                    
                    // Get the content that is in the buffer and put it in your file //
                    file_put_contents('yourpage.html', ob_get_contents());
                    ?>
                    Your code
                    Code:
                    <%a5 startbufferfunction(); 'whatever this is %>
                    page content goes here
                    
                    <%a5 
                    dim report_html as C=getbuffercontents() 'whatever this function may be in alpha
                    
                    'note - connection establish and sql execute not shown - only sql statement
                    dim args as SQL::Arguments
                    args.set("report_html",report_html)
                    dim sql as C="INSERT INTO report_table (html) VALUES (:report_html)"
                    
                    dim new_report_id as N=conn.LastInsertedIdentity() 
                    response.redirect("serve_my_report.a5w?rid="+new_report_id) 'redirect to a page that will call the necessary xbasic to create the pdf from the a5 report writer
                    end
                     %>
                    Scott Moniz - Computer Programmer/Analyst
                    REA Inc.
                    http://reainc.net
                    (416)-533-3777
                    [email protected]

                    REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
                    If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
                    contact us to discuss options.

                    Comment


                      #11
                      Re: A5W to PDF

                      Yeah, thanks for prototyping it. After drgarytraub posted that, That was exactly what I was thinking. Shouldn't be too difficult. What I do for the output buffering is write everything to a dim html as c, then ?html at the end of the page. I also get the added benefit of having a table with all the reports backed up historically with a table.

                      Comment


                        #12
                        Re: A5W to PDF

                        No Problem.
                        Do you know the current alpha equivalent to ob_start and ob_get_contents?

                        Can I see a simple example of how you buffer output? (For knowledge/curiosities sake)

                        Thanks,
                        Scott
                        Scott Moniz - Computer Programmer/Analyst
                        REA Inc.
                        http://reainc.net
                        (416)-533-3777
                        [email protected]

                        REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
                        If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
                        contact us to discuss options.

                        Comment


                          #13
                          Re: A5W to PDF

                          Code:
                          'Set up the header
                          dim content as c = "<!DOCTYPE html>"+crlf()+"<html lang='en' class='mailer'>"+crlf()+"<head>"+crlf()+"<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />"+crlf()
                          *concat(content,"<title>"+report_title+"</title>"+crlf())
                          *concat(content,"<link rel='stylesheet' href='css/table.css' />"+crlf()+"</head><body>"+crlf())
                          'finish setting up the page, then at the end
                          *concat(content,"</body></html>")
                          ?content

                          Comment


                            #14
                            Re: A5W to PDF

                            Ah Gotcha, Ive used that method before.

                            I was trying to see if there was something along the lines of inbuilt buffering which didnt require you to constantly be concating to a variable.

                            In Php you could do something like.... (xbasic code shown, with php principle)
                            Code:
                            <%a5 startbuffer() %>
                            <html>
                            <head>
                            </head>
                            <body>
                            Test
                            <%a5 ?"more xbasic code goes here" %>
                            </body>
                            </html>
                            
                            <%a5 'dim output as C=buffer_contents()
                                     'OR
                                     '?buffer_contents()
                                     'OR
                                     ' write buffer_contents() to a file/db
                             %>

                            This allows you to write html between tags without having to concat every single line of html.
                            Concating every single line of html is time-costly, and then you have to escape ", and - just headaches.

                            :) If you ever find those buffer methods, let me know!

                            Thanks,
                            Scott
                            Scott Moniz - Computer Programmer/Analyst
                            REA Inc.
                            http://reainc.net
                            (416)-533-3777
                            [email protected]

                            REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
                            If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
                            contact us to discuss options.

                            Comment


                              #15
                              Re: A5W to PDF

                              http://msgboard.alphasoftware.com/al...856#post654856

                              From Lenny:
                              *obstart()*
                              Output buffering is always used, so it is effectively like having ob_start() at the top of every PHP page. There is no function call needed and no way to change this behavior.

                              *ob_get_contents()*
                              Response.OutputStream contains the buffered output. This is 100% identical to ASP.Net's OutputStream property (http://msdn.microsoft.com/en-us/libr...putstream.aspx). Here is a simple A5W page to show how to read from it along with a couple of other properties:

                              Code:
                              ---------
                              Code:
                              <%a5
                              ? "This is the first line of output<br/>" + crlf()
                              
                              ?"Readable: <b>" + Response.OutputStream.CanRead + "</b><br/>" + crlf()
                              ?"Length: <b>" + Response.OutputStream.Length + "</b><br/>" + crlf()
                              
                              dim OutputBufferContents as b
                              OutputBufferContents = Response.OutputStream.ToArray()
                              
                              
                              ? "The output so far is:"+OutputBufferContents 'I changed this line to make the example output a little more simple
                              %>
                              So for your application at the very bottom of your page I would do something like this:
                              Code:
                              <%a5
                                   if Response.OutputStream.CanRead then
                                             dim contents as B=Response.OutputStream.ToArray()
                                             'insert into mytable (html_field) VALUES (:html)
                                             'dim args as SQL::Arguments
                                             'args.set("html",contents) 'you might have to do convert_type(contents,"C") to convert to string, but maybe you can store the raw byte array
                                   else
                                             ?"CANNOT READ OUTPUT STREAM"
                                   end if
                              %>
                              Last edited by aburningflame; 09-06-2013, 12:33 PM.
                              Scott Moniz - Computer Programmer/Analyst
                              REA Inc.
                              http://reainc.net
                              (416)-533-3777
                              [email protected]

                              REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
                              If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
                              contact us to discuss options.

                              Comment

                              Working...
                              X