lunedì 14 luglio 2014

AS_PDF3_V5 new features

AS_PDF3_V5 new features 

Hello everyone, a few days ago I posted the SQL for create PDF document directly from PL/SQL, based on original package by .
Now I've added some new features (version 3.5.2):
  • Procedure query2table now accept CLOB query fields, treat this as images and locate it into array of cells, using horizontal and vertical alignment and risizing if specified.
  • New procedere query2labels that work like query2table but dispose record into multiple columns and rows. The scope is to create sheets with the same label with different contents like a mailing list.
  • Begin of multilanguage errore messages (English or Italian).
  • Added offsetY parameter to columns format type, it works like offsetX, but obviously acts on the ordered. Used in combination with cellRow and tRowHeight, allows the positioning of each individual field in an independent manner.
  • Added a simplified call to query2table and query2label whit colors parameter as a simpliest list of hex rgb colors comma separated,
    for example '000000,e0ffff,000000,000000,ffffff,000000,000000,d0d0d0,000000' .
 2014-11-13. little bugfix on log procedure
 2016-05-11. bugfix on callingh query2table with p_color parameter set to null
 2016-09-06  bugfix in recursive call of write (for text on multiple lines)
comments and corrections, as always, are welcome

Download Ultima versione (0.3.5.11)   Example  Documentation Github

AS_PDF3_V5 nuove funzionalità

Salve a tutti, qualche giorno fa ho postato il codice SQL per creare documenti PDF direttamente da PL/SQL, basato sul package originale di .
Ora ho aggiunto alcune nuove funzionalià:
  • Procedure query2table: ora la query acetta campi CLOB, li tratta come immagini e li posiziona all'interno della griglia, con la possibilità di allineamento orizzontale, verticale e ridimensionamento se specificato.
  • Nuova procedere query2labels: funziona come query2table, ma dispone i record su colonne e righe miltiple. Lo scopo è di realizare fogli di etichette un po' come farebbe un programma di mailing list per la stampa delle etichette indirizzi.
  • Inizio della gestione degli errori personalizzati con messaggi in Italiano e Inglese.
  • Aggiunto il parametro offsetY al record dei formati colonne, funziona come offsetX, ma ovviamente agisce sulle ordinate. Usato in combinazione con cellRow e tRowHeight, permette di posizionare ogni singolo campo in modo indipendente.
  • Aggiunta una chaimata più semplice per  query2table e query2label dove il parametro dei colori è una semplice lista di colori rgb separata da virgol,
    esempi: '000000,e0ffff,000000,000000,ffffff,000000,000000,d0d0d0,000000' .
2014-11-13. lieve bugfix alla procedura di log
2016-05-11. bugfix con parametro p_color null
2016-09-06  bugfix nelle chiamate ricorsive della procedura write (avvengono per il testo su più righe)
Come sempre commenti e correzioni saranno graditi.

Download Last version (0.3.5.11)    Esempio  Documentazione Github


Change Log
-------------------------------------------------------------------------------
** Date: 18-09-2014             Version:  0.3.5.03
**   bugfix and impovement suggested by Giuseppe Polo
**   +query2table               added Interline parameter
**    setCellFont               bugfix for Header
** Date: 26-09-2014             Version:  0.3.5.04
**   bugfix for recursive call of function Write
** Date: 29-09-2014             Version:  0.3.5.05
**   +query2table               added pFrame parameter ex:  'L=2pt; C=FF0000'
**                                       where L=Linesize and C=rgb hex colour
**   +query2table               p_colors also accept CSV string of rgb colours   
**   +set_Language              Set language for erorr messages.
**                                       (English, Italian)
**   +put_image                 add parameters p_cellWidth, p_cellheight
**   +Columns                   can contain blob IMAGE 
**   +FullJustify Alignment     for write and query2table functions
**
** Date: 25-11-2014             Version:  0.3.5.06
**   bugfix for query with more than 200 records
**   +query2table               Add optional parameter p_bulk_size:=200
**   +cursor2table              if = 0 buffer is autodetected,
**                              but query runs 2 times!
** Date: 24-06-2015             Version:  0.3.5.07
**   BugFix query2table         Reset rowHeith when
**                              RowHeight Min or Exacat as specified
** Date: 30-06-2015             Version:  0.3.5.08
**   BugFix PrepareRecord       Fix problem with rowHeight
** Date: 26-08-2015                    Version:  0.3.5.09
**   BugFix colorTable                 Fix problem with undefined collection
**   WARNING! if you change package name, propertly set g_package variabile
** Date: 14-12-2015                    Version:  0.3.5.10
**   Bugix in PrepareRecord
** Date: 11-05-2016                    Version:  0.3.5.11
**   Bugix error when calling with null colours
**   colorTable changed and moved before query2Table
**   query2table & query2label changed
**   when calling query2table you must use empty string '' instead of null for p_colors parameter
**

