How can I replace one or multiple lines in the code editor with a WebView, File Preview or an Image? - vscode-extensions

I'm trying to develop an extension that needs to render text, images and the preview of an external file in the code as a decoration. The problem is that I only can find text decoration and nothing that allows me to for example show a PNG between two lines of code without modifying the file.
Is this possible or I need to create a Custom Editor using the API? The problem of this solution is the need to integrate all the extension on the language I'm working what will take too much time.
I have seen the Comments API allows to show the reference of a text file but I can't find where is the API to generate this type of views:
The closest thing I can find is the Comments API with this sample. However, I need to add more than just text and the idea is to only show the content, nothing more.
Any guide, information or reference is highly appreciated.

Related

Using a Pre-Made PDF for jsPDF

I am using jsPDF to build my PDFs in my Quasar/Electron app. I have PDFs that I need to use as the base for the output, and I would love to be able to use that instead of building the whole PDF line by line. Does anyone know if this is possible?
This is an example of the PDF I need to use:
Score Sheet
I need to fill in the various details such as Call Name, Breed, etc. I'm not sure if it's possible to specify the exact position of the data while using the pre-made PDF.
Thanks for help!

Use leaflets over pdf files using angularjs

I am trying to do something like this
leafletoverimage.
Currently I am using background image and angular-leaflets tool for the click and comment.
I am trying to find out a way where I can have pdf file actually rendering on browsers, and able to click on different section of pdf file, have popover and enter comment about that section.
This is similar to what https://app.fieldlens.com/ and www.plangrid.com is doing.
is there something available in angularjs or any other solution is appreciated.

Displaying thumbnail image in a View

I've a database with image (1 document contains 1 image).
This database is used in other application via "PickList" so user can select image they want (right now they just see a filename and that's it). Once user selected an image - we display it in IBM Notes client via html. However the issue is - user must guess if he select the right image and to avoid 'guessing' I would like to show thumbnail version of image in PickList.
So far I found only one way to do that (for every image I've in database I will create a image resource element in design. In that way I can display it in a View (in a column).
What other ways to achieve this you know?
Please consider any ways you know, I'm not limited to using views only, it could be Dialogs, generating something in RTF field dynamically, OLE, Java etc. Basically I'm very very open minded to another solution.
Environment: #IBM Domino/Notes R9.
Since you are using Domino 9, how about developing in XPages? If you are going to switch to an HTML frame in the Notes client to look at the image anyway, you may as well select from an HTML frame, too. You can use XPages for Notes clients, not just web clients.
Using common XPage controls, you can develop dynamic HTML pages from Notes views and documents. You could for example develop an XPage to display a list of choices from a view - including file attachment names and/or the actual file attachments.
It is absolutely doable with XPages. Checkout OpenNTF.org for lots of examples.

How to create switchable multi-language pdf form?

I want to create a pdf form for two language (Chinese/English) UI, and there's a button(s) or somethings on the form for language switch, is there anyway can make it? and how to do?
thanks!
Thanks for all reply!
Actually I got a sample like this,
PDF Sample
there're two checkbox on the top-left of the form, one is for English UI, the other is Chinese, I just want to know how to make PDF like that sample? (and I don't see any layers on the sample...)
thx
mkl's comment (which he should turn into a full answer, really) already hinted at the option to use different page templates residing in the same file.
Another option you could explore is this:
put the two language versions into 2 different layers (or 'optional content groups' in PDF parlance)
make the visibility of the two layers toggeable
let the user activate that layer which he/she needs.
Layer activation can be handled through normal Acrobat Reader user interface elements.
The layer switching can be made accessible via a "button" on the PDF page too -- but that requires additional JavaScript to be embedded in the PDF (something many people are not particularly keen about).
As Kurt proposed, I make my comment on Frank's answer an answer in its own right:
Actually there is a pdf feature seldomly used nowerdays, page
templates. Thus, those two forms can reside in the same file in
different page templates, and based on some initially present buttons
("English version", ...) the desired form is spawned.
Unfortunately I don't know how to create page templates using some easy-to-use tool, I only came a cross them in the context of integrated PDF signatures (depending on the signature type, page template instantiation is a document change not breaking the signature) and tested them with low-level tools.
Essentially page templates are PDF objects just like page dictionaries of the normal pages, they are not XFA stuff. They merely are not referenced in the pages tree but instead in the name tree.
There is a JavaScript command which creates a visible page based on such a template --- I don't know which anymore; I may be able to find out when I'm back in office next week. This command would have to be bound to the inital language selection button in the file.
The problem will be in switching the static text - PDF does not allow this.
If I were you, I would split the document into two identical forms in the respective languages. You can use bookmarks and links on the first page to navigate to the right part of the document.
Note that it is possible to assign the same field names to the Enlgish/Chinese versions of your fields. This will make it easier to process the submitted form data because the process path would be independent of the chosen language. It will also simplify any JavaScript (validation, summing, etc.) you plan to add.

How do I embed a source PDF onto an existing page in a PDF?

I need to programmatically embed an existing PDF (a small graphic) onto a specfic page on an existing PDF. Using iTextSharp I've been able to add a new page containing this embedded PDF, but what need is to modify an existing page by adding this graphic. Is this possible using iTextSharp or any other PDF-generation libarary?
I tend to do this sort of thing using Context, which is a Tex-based layout tool that in integrated into the pdftex Tex/Metapost engine. There's a learning curve involved, and installing Context isn't entirely trivial, but it makes very general programmatic document processing involving PDFs easy once you get the hang of it.
For this problem, you'd define two overlays, with the first overlay being the main PDF that you set to a background, and then on the page you want to change, defining a foreground overlay with a \setlayer command, which contains a single \framed box, which superimposes the second PDF using a \externalfigure command.
The nice thing about Context for this kind of task is that it works with PDF as its internal representation all the way through, so there is no unexpected blow up in file size or deterioration in image quality, which you can get with other tools that convert between formats.