iText Pdf Merging Checkbox Issue -
we using itext pdf api version 5.5.3 , trying merge pdf documents contain checkboxes , write pdf document in servlet output stream , displays in iframe.
it works in ie(tried in 11) checkbox doesn't appear in chrome(tried in 52).
below sample code use display pdf.
inputstream in = docfile.getimage() .getbinarystream(); reader = new pdfreader(in); pdfreaderlist.add(reader); document = new document(pagesize.a4); bytearrayoutputstream = new bytearrayoutputstream(); pdfcopy copy = new pdfcopy(document, bytearrayoutputstream); document.setmargins(35, 35, 48, 75); document.open(); copy.setmargins(35, 35, 48, 75); // add document iterator<pdfreader> pdfreader = pdfreaderlist.iterator(); while (pdfreader.hasnext()){ pdfimportedpage page; reader = mcpdffilewriter.unlockpdf(pdfreader.next()); (int currentpage = 1; currentpage <= reader.getnumberofpages(); currentpage++) { page = copy.getimportedpage(reader, currentpage); pagenum++; copy.addpage(page); footernameslist.add(filename); footermap.put(footermap.size() + 1, filename); } } document.close (); reader.close(); copy.close();
i gone through link , given solution seems working when use below code -
inputstream in = docfile.getimage() .getbinarystream(); reader = new pdfreader(in); pdfreaderlist.add(reader); document = new document(pagesize.a4); bytearrayoutputstream = new bytearrayoutputstream(); pdfcopy copy = new pdfcopy(document, bytearrayoutputstream); document.setmargins(35, 35, 48, 75); document.open(); copy.setmargins(35, 35, 48, 75); **copy.setmergefields();** // add document **copy.adddocument(reader);** document.close (); reader.close(); copy.close();
however face outofmemoryerror , looking idea if there known issue copy.setmergefields();copy.adddocument(reader);
, how can overcome ?
a bug reported in chrome ( in thought of plugin issue) , sample pdf attached there
Comments
Post a Comment