23 commenti:

  1. Ciao Valerio, innanzitutto complimenti vivissimi per le implementazioni sul codice che hai apportato.
    Trovo che questo package sia molto utile .. ho fatto un po' di test inserendo immagini e tabelle e i risultati sono entusiasmanti.
    Ti segnalo un potenziale bug (che magari hai già riscontrato e risolto) nella procedura setCellFont dove il parametro p_vMode viene passato ma non testato per cui il font della testata (header) rimane sempre quello della tabella.
    Ho aggiunto questo test:
    if upper1(p_vMode)='T' then
    v_vFontName:=nvl(t_formats(p_nIndex).tFontName,g_fonts(g_current_font).family) ;
    v_vFontStyle:=upper(substr(nvl(t_formats(p_nIndex).tFontStyle, g_fonts(g_current_font).style),1,1));
    v_nFontSize:=nvl(t_formats(p_nIndex).tFontSize,g_fonts(g_current_font).fontsize);
    else
    v_vFontName:=nvl(t_formats(p_nIndex).hFontName,g_fonts(g_current_font).family) ;
    v_vFontStyle:=upper(substr(nvl(t_formats(p_nIndex).hFontStyle, g_fonts(g_current_font).style),1,1));
    v_nFontSize:=nvl(t_formats(p_nIndex).hFontSize,g_fonts(g_current_font).fontsize);
    end if;

    e ora funziona correttamente.
    Inoltre, ho aggiunto il parametro p_Interline alla procedura query2table che trovo sia utile per avere il controllo dell'interlinea (altrimenti fissa a 1.2).
    Sarebbe possibile, secondo te, aggiungere alla procedura query2table anche il parametro p_startY che permetta di posizionare la tabella con più libertà sul piano cartesiano?
    Grazie infinite.
    Giuseppe Polo - g.polo@liscor.com

    RispondiElimina
    Risposte
    1. Ciao Giuseppe,
      prima di tutto ti ringrazio per i complimenti e per i suggerimenti.
      Ho aggiornato il file del package con le modifiche che hai indicato, incluso il parametro p_startY
      (se ti interessa vedere dove cercal il commento #Valr 2014.09.18 add p_startY parameter).

      Grazie per la collaborazione
      Valerio

      Elimina
  2. Ciao Valerio,
    ti segnalo un bug nella procedura write.
    procedure write
    ( p_txt in varchar2
    , p_um VARCHAR :='pt' -- Add by ValR
    , p_x in number := null
    , p_y in number := null
    , p_line_height in number := null
    , p_start in number := null -- left side of the available text box
    , p_width in number := null -- width of the available text box
    , p_alignment in varchar2 := NULL
    )

    quando richiama se stessa nei vari rami IF non viene passato il secondo parametro p_um e quindi viene sollevato un errore.
    Ho corretto la procedura nel mio ambiente di test mettendo in tutti i punti p_um come secondo parametro e mi sembra ok.

    Sto cercando di capire se c'è un modo per gestire il testo "full justified". Magari a te viene in mente come fare.
    Grazie
    Giuseppe

    RispondiElimina
    Risposte
    1. Ti ringrazio per la segnalazione, ho corretto il file allegato al post seguendo le tue indicazioni.
      Ciao
      Valerio

      Elimina
  3. How you can share code with so many bugs?

    Let's take the procedure colorTable, at the beginning is reference to uninitialized collection

    function colorTable(p_vColors in varchar2) return tp_colors is
    t_colors tp_colors;
    i pls_integer;
    v_vColors varchar2(100);
    v_vColor varchar2(6);
    v_vColorDef varchar2(6);
    BEGIN
    t_colors(1):='000000';
    t_colors.extend(9-t_colors.count);
    v_vColors:=p_vColors;
    ,,,,,

    RispondiElimina
    Risposte
    1. Thanks for the tip, and I apologize for the bug.
      You can correct the error by replacing
      BEGIN
      t_colors (1): = '000000';
      with this
      BEGIN
      t_colors: = tp_colors ('000000');

      If you prefer you can re-download the files already corrected.

      Sharing this package we have been identified and corrected the bug and have implemented some functionality requested by other users

      Greetings

      Elimina
  4. Ciao Valerio,
    vorrei scaricare il package ma il download non è più disponibile.
    Potresti aiutarmi?
    Grazie mille
    Daniela

    RispondiElimina
  5. Ciao Daniela,
    ho modificato il link, ora dovrebbe fare il download diretto.
    Grazie.

    RispondiElimina
  6. Grazie ancora
    Daniela

    RispondiElimina
  7. Hello,
    I'm trying to use query2table but when I execute the proc, I'm facing ORA-06531: Reference to uninitialized collection
    The proc says
    as_pdf3.query2table(myquery, null, NULL, NULL, NULL, '2pt', 25, 0, 1.2, 530, null);
    and I have set myquery before this line
    Thanks for helping

    RispondiElimina
    Risposte
    1. Hi, I apologize for the error that occurs because there are two calls to the procedure with different parameters.
      when p_colors is zero is considered varchar2 and fails when attempts to convert it to a set of three colors.
      I hope to patch it as soon as possible.
      I have never encountered this error because usually specific colors to use, your example line becomes :
      as_pdf3_v5.query2table(myquery,null,
      as_pdf3_v5.tp_colors('000000','d0d0d0','000000',
      '000000','ffffff','000000',
      '000000','e0ffff','000000'),
      null, null, 'pt', 25, 0, 1.2, 530, null
      );

      I

      I do not have the ability to test at home (now is 9:50 pm) because I haven't an Oracle server, i will do it tomorrow morning from my office.

      Elimina
    2. New version 3.5.11 solve your problem, remebre to use '' instead of null for p_colors parameter

      Elimina
  8. Hello! How can you put a word with word wrap in the header of the table? I have tried but it leaves the sides if I center it and if I align it to the right the word is cut off. I reviewed the code but did not know how to make an improvement. I appreciate your help!

    RispondiElimina
    Risposte
    1. Hi Danielle,
      can you send me an example of your code ?
      blogcodesnippets-valerio_at_yahoo_dot_it

      Elimina
  9. Hi Valerio
    thank you very much for your effort
    i want to generate a pdf file from database which contains "Arabic text", when i use this package characters appear as (????????).
    please is it possible to help me to make this package identify arabic characters and fonts.
    i am really appreciated in advance.

    RispondiElimina
  10. Hi Khitam,
    I'm not an expert, I just added some features to Anton Sheffer's package, and don't know all the technical details.
    In example 4 shows the load_ttf_font function.
    This function uses the WINDOWS-1252 codepage by default, if you have not already done so try to use a true type font that contains the characters in Arabic and to set the WINDOWS-1256.

    RispondiElimina
  11. Hello, i have two variables with dynamic text and set WRITE one after each other, but i got a problem when first one fill all page, then second one write its text over first one, how can identify when page is full?
    Thanks.

    RispondiElimina
    Risposte
    1. Hi Guarjila
      you can get current Y position calling thi function
      as_pdf3_v5.get(as_pdf3_v5.c_get_y)
      and page lower limit
      as_pdf3_v5.get(as_pdf3_v5.c_get_page_height)-
      as_pdf3_v5.get(as_pdf3_v5.c_get_margin_bottom)

      I hope I was helpful

      Elimina
  12. Hello Valerio, how are you doing?
    First of all, thanks for the long support you've been giving to this package.
    Si I'm creating a simple table and I have some trouble with the headers, some of my text is big, and to fit I need to set a big width, is there any way to fit the text in the header by increasing the row height? I already did this but it doesn't fit. Is there anyway to do this?

    RispondiElimina
    Risposte
    1. Hi
      maybe I didn't understand.
      Have you used querytable to create a table, but the column headings are very long and would you like to increase the height of the header row?
      query2table have parameter t_hRowHeight to set the height of the header, but currently it does not include wordwrap of text in header.
      The procedure to look is show_header.
      The solution depends on what you need.
      Do you want to be able to split over multiple lines by adding \n as a line separator in the header text?
      In this case it's simple, just iterate the parsing of \n, write the line and increment the position by the height of the font used.

      If, on the other hand, you want text to fit automatically, it's a little more complicated.
      Considering that the headers are fixed, I propose the first solution. I just have to find the time to write the code

      Elimina
  13. Questo commento è stato eliminato dall'autore.

    RispondiElimina
  14. Hi, i'm using the package in a 12 oracle database, the database have been updated to 19 and now the package is causing a deadlok, you know what i can check to resolve that problem?

    sorry for the bad english

    thanks.

    RispondiElimina
    Risposte
    1. I'm sorry, I can no longer give support, I changed jobs.

      Elimina