How to generate a pdf file

hi i want to generate a pdf file using a java program, i have a string of xml format i want read the string and get each node of the string then
pass it to generate pdf.how to do this, the problem is if i want to read
xml then i must use org.w3c.dom.Element, but for pdf generation i must use com.lowagie.text.Element , so how to solve this.
please help.
rafel

Well, obviously XML and PDF are two very different kinds of format, and it's up to you how one is going to be mapped into the other. There are at least two PDF APIs available free, but it's not a trivial format to manage.
It's impossible to give you any more advice with the limited information you've supplied.

Similar Messages

  • How to generate a pdf file from Excel

    Hi all,
    I've a Excel file i want to generate a pdf file by using java...can any one explain wht r the things r required. If ur answer is "iText" or "apache FOP" then wht r the things to be needed...I want to know the exact answer...step by step....plz help me out...
    Eagarly waiting for reply...
    regards
    [email protected]

    hi,
    I've a idea on jdk,,,i need to know who to use FOP packages?
    regards,
    [email protected]

  • How to generate a pdf file using javascript?

    I would like to generate a pdf file having images in it using javascript. I tried jsPDF but getting some exceptions like
    Uncaught ReferenceError: pageWidth is not defined,
    fail to load pdf document
    Could anyone show me some pointers?
    Thank You
    Rahul

    Here is my code
    var myImg=new Image();
      myImg.src=arrData['employee'][1]['Image'];
      myImg.crossOrigin ="Anonymous";
       var imgData = this.getBase64Image(myImg);
       var doc = new jsPDF();
       doc.setFontSize(40);
       doc.text(35, 25, "Test Image");
       doc.addImage(myImg, 'JPEG', 15, 40, 180, 160);
       doc.save("sample1.pdf");
    I'm receiving the following error at 'addImage' function.
    Uncaught Error: getJpegSize could not find the size of the image
    Could you please help in pointing out where am I going wrong.
    Thank You

  • Images present in datagridview not exporting to file only text contents are generating into PDF file..

    Hi Everyone,
       I have created simple Desktop app in that I trying to generate PDF file from Datagridview...when I click on ExportPDf button Pdf file is generation successfully but the issue is in that pdf whatever the images has present in datagridview that images
    are not generation into PDF only the text contents are Present in PDF file.
      Does any one can tell me how to generate the PDF file along with images.
    Here is my code:
      private void btnexportPDF_Click(object sender, EventArgs e)
                int ApplicationNameSize = 15;
                int datesize = 12;
                Document document = null;
                try
                    SaveFileDialog savefiledg = new SaveFileDialog();
                    savefiledg.Filter = "All Files | *.* ";
                    if (savefiledg.ShowDialog() == DialogResult.OK)
                        string path = savefiledg.FileName;
                        document = new Document(PageSize.A4, 3, 3, 10, 5);
                        PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(path + ".pdf", FileMode.Create));
                        document.Open();
                        // Creates a phrase to hold the application name at the left hand side of the header.
                        Phrase phApplicationName = new Phrase("Sri Lakshmi Finance,Hosur-560068", FontFactory.GetFont("Arial", ApplicationNameSize, iTextSharp.text.Font.NORMAL));
                        // Creates a phrase to show the current date at the right hand side of the header.
                        Phrase phDate = new Phrase(DateTime.Now.ToLongDateString(), FontFactory.GetFont("Arial", datesize, iTextSharp.text.Font.NORMAL));
                        document.Add(phApplicationName);
                        document.Add(phDate);
                        iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance("D:\\logo.JPG");
                        document.Add(img);
                        iTextSharp.text.Font font5= iTextSharp.text.FontFactory.GetFont(FontFactory.TIMES_ROMAN, 5);
                        iTextSharp.text.Font font6 = iTextSharp.text.FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 6);
                        //float[] columnDefinitionSize = { 2.5f, 7.0f,6.6f, 8.6f, 6.6f, 5.0f, 4.5f, 7.0f, 6.3f, 7.0f, 3.5f, 6.0f, };
                        PdfPTable table = null;
                        table = new PdfPTable(dataGridView1.Columns.Count);
                        table.WidthPercentage = 100;
                        PdfPCell cell = null;
                        foreach (DataGridViewColumn c in dataGridView1.Columns)
                            cell = new PdfPCell(new Phrase(new Chunk(c.HeaderText,font6)));
                            cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                            cell.VerticalAlignment = PdfPCell.ALIGN_CENTER;
                            cell.BackgroundColor = new iTextSharp.text.BaseColor(240, 240, 240);
                            table.AddCell(cell);
                        if (dataGridView1.Rows.Count > 0)
                            for (int i = 0; i < dataGridView1.Rows.Count; i++)
                                PdfPCell[] objcell = new PdfPCell[dataGridView1.Columns.Count];
                                for (int j = 0; j < dataGridView1.Columns.Count - 0; j++)
                                    cell = new PdfPCell(new Phrase(dataGridView1.Rows[i].Cells[j].Value.ToString(), font5));
                                    cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                                    cell.VerticalAlignment = PdfPCell.ALIGN_LEFT;
                                    cell.Padding = PdfPCell.ALIGN_LEFT;
                                    objcell[j] = cell;
                                PdfPRow newrow = new PdfPRow(objcell);
                                table.Rows.Add(newrow);
                        document.Add(table);
                        MessageBox.Show("PDF Generated Successfully");
                        document.Close();
                    else
                        //Error 
                catch (FileLoadException fle)
                    MessageBox.Show(fle.Message);
                    MessageBox.Show("Error in PDF Generation", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    Runtime Gridview content:
    Generated PDF File:
    Thanks & Regards RAJENDRAN M

    Hi Everyone,
       I have created simple Desktop app in that I trying to generate PDF file from Datagridview...when I click on ExportPDf button Pdf file is generation successfully but the issue is in that pdf whatever the images has present in datagridview that images
    are not generation into PDF only the text contents are Present in PDF file.
      Does any one can tell me how to generate the PDF file along with images.
    Here is my code:
      private void btnexportPDF_Click(object sender, EventArgs e)
                int ApplicationNameSize = 15;
                int datesize = 12;
                Document document = null;
                try
                    SaveFileDialog savefiledg = new SaveFileDialog();
                    savefiledg.Filter = "All Files | *.* ";
                    if (savefiledg.ShowDialog() == DialogResult.OK)
                        string path = savefiledg.FileName;
                        document = new Document(PageSize.A4, 3, 3, 10, 5);
                        PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(path + ".pdf", FileMode.Create));
                        document.Open();
                        // Creates a phrase to hold the application name at the left hand side of the header.
                        Phrase phApplicationName = new Phrase("Sri Lakshmi Finance,Hosur-560068", FontFactory.GetFont("Arial", ApplicationNameSize, iTextSharp.text.Font.NORMAL));
                        // Creates a phrase to show the current date at the right hand side of the header.
                        Phrase phDate = new Phrase(DateTime.Now.ToLongDateString(), FontFactory.GetFont("Arial", datesize, iTextSharp.text.Font.NORMAL));
                        document.Add(phApplicationName);
                        document.Add(phDate);
                        iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance("D:\\logo.JPG");
                        document.Add(img);
                        iTextSharp.text.Font font5= iTextSharp.text.FontFactory.GetFont(FontFactory.TIMES_ROMAN, 5);
                        iTextSharp.text.Font font6 = iTextSharp.text.FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 6);
                        //float[] columnDefinitionSize = { 2.5f, 7.0f,6.6f, 8.6f, 6.6f, 5.0f, 4.5f, 7.0f, 6.3f, 7.0f, 3.5f, 6.0f, };
                        PdfPTable table = null;
                        table = new PdfPTable(dataGridView1.Columns.Count);
                        table.WidthPercentage = 100;
                        PdfPCell cell = null;
                        foreach (DataGridViewColumn c in dataGridView1.Columns)
                            cell = new PdfPCell(new Phrase(new Chunk(c.HeaderText,font6)));
                            cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                            cell.VerticalAlignment = PdfPCell.ALIGN_CENTER;
                            cell.BackgroundColor = new iTextSharp.text.BaseColor(240, 240, 240);
                            table.AddCell(cell);
                        if (dataGridView1.Rows.Count > 0)
                            for (int i = 0; i < dataGridView1.Rows.Count; i++)
                                PdfPCell[] objcell = new PdfPCell[dataGridView1.Columns.Count];
                                for (int j = 0; j < dataGridView1.Columns.Count - 0; j++)
                                    cell = new PdfPCell(new Phrase(dataGridView1.Rows[i].Cells[j].Value.ToString(), font5));
                                    cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                                    cell.VerticalAlignment = PdfPCell.ALIGN_LEFT;
                                    cell.Padding = PdfPCell.ALIGN_LEFT;
                                    objcell[j] = cell;
                                PdfPRow newrow = new PdfPRow(objcell);
                                table.Rows.Add(newrow);
                        document.Add(table);
                        MessageBox.Show("PDF Generated Successfully");
                        document.Close();
                    else
                        //Error 
                catch (FileLoadException fle)
                    MessageBox.Show(fle.Message);
                    MessageBox.Show("Error in PDF Generation", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    Runtime Gridview content:
    Generated PDF File:
    Thanks & Regards RAJENDRAN M
    Hello,
    Since this issue is mainly related to iTextSharp which belongs to third-party, I would recommend you consider posting this issue on its support website to get help.
    Maybe the following forum will help.
    http://support.itextpdf.com/forum/26
    Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to preserve a background color, when generating a PDF file

    I am trying to create a PDF file from some application. Please note that the picture in this application has the black background. So I invoke a Print command and set a printer as "Adobe PDF". As a result, I have generated
     a brilliant PDF file of my picture, but on the WHITE background. When selecting the Adobe PDF printer, I have looked through all its settings ( in the Adobe PDF settings, I have found several tabs: General, Images, Fonts, Color, Advanced, PDF/X), none of them generated the original background color. 
    So how can a generate a PDF file, having the original background color (black, in my case) ?
    Oleg

    Now I feel that the background definition in the Adobe PDF printer and the background definition in the application the Adobe PDF printer is invoked from -- two different things. So I guess how can I define the black background in the Adobe PDF printer? I cannot find such settings.

  • How do I generate the pdf file using the name of a field.  How can I help

    how do I generate the pdf file using the name of a field.  How can I help

    Hi,
    here's a sample.
    LiveCycle Blog: Formulare in bestimmte Verzeichnisse speichern und nach Inhalt aus Formularfeld benennen //Save forms to…

  • How to generate a PDF output using batch file in 10G

    Hello,
    I am using .bat file to generate a report PDF output. I have done this many times in 6i but for 10G I am unable to do the same.
    Can someone please look at the syntax below and let me know where I am going wrong.
    I understand that reports are different for 6i and 10G specially .rep file but I am sure we should be able to generate a PDF file using 10G. Please let me know.
    Thanks
    IQ
    Contents of .bat file follow
    ECHO Opening parameter form. Please do not close this window.
    C:\
    FOR /F "tokens=1 " %%I IN ('time /t') DO (SET _TIME=%%I)
    FOR /F "tokens=2 " %%I IN ('date /t') DO (SET _DATE=%%I)
    SET EXP_DATE=%_DATE:~6,4%%_DATE:~0,2%%_DATE:~3,2%_%_TIME:~0,2%%_TIME:~3,2%
    SET FILENAME=SEND_EMAIL_%EXP_DATE%_%USERNAME%.PDF
    CD C:\Users\Documents
    RWCONVERTER REPORT=C:\Users\Documents\send_email.rep USERID=scott/tiger@ORCL1 ORIENTATION=LANDSCAPE DESFORMAT=PDF DESTYPE=FILE
    DESNAME=C:\Users\\%FILENAME% PRINTJOB =NO

    Rwconverter is not used to run reports:
    rwconverter (Reports Converter) enables you to convert one or more report definitions or PL/SQL libraries from one storage format to another.
    I think you mean rwrun:
    rwrun (Reports Runtime) runs a report by starting its own in-process server (not to be confused with the default in-process Reports Server), which runs in the same JVM as the rwrun process.
    This bat file has to run on the server. There is no Reports installation on the client anymore.
    If you want to run a report from a client, you can make a bat file that calls the report url
    See: http://download.oracle.com/docs/cd/E14571_01/bi.1111/b32121/pbr_cla002.htm#i634710

  • How to generate a pdf form from a webform

    HOW TO GENERATE POPULATED PDF?
    We used to fill out the forms at work longhand (yes, with a pen!)
    Now since we created the form using Acrobat 9 Pro, we just enter the data on computer, and print out the form.
    Acrobat 9 form creator was great - I found it quite easy to use.
    Now, I'd like to automate the process even further.
    Each week we receive response forms from our website (maybe about 20-25).  These response forms have about 10 fields that
    people have completed with their information.Currently I am printing  out the response form and then open up the acrobat form and I enter their information into the pdf (and then print).
    1. Is it possible to automatically populate a pdf from the response form ? (without me having to print out the response form and re-enter the data)
    2. Is it really complicated; is this something I can do with some software/learning or do i need a programmer?
    Thank you kindly for any advice or direction.

    It sounds like you are using the forms in your local shop and that e-mail may work fine. If e-mail submission works fine (not recommended for normal use, but find in a controlled environment where you can be sure each e-mail client is running MAPI), then add a submit button to submit a FDF or XML data file (I like FDF when using forms in Acrobat, Designer only uses XML forms). You can then import the FDF or XML data to the form and print it. You can even manipulate the FDF or XML data and add it to a database of some form, furthering your processing even more.

  • How to generate a PDF 417 Barcode by assigning a dynamic value at runtime?

    PDF 417 Barcode Description given in the Livecycle Designer 8.2
    : PDF 417 Non-Scriptable Barcode. Value must be assigned to this barcode at design time, and this barcode will not update after form object value changes.
    And my question is how to generate a PDF 417 Barcode by assigning a dynamic value at runtime?

    All the information you described points to the problem that reports seems can't generate to a file which already exist. You can verify that by simply doing
    r30run32 C:\AC_REPORT.REP DESTYPE = FILE DESFORMAT = PDF BATCH = YES' desname=c:\temp\ac_report.pdf
    several times. If first time the report is successfully generated in c:\temp\ac_report.pdf, but not the second, third time, then it looks like there is a bug on reports r30run32 executable.
    You may try to find any latest patch for Reports 3.0 to see if patch can solve you problem. But keep in mind Reports 3.0 is de-supported, you are better to move to 6i or 9i reports.
    Thanks,
    -Shaun

  • Generate a PDF file Using Adobe Document Service

    Hi All,
    How can I generate a PDF file using Adobe Document Service? The content of the PDF can be from any DataSource (Oracle/ BW/ R3 ).
    Can anyone get me some information.Points will be rewarded
    Thanks in advance
    Deepak Raj

    Hi Raj,
    You can look into this blog
    Creating your first application using Interactive forms
    If you get your answer ...set the thread as "answered"
    Regards,
    Sekhar

  • How to show the pdf file into the UIWebView from iphone documents directory?

    Hi ,
         I am working on web services right now I am getting string into base64 format. After decoding that string into NSData i am saving that data as a pdf into Document directory of iphone. Now the problem is that when I want to show the pdf into UIwebView then it is showing blank page. But when I am checking into /Users/pareshkarnawat/Library/Application Support/iPhone Simulator/4.3.2/Applications/ the pdf file is correctly generated and working fine when I ope it.
       How to show that pdf file into UIwebview ? or is there any alernative for this.
    Any ideas on how I can go about this? I have looked at a few posts and still can't seem to figure it out.
    Any idea's appreciated, thanks

    The result is a UIWebView that displays a blank page. No errors occur in the UIWebView delegate method. The thing is that data has the correct length, in bytes, for the PDF I am trying to display, and I also get the pdf file in Library/Application Support/iPhone Simulator/4.3.2/Applications/ Does anyone have an idea as to what might be going wrong here or how I can better debug this problem?

  • How to compare two PDF files through PLSQL

    Hi,
    Can any body help that how to compare two PDF files through PLSQL programing and gives the differences as output.
    Thanks,

    Or simply apply an oracle text index on your pdf column:
    SQL>  create table t (id integer primary key, bl blob)
    Table created.
    SQL>  declare
    bf bfile := bfilename('TEMP','b32001.pdf');
    bl blob;
    begin
    dbms_lob.createtemporary(bl,true);
    dbms_lob.open(bf,dbms_lob.lob_readonly);
    DBMS_LOB.LOADFROMFILE(bl, bf,dbms_lob.getlength(bf));
    insert into t values (1,bl);
    commit;
    dbms_lob.close(bf);
    dbms_lob.freetemporary(bl);
    end;
    PL/SQL procedure successfully completed.
    SQL>  create index t_idx on t (bl) indextype is ctxsys.context parameters ('filter ctxsys.auto_filter')
    Index created.
    SQL>  declare
       mklob   clob;
    begin
       ctx_doc.filter ('t_idx', '1', mklob, true);
       dbms_output.put_line (substr (mklob, 1, 250));
       dbms_lob.freetemporary (mklob);
    end;
    Oracle® Database
    Release Notes
    11
    g
    Release 1 (11.1) for Linux
    B32001-04
    November 2007
    This document contains important information that was not included in the
    platform-specific or product-specific documentation
    PL/SQL procedure successfully completed.This generates a text only version of your pdf and standard text comparison methods can be applied ....

  • How to convert static pdf file to dynamic xml form pdf

    Hi All,
    I have generated one pdf report. I need to do build some logic in that generated pdf file. For this i need to convert this generated static pdf file to dynamic xml form pdf using Adobe LifeCycle Desinger. I opened my generated static pdf in Adobe LifeCycle Desinger and i tried to save this file in dynamic xml form pdf but it is not showing that option.
    How do we convert those type of reports to dynamic xml pdf?
    Advance Thanks
    Prasad Sagala

    Hi djaknow,
    Thanks for your reply, i got it now.But i am facing another problem like, my generated static pdf file has some logos, charts and some art symbols. For those if i am opening in LC and set the target version as 8.1 & above then saved as dynamic xml form pdf, Now i opened that dynamic xml form pdf the content(Images,logs and Art symbols) was not show me. It is comming fine if pdf does not contain any images, logos...etc.
    Can you tell me how i can i convert all the content( including images, logos ...etc) in my static pdf to dynamic xml form pdf.
    Advance Thanks
    Prasad Sagala

  • How do I save PDF files by default to the folder of the source file?

    How do I save PDF files by default to the folder of the source file with Acrobat 9.0.0 Standard?

    I am not seeing that behaviour. If I right-click a link to a .pdf file, I get the file saved with the original filename.
    Maybe one of the settings in about:config controls that?
    pdfjs.previousHandler.preferredAction is a setting that has a value of 4 with my setup. I have no idea what that means, and I could not find any explanation anywhere. You could try using different numbers for that value and see if any make any difference. Why has nobody bothered to explain that setting anywhere?

  • Does anyone know how i can view PDF files using Galaxy Note 2?

    Does anyone know how i can view PDF files using Galaxy Note 2?
    This is what i have been doing;
    I click on the file i wish to view (via a portal)
    this file goes to notification widget (i drag down screen)
    notification/message says download complete
    i click on notification/message
    nows it says complete action using (here i only have 2 icon options 1= DB Text Editor 2 = HTML Viewer)
    I have installed Adobe Reader.

    Can you confirm if the downloaded file is a pdf file, that is it ends with .pdf?

Maybe you are looking for

  • I can't see my pictures in teh finder using Quick look or Cover flow

    I have iPhoto8 installed and it works fine, but I cannot get a look at my library of photos without opening iPhoto. I thought I was supposed to be able to use the finder and cover flow to see my pictures quickly to find the one I wanted without openi

  • Routing Report to display data in CA03

    Hi Experts, I am making a report that displays the routings of all materials. In the table PLPO, i can see all the informations of operations its hours. But if an operation is deleted in the routing master then the entry inthe table is not deleted. S

  • Delete Command Button to delete particular row from VO

    Hi, I have dragged & dropped an VO into jspx page as table, from data-control pallete dragged Delete operation as a button on to the table as last column. By pressing delete button, it is deleting top row from VO. I want to delete the particular row

  • Formatting 7541 ms with 'HH:mm:ss.S' produces 01:00:07.541

    Hi, thats what i do: long millis = 7541; df = new SimpleDateFormat("HH:mm:ss.S"); df.format(new java.util.Date(millis)) The output is : 01:00:07.541 instead of 00:00:07.541 How get i rid of the one hour ??? The same occures when i use Calendar.

  • Anyway to use the 24" iMacs screen for other computer?

    Anyway to use the 24" iMacs screen for other computer? I´d like to hook up another computer to the 24" iMac. I know there´s no hardware way since it´s integrated but maybe by using some magic box over usb or something and a bit of software? I´m looki