This discussion is archived
2 Replies Latest reply: Mar 4, 2013 9:14 AM by rgarza28 RSS

AS_PDF3 and image headers

rgarza28 Newbie
Currently Being Moderated
Currently using APEX 3.2.

Does anyone have experience with using the AS_PDF3 package from Anton Scheffer to create PDF's on the fly? For the most part I got all of the components I need to create a PDF except for placing an image as a header. That part seems to fails. I know that using the:

<pre>
     as_pdf3.set_page_proc( q'~
          begin
               as_pdf3.horizontal_line(10, 25, 584);
               as_pdf3.set_font( 'helvetica', 8 );
               as_pdf3.put_txt( 10, 15, 'Page #PAGE_NR# of "PAGE_COUNT#' );
               as_pdf3.put_image( to_blob ( utl_encode.base64_decode( utl_raw.cast_to_raw( header_jpg ) ) )
                    , p_x => 335
                    , p_y => as_pdf3.get( as_pdf3.C_GET_PAGE_HEIGHT ) - 100
                    , p_width => 567
                    , p_height => 75
               );
          end;~' );
</pre>

generates the header and footer information. If I put the *put_image* code within the block, then the header and footer breaks (no image and no header & footer is placed on pdf). If I place the same *put_image* code outside of set_page_proc block, then the image displays and the header and footer info also displays. If I can control 100% of the time when a new page is generated then it's no big deal, I'll just tell it to put up an image. There are times when I don't have that control and the auto generation of header and footer is needed.

I've seen Anton's code examples that show that you can place an image in the footer, but for some reason I can't get it to display the image in the header area. Has anyone been able to do this?

PS: His blog site is no longer taking questions and that is why I'm posting on here.
  • 1. Re: AS_PDF3 and image headers
    ascheffer Expert
    Currently Being Moderated
    The header and footer procedures are prcocessed with an "execute immediate". Your variable header_jpg is not available at that point,
    so the executed code will not compile and no header/footer will be shown. You will need to derive your image blob inside the header procedure.
  • 2. Re: AS_PDF3 and image headers
    rgarza28 Newbie
    Currently Being Moderated
    Anton,

    Thanks for your response.

    I created a function to return the image as a BLOB and a quick test shows that it is now working properly.

    <pre>
         as_pdf3.set_page_proc( q'~
              begin
                   as_pdf3.horizontal_line(10, 25, 584);
                   as_pdf3.set_font( 'helvetica', 8 );
                   as_pdf3.put_txt( 10, 15, 'Page #PAGE_NR# of "PAGE_COUNT#' );

                   as_pdf3.put_image( pres_comp_coi_util_pkg.get_blob( 272, 'coi_pdf_header.png')
                        , p_x => 335
                        , p_y => as_pdf3.get( as_pdf3.C_GET_PAGE_HEIGHT ) - 100
                        , p_width => 567
                        , p_height => 75
                   );               
              end;~' );
    </pre>

    Many thanks for you assistance and the creation of the as_pdf3 package.

    One quick question ... what are the unit of measurement for the p_x, p_y, p_width and p_height?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points