cedricmartel / pdftemplate Goto Github PK
View Code? Open in Web Editor NEWPdf generation with xml templates for iTextSharp
Pdf generation with xml templates for iTextSharp
It would be great to have a Template designer, maybe on webpage
Hello @cedricmartel , good afternoon: When I try this xml without footer, it generates an error. Is it mandatory to declare a footer in the xml?
xml sample :
<?xml version="1.0" encoding="utf-8"?> <pagedef pagesize="letter" pageorientation="portrait" fontsize="10" margin_left="20" margin_right="20" margin_top="20" margin_botton="20"> <header> <row> <image src="logocasero.jpg" width="580" height="60" align="Center" /> </row> <font fontsize="8" fonttype="Arial"> <row> <textbox text="" /> </row> <row> <font fontsize="20" fonttype="Arial" fontstyle="bold"> <textbox width="100%" align="Center" text="Programa de Actividades El Calafate" /> <textbox width="1%" text="" /> </font> </row> <row> <font fontsize="8" fonttype="Arial"> <textbox width="100%" align="Center" text="{r_reserva}"> <var name="{r_reserva}" /> </textbox> </font> </row> <row> <textbox text="" /> </row> <row> <textbox text="" /> </row> <row> <font fontsize="13" fonttype="Arial" fontstyle="bold"> <textbox width="0%" text=" " /> <textbox width="15%" text="Pasajeros:" /> <textbox width="45%" align="left" text="{r_descripcion}"> <var name="{r_descripcion}" /> </textbox> <textbox width="3%" text="X " /> <textbox width="20%" align="left" text="{r_totalespax}">12:59 p.m. 10/12/2014 <var name="{r_totalespax}" /></textbox> </font> </row> <row> <textbox width="0%" text=" " /> <textbox width="15%" text="" /> <textbox width="45%" align="left" text=""> <var name="" /> </textbox> </row> <row> <textbox text="" /> </row> <row> <font fontsize="12" fonttype="Arial"> <textbox width="14%" text="Bienvenidos a " align="left" /> </font> <font fontsize="12" fonttype="Arial" fontstyle="bold"> <textbox width="14%" text="El Calafate!!" align="left" /> </font> <font fontsize="12" fonttype="Arial"> <textbox width="67%" text="Tierra de glaciares" align="left" /> </font> </row> <row> <font fontsize="12" fonttype="Arial" fontstyle="bold"> <textbox width="100%" text="" align="left" /> </font> </row> <row> <line x1="-1" x2="-1" width="100%" /> </row> <row> <textbox text="" /> </row> </font> </header> <loop> <font fontsize="10" fonttype="Arial"> <row> <font fontsize="10" fonttype="Arial" fontstyle="bold"> <textbox width="5%" text="Dia:" align="left"> <var name="" /> </textbox> <textbox width="12%" text="{d_desde}" align="left"> <var name="{d_desde}" /> </textbox> </font> </row> <row> <textbox width="18%" text="Hora de busqueda:" align="left"> <var name="" /> </textbox> <textbox width="12%" text="{d_hora}" align="left"> <var name="{d_hora}" /> </textbox> </row> <row> <font fontsize="10" fonttype="Arial" fontstyle="bold"> <textbox width="100%" text="{ccoment_cabserv_1}" align="left"> <var name="{ccoment_cabserv_1}" /> </textbox> </font> </row> <row> <textbox width="100%" text="{ccoment_serv_1}" align="left"> <var name="{ccoment_serv_1}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_2}" align="left"> <var name="{ccoment_serv_2}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_3}" align="left"> <var name="{ccoment_serv_3}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_4}" align="left"> <var name="{ccoment_serv_4}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_5}" align="left"> <var name="{ccoment_serv_5}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_6}" align="left"> <var name="{ccoment_serv_6}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_7}" align="left"> <var name="{ccoment_serv_7}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_8}" align="left"> <var name="{ccoment_serv_8}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_9}" align="left"> <var name="{ccoment_serv_9}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_10}" align="left"> <var name="{ccoment_serv_10}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_11}" align="left"> <var name="{ccoment_serv_11}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_12}" align="left"> <var name="{ccoment_serv_12}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_13}" align="left"> <var name="{ccoment_serv_13}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_14}" align="left"> <var name="{ccoment_serv_14}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_15}" align="left"> <var name="{ccoment_serv_15}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_16}" align="left"> <var name="{ccoment_serv_16}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_17}" align="left"> <var name="{ccoment_serv_17}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_18}" align="left"> <var name="{ccoment_serv_18}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_19}" align="left"> <var name="{ccoment_serv_19}" /> </textbox> </row> <row> <textbox width="100%" text="{ccoment_serv_20}" align="left"> <var name="{ccoment_serv_20}" /> </textbox> </row> <row> <textbox width="10%" text="Retira en:" align="left"> <var name="" /> </textbox> <textbox width="40%" text="{d_info1}" align="left"> <var name="{d_info1}" /> </textbox> </row> <row> <textbox width="10%" text="Deja en:" align="left"> <var name="" /> </textbox> <textbox width="40%" text="{d_info2}" align="left"> <var name="{d_info2}" /> </textbox> </row> <row> <textbox width="40%" text="" align="left"> <var name="" /> </textbox> </row> </font> </loop> <body> <font fontsize="8" fonttype="Arial"> <row> <textbox width="100%" text=" " align="Center" /> </row> <row> <line x1="-1" x2="-1" width="100%" /> </row> <row> <font fontsize="12" fonttype="Arial" fontstyle="bold"> <textbox width="100%" text="VUELOS PREVISTOS: " align="left"> <var name="" /> </textbox> </font> </row> <row> <font fontsize="12" fonttype="Arial" fontstyle="bold"> <textbox width="100%" text="{b_vuelo1}" align="left"> <var name="{b_vuelo1}" /> </textbox> </font> </row> <row> <font fontsize="12" fonttype="Arial" fontstyle="bold"> <textbox width="100%" text="{b_vuelo2}" align="left"> <var name="{b_vuelo2}" /> </textbox> </font> </row> <row> <line x1="-1" x2="-1" width="100%" /> </row> <row> <textbox width="100%" text="" align="Center" /> </row> <row> <font fontsize="14" fonttype="Arial" fontstyle="bold"> <textbox width="100%" text="TELEFONO DE EMERGENCIA: 5465466 " align="Center" /> </font> </row> <row> <font fontsize="10" fonttype="Arial" fontstyle="bold"> <textbox width="100%" text="" align="Center" /> </font> </row> <row> <line x1="-1" x2="-1" width="100%" /> </row> <row> <font fontsize="10" fonttype="Arial" fontstyle="bold"> <textbox width="100%" text="I M P O R T A N T E:" align="Center" /> </font> </row> <row> <textbox text="" /> </row> <row> <font fontsize="10" fonttype="Arial"> <textbox width="100%" text="** El orden de las actividades de su Itinerario original, podrá estar alterado conforme a la disponibilidad de las mismas **" align="Center" /> </font> </row> <row> <font fontsize="10" fonttype="Arial"> <textbox width="100%" text="** Las excursiones NO son canjeables **" align="Center" /> </font> </row> <row> <font fontsize="10" fonttype="Arial"> <textbox width="100%" text="** Los horarios de comienzo de recorrido de las excursiones y/o traslados regulares son APROXIMADOS **" align="Center" /> </font> </row> <row> <font fontsize="10" fonttype="Arial"> <textbox width="100%" text="** Las excursiones y/o traslados regulares pueden demorarse hasta 30min. Por el recorrido entre los diferentes hoteles***" align="Center" /> </font> </row> <row> <font fontsize="10" fonttype="Arial"> <textbox width="100%" text="" align="Center" /> </font> </row> <row> <font fontsize="10" fonttype="Arial"> <textbox width="100%" text="" align="Center" /> </font> </row> <row> <textbox text="" /> </row> <row> <textbox text="" /> </row> <row> <image src="qr.jpg" width="600" height="60" align="Center" /> </row> <row> <textbox text="" /> </row> <row> <font fontsize="20" fonttype="Arial" fontstyle="bold"> <textbox width="100%" text="¡Les deseamos una feliz estadía en El Calafate!" align="Center" /> </font> </row> <row> <textbox text="" /> </row> <row> <textbox text="" /> </row> </font> </body> </pagedef>
Hello. I have been using the PDFTemplateItextSharp class to generate PDFs for some time. Now i need to generate a PDF with two tables in it.
In the page https://pdftemplate.codeplex.com/discussions/650665 i read the comment:
Added support for multiple tables : just add tables inside body tag, and add table data inside body data
But can i achieve this? im not sure if could be with the one that accepts the parameters loopData and tableLoopData.
Do you have an example XML that does this.
Thanks.
Hi. Thanks for the help with the many tables issue.
I have an XML with an image tag with fixed position inside a row tag which is inside a footer tag:
<footer y="300" absolute="yes">
<row>
<image src="{logo}" width="120" height="32" align="center" x="45" y="742">
<var name="{logo}" formatter="text" optional="no" />
</image>
</row>
with the version 1.2.1 of the PDFTemplateItextSharp this used to display the image in the specified position, calling the following overload of the method:
public void Draw(Hashtable headerData, List<Hashtable> loopData, Hashtable bodyData, Hashtable footerData, Hashtable tableHeadData, List<Hashtable> tableLoopData, Hashtable tableFootData);
Then, in order to show many tables in the same page, i replaced the dll for the one with the version 1.2.2 (also i had to change Moon.PDFDrawItextSharp.dll, Moon.PDFTemplate.dll and Moon.PDFDraw.dll) and used the overload:
´public void Draw(Hashtable header, Hashtable body, Hashtable footer);´
then the image wasn't shown. To show an image i have to put it in a specific row without the x and y attributes and is shown in the row, moving the other elements so i have to fixed all the xml templates with images that i have in order that they can be generated in the same way as before.
Is there a way to display an image or other elements at a fixed position with the version 1.2.2?
When .net core version ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.