1 2 Previous Next 22 Replies Latest reply on Jun 30, 2009 3:12 PM by 657571 Go to original post
      • 15. Re: Is there an inexpensive APEX report printer for invoices/checks/statements?
        692007
        Ok, good stuff.

        Copy your Oracle ODBC driver to the 'C:\apache-tomcat-5.5.12\webapps\birt\WEB-INF\platform\plugins\org.eclipse.birt.report.data.oda.jdbc_2.3.2.vxxxxxxxx\drivers' folder.
        Copy your report file ie. the .rptdesign file to 'C:\apache-tomcat-5.5.12\webapps\birt' folder.

        In your Apex application create a page, add a button link eg. an image type button with #IMAGE_PREFIX#/menu/printer_32.gif specified as the image. Specify the target as a URL with the following URL target :-
        javascript:popUp2('http://' + location.hostname + ':8089/birt/run?__report=YOUR_REPORT_NAME.rptdesign&__format=pdf');

        To pass a parameter to the report the URL target would be as follows :-
        javascript:popUp2('http://' + location.hostname + ':8089/birt/run?__report=YOUR_REPORT_NAME.rptdesign&PARAM1=&P116_ID.&__format=pdf');
        PARAM1 is the actual name of the parameter as defined in your BIRT report.

        Where P116_ID is a page item. You can obviously pass as many parameters as you like in URL following the same syntax for additional parameters. You can also create links in reports and use the # syntax to pass parameters. The 'location.hostname' bit makes testing and deployment easier as you don't have to hard code the IP address of the server running BIRT.

        Have a look at http://www.eclipse.org/birt/phoenix/deploy/viewerSetup.php and http://www.eclipse.org/birt/phoenix/deploy/viewerUsage.php for more info on the running and viewing of reports.

        Hope I haven't missed anything out.

        Good Luck.

        Vis Naidu
        • 16. Re: Is there an inexpensive APEX report printer for invoices/checks/stateme
          70824
          Vis Naidu wrote:
          In your Apex application create a page, add a button link eg. an image type button with #IMAGE_PREFIX#/menu/printer_32.gif specified as the image.
          Actually, there should be no slash between #IMAGE_PREFIX# and the directory: #IMAGE_PREFIX#menu/printer_32.gif
          • 17. Re: Is there an inexpensive APEX report printer for invoices/checks/statements?
            ApexNewbie
            Hello Martijnke,

            Based on your mail merge example, I was able to upload certain rtf files. But I have rather larger files that I want to upload. And when I attempt to do so, I get this error message: ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 6457, maximum: 2000)

            It seems to fail during the insert into the rtf table. Which is on this insert ...

            insert into rtf
            select id, name, filename, mime_type, doc_size, utl_raw.cast_to_varchar2(blob_content)
            from wwv_flow_files

            Do you know a workaround for this?

            Thanks!

            Annie
            • 18. Re: Is there an inexpensive APEX report printer for invoices/checks/statements?
              ApexNewbie
              I was wondering if anyone could provide some input to how to integrate PL-FPDF to Oracle Apex, I can't see to find any information online about it.
              Where would I get started?
              Thanks!
              Annie
              • 19. Re: Is there an inexpensive APEX report printer for invoices/checks/statements?
                TexasApexDeveloper
                Since it is just a pl/sql library to call I would think it should be pretty easy to use, however with no visual designer interface, it seems kinda hokey.. There are visual xsl editors available that when used with FOP/Cocoon will get you nice reports for $65 a Developer license plus the time to install setup Cocoon/FOP..

                Otherwise, you COULD post a message to the PL-FPDF authors site and ask him how to mesh APEX and PL-FPDF..
                Site is: http://www.erasme.org/PL-FPDF,1337

                Thank you,

                Tony Miller
                Webster, TX
                • 20. Re: Is there an inexpensive APEX report printer for invoices/checks/statements?
                  ApexNewbie
                  Great, I sent them a message, and I hope I can try to understand French, hehe

                  I guess they stopped allowing posts on their forums, I wish they would provide more support.

                  Thanks for you help Tony.
                  • 21. Re: Is there an inexpensive APEX report printer for invoices/checks/statements?
                    Binepal
                    if you look at

                    http://www.plpdf.com/simple_examples.html

                    syntax used is almost same other than the package name.

                    here is what i did( this is part of the code to give you idea )

                    ***********

                    BEGIN

                    FOR rec1 in cur1 loop l_comments := rec1.value_id; END LOOP;

                    FOR rec2 in cur2 loop l_strengths := rec2.value_id; END LOOP;

                    FOR rec3 in cur3 loop l_area_to_address := rec3.value_id; END LOOP;

                    --reset page margin

                    pl_fpdf.SetXY(pl_fpdf.GetX-4.5,pl_fpdf.GetY);

                    pl_fpdf.SetLeftMargin(pl_fpdf.GetX);

                    pl_fpdf.line(pl_fpdf.GetX,pl_fpdf.GetY+.5,pl_fpdf.GetX+12.625,pl_fpdf.GetY+.5);

                    pl_fpdf.Text(pl_fpdf.GetX,pl_fpdf.GetY+.75,'Comments:');

                    pl_fpdf.SetXY(pl_fpdf.GetX+.25,pl_fpdf.GetY+.875);

                    pl_fpdf.MultiCell(12.325,.25,l_comments,0,'L',0,0);

                    pl_fpdf.SetXY(pl_fpdf.GetX,pl_fpdf.GetY+.5);

                    pl_fpdf.line(pl_fpdf.GetX,pl_fpdf.GetY,pl_fpdf.GetX+12.625,pl_fpdf.GetY);

                    pl_fpdf.SetXY(pl_fpdf.GetX,pl_fpdf.GetY);

                    pl_fpdf.Text(pl_fpdf.GetX+2.9,pl_fpdf.GetY+.25,'Strengths');

                    pl_fpdf.Text(pl_fpdf.GetX+8.875,pl_fpdf.GetY+.25,'Areas to Address');

                    pl_fpdf.line(pl_fpdf.GetX+6.8125,pl_fpdf.GetY,pl_fpdf.GetX+6.8125,pl_fpdf.GetY+(21.59-.75-.25-pl_fpdf.GetY));

                    pl_fpdf.SetXY(pl_fpdf.GetX+.25,pl_fpdf.GetY+.375);

                    l_yPosition :=pl_fpdf.GetY;

                    pl_fpdf.MultiCell(6.375,.25,l_strengths,0,'L',0,0);

                    pl_fpdf.SetXY(pl_fpdf.GetX+7,l_yPosition);

                    pl_fpdf.MultiCell(5.65,.25,l_area_to_address,0,'L',0,0);

                    END;

                    ************

                    look at

                    http://www.fpdf.org/en/doc/index.php

                    this is the foundation on which this whole package is built

                    hope it help you

                    Edited by: binepal on Jun 11, 2009 2:26 PM
                    • 22. Re:Mail Merge method?
                      657571
                      Annie,
                      You're having trouble with large files.
                      I implemented this ages ago to use from Forms, and recently transcribed it to Apex.
                      I store the rtf file as a blob - so the upload (for me) is simply
                      insert into rtf
                      (module
                      ,content)
                      select filename
                      ,blob_content
                      from wwv_flow_files
                      where ....

                      so then we have to convert to char in chunks (possibly) to do the replace.
                      Our tag identifiers are "<<" and ">>" e.g. "<<EMPNO>>"
                      Seems to work with any size of file - I tried it on a massive one with a large logo with no problems.
                      We also store the completed letter in a log file - easily removed if you don't need it!

                      I'll reproduce the full procedure - I think it's self-explanatory.
                      (fetch_det and replace_data should be obvious)

                      procedure mailmerge (p_module in varchar2
                      ,p_empno in number := 1)
                      is

                      v_module rtf.module%type;
                      v_input blob;
                      v_output blob := null;
                      v_raw blob;
                      -- Buffer for log blob content
                      v_blob blob;

                      v_default_bufflen number := 16384; -- 16k
                      v_bufflen number;
                      v_offset number := 1;

                      v_start_pos number;
                      v_end_pos number;

                      v_content varchar2(32000);
                      v_first boolean := true;

                      v_log_seq letter_log.seqno%type;

                      v_where varchar2(200);

                      cursor c_lob is
                      select content
                      from rtf
                      where module = v_module;


                      cursor c_seq is
                      select nvl(max(seqno),0) + 1
                      from letter_log;


                      begin

                      v_module := UPPER(p_module);
                      v_where := 'Retrieving RTF file';

                      open c_lob;
                      fetch c_lob
                      into v_input;
                      if c_lob%notfound then
                      error_flag := true;
                      htp.print('Module not found');
                      end if;
                      close c_lob;

                      -- Now retrieve the variables

                      fetch_det(p_empno);

                      begin

                      v_where := 'Processing letter contents';
                      loop
                      v_bufflen := v_default_bufflen;
                      <<reread>>
                      dbms_lob.read(v_input, v_bufflen, v_offset, v_raw);
                      v_content := utl_raw.cast_to_varchar2( v_raw );
                      /* Now count backwards to find the last occurrence of "<<" */
                      v_start_pos := instr(v_content,'<<',-1,1) ;
                      if v_start_pos > 0 then -- found
                      /* Now , do we have a close symbol? */
                      v_end_pos := instr(v_content,'>>',v_start_pos);
                      IF v_end_pos = 0 then -- no close and we have a split replacement string
                      v_bufflen := v_start_pos - 1; -- cut buffer down to posn. BEFORE replace start
                      goto reread;
                      end if;
                      end if;
                      v_content := replace_data(v_content);
                      v_raw := utl_raw.cast_to_raw(v_content);
                      if v_first then
                      v_output := v_raw;
                      v_first := FALSE;
                      else
                      dbms_lob.append(v_output,v_raw);
                      end if;
                      v_offset := v_offset + v_bufflen;

                      end loop;

                      exception
                      when no_data_found then
                      -- htp.print('end of file');
                      null;

                      end;

                      v_where := 'Log Seq';

                      open c_seq;
                      fetch c_seq
                      into v_log_seq;
                      if c_seq%notfound then
                      v_log_seq := 1;
                      end if;
                      close c_seq;

                      v_where := 'Logging details';
                      begin
                      insert into letter_log
                      (seqno
                      ,module
                      ,date_sent
                      ,content)
                      VALUES
                      (v_log_seq
                      ,v_module
                      ,sysdate
                      ,v_output);


                      exception
                      when others then
                      error_flag := TRUE;
                      htp.print('<h1>'||'Error in Letter Log '||SQLERRM ||'<h1>');
                      end;


                      if not error_flag then

                      v_where := 'Setting mime details';
                      Owa_Util.Mime_Header('application/msword');
                      owa_util.http_header_close;

                      v_where := 'Displaying processed content';
                      wpg_docload.download_file(v_output);
                      end if;
                      1 2 Previous Next