iText create document with unequal page sizes

I’ve created an UnequalPages example for you that shows how it works: Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(dest)); Rectangle one = new Rectangle(70,140); Rectangle two = new Rectangle(700,400); document.setPageSize(one); document.setMargins(2, 2, 2, 2); document.open(); Paragraph p = new Paragraph(“Hi”); document.add(p); document.setPageSize(two); document.setMargins(20, 20, 20, 20); document.newPage(); document.add(p); document.close(); It is important to change … Read more

What’s the most concise cross-browser way to access an element’s window and document?

There’s an easier way that’s been around longer… use window.frames to get a reference to the frame’s window object. By name or id: var iframe_doc = window.frames.my_iframe.document; or if you prefer: var iframe_doc = window.frames[‘my_iframe’].document; or by index: var iframe_doc = window.frames[0].document; Good reference for window.frames here: http://developer.mozilla.org/en/DOM/window.frames An excerpt: each item in the window.frames … Read more

How do I convert a org.w3c.dom.Document object to a String?

use some thing like import java.io.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.stream.*; //method to convert Document to String public String getStringFromDocument(Document doc) { try { DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.transform(domSource, result); return writer.toString(); } catch(TransformerException ex) … Read more

How to open the Document files e.g(.pdf,.doc,.docx) in ios mobile when a button action using swift3.0?

Swift 3*, 4*, To open document and select any document, you are using UIDocumentPickerViewController then all documents presented in your iCloud, Files and in Google Drive will be shown if Google Drive is connected in user device. Then selected document need to download in your app and from there you can show it in WKWebView, … Read more

Solr documents with child elements?

As of Solr 4.7 and 4.8, Solr supports nested documents: { “id”: “chapter1”, “title” : “Indexing Child Documents in JSON”, “content_type”: “chapter”, “_childDocuments_”: [ { “id”: “1-1”, “content_type”: “page”, “text”: “ho hum… this is page 1 of chapter 1” }, { “id”: “1-2”, “content_type”: “page”, “text”: “more text… this is page 2 of chapter 1” … Read more

javascript to get paragraph of selected text in web page

This is actually rather hard to do because you have to consider six cases: The selection is not within a paragraph (easy); The entire selection is within one paragraph (easy); The entire selection crosses one or more sibling paragraphs (harder); The selection starts or ends in an element not within a paragraph (harder); The paragraphs … Read more

Difference between screen.availHeight and window.height()

window.outerHeight It’s the height of the window on screen, it includes the page and all the visible browser’s bars (location, status, bookmarks, window title, borders, …). This not the same as jQuery’s $(window).outerHeight(). window.innerHeight or $(window).height() It’s the height of the viewport that shows the website, just the content, no browser’s bars. document.body.clientHeight or $(document).height() … Read more