OleContainer - Opening a doc file from http? - delphi

I need some info about OleContainer. I embedded an OleContainer in the browser. And when I launch that html file,a microsoft word OleContainer is opened and I want to display content of a doc file from the web. For example, when I open html file, OleContainer should view the content of the www.example.com/example.doc which is a doc file inside of it.I hope I clearly explained the problem. Thx for any advice.

Do you need a OleContainer? Objects can be embedded in HTML using the standard HTML <object> tag. See for example
embed content in valid strict HTML
Embed a MS Office document in HTML webpage
This has also the advantage that it is cross-platform (as long as the document type is known on the client computer).

You need download the file from http-server (using sockets or WinInet library) to temporary directory and load to TOLEContainer using CreateObjectFromFile method

Related

How to convert PDF web links to file open actions with python pdfrw library

I'm using pdfkit to convert html to pdf which works great, but the external links in the pdf are web links.
The pdf viewer that we are using does not recognize the pdf web links, but file open actions do work.
I've been trying to change the pdf link annotation from a web link to a file open action with the pdfrw library.
I tried to edit the pdf annotation with the following code, but it's not working.
annot.A.update(pdfrw.PdfDict( S='/Launch'))
annot.A.update(pdfrw.PdfDict( F={}))
annot.A.F.update(pdfrw.PdfDict( Type='/Filespec'))
annot.A.F.update(pdfrw.PdfDict( F='(part-1.pdf)'))
annot.A.pop('/Type')
annot.A.pop('/URI')
The link shows up in the new pdf, but there is no action or destination file associated with it.
So after a similar battle today...
you can't define S='/Launch' as string like that. You have to use:
annot.A.update(pdfrw.PdfDict( S=pdfrw.PdfName('Launch')))
Similarly with filespec etc. You may also need to take the () off the filename - as that seemed to break it, at least in Apple Preview.

How do i display files from a users OneDrive using the Microsoft Graph Api

I'm currently working with the OneDrive API to get files from a users OneDrive.
I need to be able to display a file from OneDrive dynamically, depending on what element a user clicks on.
I Know that I can go into my OneDrive and get a Embedded Link that I can use to display a file from my OneDrive, but this is not what I need. I attempted to use the Embedded Link combined with data binding but the link requires a authorization token unique the initial embedded link.
Essentially I want a user to click on a element corresponding to a OneDrive element (eg a file or pdf). Then have file will display in a IFrame on the page.
For Office documents, you can use the webUrl property from a DiveItem. This URL will open the document in the editor associated with that file type. For example, navigating to the webUrl for a .ppt file will open that document in PowerPoint Online.
For other files, the webUrl property simply points to the file itself. What happens when you navigate to that address will depend on the file type and what applications you have installed. Navigating to a .pdf generally will show that file in the browser (most browsers support PDF) but other files may not have an application and therefore just download to the local machine.
You can open the URLs into an iframe but be careful to ensure you're UI is taking up minimal screen area. Also make sure you're page is responsive so users can use the app in a smaller window and/or mobile device without your UI eating up so much canvas that they can't see/use the document itself.
here is an example of a creation of an edit link in onedrive, you can change the type of edit to embeed to get what you want, this is in php utilizing laravel, the graph api with the docs https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/item_createlink
public function getEditableEmbeed($itemid){
$this->refresh();
$file = $this->getGraph()->createRequest("POST", "/me/drive/items/".$itemid."/createLink")->attachBody('{ "type": "edit", "scope": "anonymous"}')->execute();
return $file;
}

Creating Epub on the basis of Template

I have been working on creating Epub for my work. I have used Aspose to create the Epub. In this process numerous word document is merged together and single epub file is created. Now I am asked to create an EPub based on a template. I have been searching a way to do it but I am no where near to the solution. I haven't even found the template for Epub which will render smoothly over various devices IOS and android. Similarly I have no clue how I will achieve this task programmatically. If anyone out there have any idea please provide me an insight.
As you may know an ePub is a file that contains a lot of html pages. if you want to create a template based epub programmatically you should link this files to a css and modify the structure of the html as the template.
If I were you I would use a regex to edit the html files, get the contents and place this contents in a new html page. Once done that I would place the html page in the epub.
I suggest you please create the template document (DOTX) using MS Word. Import this template document into Aspose.Words' DOM, merge Word documents, do other document processing tasks, and save it to EPUB using Document.Save method. You may also create the template document programmatically using Aspose.Words. I work with Aspose as Developer evangelist.

OpenERP Reports always in PDF

I'm new in OpenERP and I'm starting to know the application.
I hope you allow me to post this kind of questions on the forum.
Whenever I issue any listing or report in OpenERP, the application generates a PDF file to be opened or downloaded. Is there any way to make these listings and reports directly into a browser window so I can print them directly from the browser instead of download/open PDF files?
Thank you very much
Paulo Matos
[https://code.launchpad.net/~openerp-india/openerp-india/web_pdf_viewer-pga
You can use this module to open directly in browser.
Just copy this module to your web/addons folder of openerp web
Hope its work

How do I embed javascript (to open dialog) in PDF in Report Builder in Delphi

I need to show an Adobe PDF Reader print-dialog when someone opens this PDF through our webportal.
Now I stream a PDF through my existing webportal made in Delphi XE2. I generate the PDF's in Waler's TExtraDevices, a component that extends Report Builder 14.07 for Delphi.
I read somewhere, that I can embed JavaScript in a PDF to trigger the print-dialog to show.
How/where do I inject/place the JS in the Waler TExtraDevices PDF generator? It IS an option to use the native PDF generation of Report Builder itself (but I'll have to check if they support embedding subsets of fonts, because the first versions of their PDF engine produced too large PDF's). So an alternative question may be: How/where do I inject/place the JS in the native PDF generator of Report Builder?
I've checked the manuals, the web and StackOverflow but can't find anything about how to accomplish this.
If you do not mind a solution which involves a separate post-process, you could use a library like Debenu QuickPDF to update the PDF to add a Javascript action which opens the print dialog on document open. They have a trial version which would enable you to verify that it works with your specific PDFs.

Resources