How to display/render XHTML source code directly after pasting? - selenium

In my current use of Arquillian, it makes a lot of sense to debug functional tests with Graphene (wrapping Selenium) with WebDriver.getPageSource in the debugger which allows to easily copy the XHTML code into the clipboard. However, I need to create a temporary document in an editor, save the file and open it in a browser.
Is there any browser or website which allows to paste XHTML source code and render it (directly or in an IFrame)?

WYSIWYG editors are available for free on websites, e.g. https://html-online.com. Of course, the CSS isn't included, but it won't if the file was saved like described in the question.

Related

Edit texts in a PDF on Chrome using Chrome inspect

Is there any way to modify texts in PDF on Chrome using the Chrome inspect tool? I was stuck because in the Chrome inspect element, differently than any other websites and even PowerPoint presentations opened in Chrome, I'm able to modify texts, while with PDFs I cannot. Does anyone know how to do it?
Edit: Yes I know that the changes made through Chrome DevTools are temporary, but usually I'm able to make those changes, even if they're temporary. But with PDFs I can't.
There are differences in the way some browsers handle PDF data.
Chromium based browsers are more traditional in that the PDF plug-in is based on a Foxit/Skia collaboration, So you need to understand in that case, the downloaded PDF you are viewing is in the binary application/pdf (file already outside of the html wrapper).
Just as you cannot edit the PDF text in Acrobat Reader, the most you can do is incrementally add comments/annotation or field data to the end of the file, before save as a secondary download. The server cannot see your changes unless you submit as an upload.
With Firefox and Google docs there is often a different approach where the PDF is "Repr"oduced as an "Ex"ample (A ReprEx of the PDF) so it is built of a hybrid image and text overlay to emulate that part of the real PDF source. When you previously or later save the underlying downloaded PDF (for viewing) it would not necessarily include any browser based HTML editing, in the saving.
There are other techniques for other cases, but to answer the basic OP question most simply, the answer is NO you cannot change a PDF body, only add notes, etc via extensions. Microsoft variant of Chrome I.E. Edge has some inbuilt annotation ability thus does not need a second extension.
Found this question because I was googling a similar situation--I was wanting to manipulate type sizes and margins on a PDF in inspector via Chrome. I found that FireFox DevTools will allow you to view those styles and even alter the content in the PDF while in browser. I am late to the game but hope this provides answers for someone else in the future.

How to embed PDF viewer in DSPACE

How can I embed PDF viewer in my DSPACE instance. I have tried many solution but nothing works. There are many suggestion on DSPACE official site
https://wiki.duraspace.org/display/DSPACE/Document+Viewer+Integration
No soluton has a documnetation how to configure these viewer in dspace code.
I want a step wise soultion for embeding PDF Viewer. Please help me out of this problem. Thanks in advance.
I have researched through these site -
https://wiki.duraspace.org/display/DSPACE/Document+Viewer+Integration
http://peterpants.blogspot.com/2010/02/document-preview-in-dspace-using-google.html
It depends which version and which UI of DSpace you are using. I will describe roughly what we did to embed PDF.js into DSpace 6.3 JSPUI. We released all necessary code changes on github, so please take a look over there for details.
DSpace uses maven overlays to separate local code changes from the officially released code. Therefore, I will use paths within these overlays in the following description. If files that we changed do not exists within your local code repository, you have to copy them from there original location within [dspace-source]/dspace-jspui/src/main. It should also work if you do the code changes directly there, but I would consider that bad practice.
We added PDF.js and all files it needs to dspace/modules/jspui/src/main/webapp/static/pdfjs. We then changed dspace/modules/jspui/src/main/java/org/dspace/app/webui/jsptag/ItemTag.java. This class builds the item view. While I wish there would be a better separation of concerns, some HTML code is generated by this class, including the section of the item view that list all bitstreams. For every file that is listed, we check if its mime type is set to application/pdf and add a "preview" button for those files. The preview button links to the html site that renders the pdf viewer and loads the targeted file. We also added an attribute "download" to the default "Open/View" button, to ensure that it does not start another PDF viewer of the browser, but downloads the file. This is important to have one button called "preview" that opens the embeded PDF viewer and one button "download" that downloads the file to the user's computer. You can change the name of the button from "open/view" into "download" in the DSpace's message catalog. Last but not least we added JavaScript to dspace/modules/jpsui/src/main/webapp/display-item.jsp. The JavaScript suppress that the PDF viewer is loaded as a normal site, but loads it as an overlay over the item view, using JQuery UI. Then we wrote a small CSS file that helps us to position that overlay within the item view and referenced that file in dspace/modules/jspui/src/main/webapp/layout/header-default.jsp.
As mentioned above all these changes are published as open source under the DSpace Source Code BSD License on github.

IntelliJ/PyCharm - where do I change what happens when I double click a file?

I want PyCharm (IntelliJ) to display HTML-files in a browser, not open them in an editor, when I double click them in the project browser. Googling for a solution didn't return anything useful. Is this possible? How?
(This request also applies to PNG and some other filetypes but HTML is my main need at the moment)
Both IDEA and PyCharm are editors, and they will default to editing; that is, they will open the HTML file and allow you to edit it instead of displaying any kind of web page.
If you want to see the rendered HTML, you can hover to the top right corner and select one of the browsers recognized by IntelliJ and installed on your system to open it in a browser then. Be aware that this may not render things correctly if you rely on a language-specific functionality (like JSP, Jinja2 templates or Less) to generate code on your behalf.

In Cloud9 IDE how to beautify HTML code inside Javascript strings?

In Cloud9 IDE you can automatically format HTML codes, or Javascript codes. But once in a while you need to do the formatting not compatible with the containing file type. For example, when you are authoring a web component widget, you need to provide a template, which is HTML structures, in the form of a string variable residing inside a Javascript file. Currently the IDE simply ignore this patch of code, treating it as plain text strings. How can I format the HTMLs in this case? Thanks.
The IDE only supports one file format per file, so either Javascript or HTML or PHP, etc. Templating languages like Handlebars, Blade, or others that combine HTML with other languages are not supported for auto-formatting.
If you'd like to format these files, you'll need to do one of the following:
Use a CLI utility that supports the file type you're trying to cleanup.
Copy/paste the HTML into a .html file, format it there, then paste it back into your original file.
I'd advise you use #1 because #2 doesn't sound fun. The CLI utility you install/use will depend on what types of files you're actually trying to beautify.

Extract "cover image" from CHM and EPUB files

How can I programmatically and reliably create PNG images from CHM and EPUB files? The page that's needed is only the first one, as in "cover image thumbnail generation".
Could this even be done just from the command line?
I have already looked at the open-source CHM QuickLook plug-in for MacOSX for source that does this and at Calibre, the latter to no avail.
In CHM, the default page is a webpage (a .html file). Of course it can only contain one page.
An extracter program is easy to do based on chmlib or Free Pascal's libs, but it will need the html parsed to also find names of other programs to extract. Roughly the algorithm would be:
use some "list" function of a cmdline extract tool to get the default page's name. (this is stored in an internal record)
extract it, and parse it for img and other referencing tags.
extract those.
The biggest picture downloaded in the previous step is probably "it"!