> -----Original Message-----
> From: Sivasubramanian Gurunathan [SMTP:[EMAIL PROTECTED]
> Sent: Thursday, September 18, 2003 5:09
> To:   Paulo Soares; [EMAIL PROTECTED]
> Subject:      RE: [iText-questions] Javascript are not getting copied in
> PDFCop y
> 
> Hi,
> Thanks for the response. If PdfCopy copies only pages,
> can you tell me why only some part of the JavaScript
> is copying from the original pdf.?
> Only partial javascript is getting copied because of
> that I am getting the script error.
> 
> Can you please advice me how to prevent that? 
> 
        It can't be prevented. JavaScript only works for the pdf it was
designed for. It has to know the pdf. When pdfs are joined the place and
name of objects can/must change/overlap and you end up with something that
doesn't work. It may work in controlled situations but it always requires
custom code.

> Further to that according to your mail, only single
> file can have fields, the other files must be
> flattened before concatenating. Can you please explain
> me the concept  "flattened" and how we can do that.
> 
        The fields are converted to content. It's done with
PdfStamper.setFormFlattening(true).

> Without flattening are you finding any issue with the
> code I have attached?
> 
        Looks good.

        Best Regards,
        Paulo Soares

> Thanks and Regards,
> G.Siva.
> 
> --- Paulo Soares <[EMAIL PROTECTED]> wrote:
> > PdfCopy only copies pages not other objects at a
> > global level. Furthermore
> > only a single file can have fields, the other files
> > must be flattened before
> > concatenating.
> > 
> > Best Regards,
> > Paulo Soares
> > 
> > > -----Original Message-----
> > > From:     Sivasubramanian Gurunathan
> > [SMTP:[EMAIL PROTECTED]
> > > Sent:     Tuesday, September 16, 2003 12:48
> > > To:       [EMAIL PROTECTED]
> > > Subject:  [iText-questions] Javascript are not
> > getting copied in
> > > PDFCopy
> > > 
> > > Hi all,
> > > 
> > > I am using PDFCopy for merging PDF after mapping
> > the
> > > fields using PDFStamper.
> > > 
> > > While opening the Merged Pdf, I am getting a
> > script
> > > error, when I opened the form in Acrobat Editor
> > 5.0.
> > > The detailed error is below.
> > > 
> > > ================================================
> > > Acrobat Database Connectivity Built-in Functions
> > > Version 5.0
> > > Acrobat EScript Built-in Functions Version 5.0
> > > Acrobat Annotations / Collaboration Built-in
> > Functions
> > > Version 5.0
> > > 
> > > ReferenceError: CS_PDF_Util2_OnFormLoad is not
> > defined
> > > ================================================
> > > Could anyone tell me how to prevent this error. I
> > am
> > > not getting this error when I opened the merged
> > pdf in
> > > Acrobat reader 5.0.
> > > 
> > > Herewith I am attaching the function I used for
> > > mapping values and merging pdf.
> > > 
> > > =================================================
> > >  public String
> > > PrintPDFDocumentUsingDataObject(String[]
> > > PDFFileArray,HashMap objHashMap) {
> > > 
> > >     //PDFGen pp = new PDFGen();
> > >     String lSFileInPdf = "";
> > >     String lSFileOutPdf = "";
> > >     String lSFinalOutPdf = "";
> > >     PdfReader objPdfReader = null;
> > >     PdfStamper objPdfStamper = null;
> > >     HashMap pdffields = null;
> > >     String lSKeyString = "";
> > >     ArrayList KeyArray = new ArrayList();
> > >     ArrayList PDFOPArray = new ArrayList();
> > >     try {
> > >       if (PDFFileArray != null &&
> > PDFFileArray.length
> > > > 0) {
> > >         for (int FileCount = 0; FileCount <
> > > PDFFileArray.length; FileCount++) {
> > >           lSFileInPdf = PDFFileArray[FileCount];
> > >           if(lSFileInPdf != null &&
> > > !lSFileInPdf.equalsIgnoreCase(""))
> > >           {
> > >           Log.print("Input File Path" +
> > lSFileInPdf);
> > >           if (lSFileInPdf.indexOf(".pdf") != -1) {
> > >             lSFileOutPdf =
> > lSFileInPdf.substring(0,
> > > lSFileInPdf.indexOf(".pdf"));
> > >           }
> > >           Date objdate = new Date();
> > >           long llDate = objdate.getTime();
> > >           //DateFormat objDateFormat = new
> > > SimpleDateFormat("ddMMMyyyy");
> > >           //lSDate =
> > objDateFormat.format(objdate);
> > >           Log.print("TimeStamp" +
> > > Long.toString(llDate));
> > >           lSFileOutPdf = lSFileOutPdf +
> > > Long.toString(llDate) + ".pdf";
> > >           Log.print("Output File Path" +
> > > lSFileOutPdf);
> > >           PDFOPArray.add(lSFileOutPdf);
> > >           objPdfReader = new
> > PdfReader(lSFileInPdf);
> > >      Log.print("Check --0");
> > >           if (objPdfReader != null) {
> > >             objPdfStamper = new
> > > PdfStamper(objPdfReader,
> > >                                    new
> > > FileOutputStream(lSFileOutPdf));
> > >             Log.print("Check --1");
> > >           }         
> > >           if (objPdfStamper != null) {
> > >             Log.print("Check --2");
> > >             AcroFields form =
> > > objPdfStamper.getAcroFields();
> > >             pdffields = form.getFields();
> > >             lSKeyString = pdffields.toString();
> > >             Log.print("KeyString" + lSKeyString);
> > >             KeyArray = GetKeys(lSKeyString);
> > >             for (int fieldcount = 0; fieldcount <
> > > KeyArray.size(); fieldcount++) {
> > >               String lsKey = (String)
> > > KeyArray.get(fieldcount);
> > >               String lSValue = "";
> > >         String lsKey1="";
> > >               if (lsKey != null &&
> > > !lsKey.equalsIgnoreCase("")) {
> > >                 //Log.print("INSIDE KEYCHECk");
> > >           Log.print(""+lSFileInPdf.lastIndexOf("/"));
> > >           Log.print("lSFileInPdf.indexOf(.pdf)
> > > ==="+lSFileInPdf.indexOf(".pdf"));
> > >           Log.print("Key Substring ==
> > >
> >
> "+lSFileInPdf.substring(lSFileInPdf.lastIndexOf("/")+1,lSFileInPdf.toLower
> > > Case().indexOf(".pdf")));
> > >           String temp1 =
> > >
> >
> lSFileInPdf.substring(lSFileInPdf.lastIndexOf("/")+1,lSFileInPdf.toLowerCa
> > > se().indexOf(".pdf")).toLowerCase();
> > >           Log.print("temp1 ==="+temp1);
> > >           Log.print("LSKEY =="+lsKey);
> > >           Log.print("LSKEY.indexof(temp1)
> > > =="+lsKey.indexOf(temp1));
> > >           lsKey1 = lsKey.substring(temp1.length()+2);
> > >           //lsKey1 = lsKey.substring(8);
> > >                 Log.print("lsKey1 = " + lsKey1);
> > >                 if (objHashMap.get(lsKey1.trim())
> > !=
> > > null) {
> > >                   lSValue = (String)
> > > objHashMap.get(lsKey1.trim());
> > >                   Log.print("lsKey" + lsKey);
> > >                   Log.print("lSValue" + lSValue);
> > >                  
> > >
> > objPdfStamper.getAcroFields().setField(lsKey.trim(),
> > > lSValue.trim());
> > >                 }
> > >               }
> > >               //Log.print("lsKey" +lsKey);
> > >               //Log.print("lSValue" +lSValue);
> > > 
> > >             }
> > >           }
> > >           objPdfStamper.close();
> > >           objPdfReader = null;
> > >         }
> > >         }
> > >       }
> > >       if (PDFOPArray != null) {
> > >         Log.print("Check --3");
> > >         String out_pdffinal = "";
> > >         int n = 0;
> > >         PdfImportedPage page;
> > >         Document document = null;
> > >         PdfCopy writer = null;
> > >         PRAcroForm form;
> > >         for (int j = 0; j < PDFOPArray.size();
> > j++) {
> > >           String out_pdf = (String)
> > PDFOPArray.get(j);
> > > 
> > >           if (j == 0) {
> > >             Log.print("Check --4");
> > >             Log.print("out_pdf" + out_pdf);
> > >             if (out_pdf.indexOf(".pdf") != -1) {
> > >               out_pdffinal = out_pdf.substring(0,
> > > out_pdf.indexOf(".pdf"));
> > >             }
> > >             Date objdate = new Date();
> > >             long llDate = objdate.getTime();
> > >             //DateFormat objDateFormat = new
> > > SimpleDateFormat("ddMMMyyyy");
> > >             //lSDate =
> > objDateFormat.format(objdate);
> > >             Log.print("TimeStamp" +
> > > Long.toString(llDate));
> > >             out_pdffinal = out_pdffinal +
> > > Long.toString(llDate) + ".pdf";
> > >             Log.print("Output File Path" +
> > > out_pdffinal);
> > >             lSFinalOutPdf = out_pdffinal;
> > >             Log.print("Check --5");
> > >             Log.print("out_pdf" + out_pdf);
> > >             objPdfReader = new PdfReader(out_pdf);
> > >             n = objPdfReader.getNumberOfPages();
> > >       PdfDictionary dict =
> > objPdfReader.getCatalog(); 
> === message truncated ===
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to