Spire.net Excel to PDF Conversion with Barcode Font - azure-web-app-service

We are using Spire.Xls library to Convert Excel files to PDF after some transformation.
Things were working fine until we upgraded Spire to latest version.
The document is generated fine, but it doesn't renders Barcode font which we have specified in the Excel Template. It shows numeric digits instead.
We are hosting application in Azure App service, so we can't install those Fonts there.
After going through latest guidelines, it appears that the framework has new approach to embed private fonts to the excel, However it seems like there is some issue related to Font caching.
After adding custom fonts, the barcode appears in the generated PDF. However, it appears only for the first request. All subsequent requests after first request are not loading the document with correct barcode. It shows plain numeric number instead.
Here is the code snippet we tried based on latest documentation.
var fontPath = HttpContext.Current.Server.MapPath("~/ExcelDocuments/idautomationhc39m_free_version.ttf");
Workbook document = new Workbook();
var fontArr = new string[] { fontPath };
document.CustomFontFilePaths = fontArr;
var res = document.GetCustomFontParsedResult();
document.LoadFromFile(template);
//Further processing
document.SaveToFile("d:\\test.pdf", Spire.Xls.FileFormat.PDF);
Does any one had same issue?

Thanks for COMMUNITY EXPERT ryanchill's answer.
App Services are sandboxes and certain workflows therefore aren't supported such as PDF generation. To get around this issue, you can deploy your app as a docker container image with the fonts you need installed on it.
Due to App services are PaaS services, they cannot be supported when it comes to relying on third-party application support (such as Microsoft Office) or system-level (fonts, etc.).
Related Posts:
How to upload custom fonts to Azure AppService and use them in the PDF reporting?

Related

Electron Nodejs - I need to make a pdf viewer embedded in the web content

I'm making an application to sign pdf's and I need to make the pdf of it can be seen in the web container, that only the first page can be seen, that it can not be navigated, that it does not have a tool bar, that it can not be zoomed, only one preview of it. I could do this with the version of Electron 1.8.8, with the later versions it is not possible, because it makes me a download of the pdf, I need electronic features of newer versions. some have an idea how to do to see the pdf as in the example image.
Example with Electron 1.8.8

Using HTML Help Workshop 1.3 and HTML5 and Javascript DOM and targeting Windows 10 with HTML Help files?

I am working with HTML Help sources that were generated by converting an older WinHelp help sources (converted from the .RTF files that were edited with Word using a Microsoft conversion tool). This source has not been touched since it was converted and some preliminary work done sometime around 2014 or earlier.
I am currently using Visual Studio 2005 with a Windows 7 PC to update this HTML Help source. I have created a project and added all the various sources: HTML files, BMP files containing images, a file containing JavaScript and a file containing CSS. The older WinHELP based content used a lot of popups which the conversion put into individual files and by just merging these small files used in only a single place, I have reduced the number of files by a third.
The first thing I am doing is cleaning up tags by hand, eliminating files by merging and rewriting content, and changing the old style markup to use more modern CSS.
My target for the help files is desktop users of Windows 7 and Windows 10. I am planning to move to Visual Studio 2015 with this source once I have the basics cleaned up. I have done a test project converting the VS 2005 to VS 2015 and the conversion seemed to work fine and the HTML source to compile into a .chm file that was usable.
From what I can find, it appears that HTML Help Workshop from Microsoft is being maintained but is no longer under active development. The last version seems to be 1.32 published in 2012 though it is for HTML Help version 1.4 according to the HTML Help Workshop and Documentation download page. See also Microsoft HTML Help 1.4 in Microsoft Docs.
Visual Studio 2005 is indicating that some of the markup, which I think is HTML4, is deprecated. The html help source seems to compile to a .chm file fine anyway and the resulting .chm file works fine under Windows 7.
I am a bit confused about this compiling process. My impression is that the workshop compiler packs all of the various .html files together along with a couple of files it generates and then compresses it all into a single archive.
Does this mean that the HTML standard I use depends on the Microsoft browser, Edge I assume, and what HTML standard it supports?
This question really means is there any dependency in the HTML Help Workshop that means I can not use HTML5 or the newer CSS?
There is some, simple Javascript which uses div tags for some basic user interaction. That works just fine. Can I expect that whatever Javascript HTML DOM is supported by Microsoft Edge is available for use with this help text?
You know Windows HTML Help is delivered as a LZX compressed binary file with the .chm extension. It contains a set of HTML files, a hyperlinked table of contents, and an index file. The file format has been reverse-engineered and documentation of it is freely available e.g. Unofficial (Preliminary) HTML Help Specification
The file starts with bytes "ITSF" (in ASCII), for "Info-Tech Storage Format" (see Microsoft's HTML Help (.chm) format documentation). The CHM can be opened using FAR HTML like shown in the screenshot of this SO thread to get CHM details from help ID
Please note the aged Internet Explorer is used inside HTMLHelp Viewer (hh.exe) for rendering the HTML content. HH.EXE is distributed with HTML Help so you can rely on it being present. It lives in the Windows folder and has a limited number of command-line options. HH.EXE is associated with .CHM files. So double-click a *.CHM file and Windows will open the file using HH.EXE. Its a very small file like a wrapper, it mostly passes the help filename onto a HH API library.
The Edge browser is not used in this context. Many things still work with the more than 20 years old HTMLHelp, such as the integration of SVG. But, I recommend not to use the standard HTML5 completely and to be very careful. The content itself should be as easy to maintain as possible. This can also be achieved with a simplified HTML.
You may know Microsoft is building a Chromium-powered web browser that will replace Edge on Windows 10. I'm not sure how Microsoft will integrate the required Internet Explorer rendering engine to support the CHM Viewer in this future environment.
It's a bit dated but please read Make your CHM Help Files show HTML5 and CSS3 content . See as well Web Browser Control & Specifying the IE Version which discusses using the X-UA-Compatible HTML meta tag.
See this about that tag, What does <meta http-equiv="X-UA-Compatible" content="IE=edge"> do?.

vector graphics in MS VSTS Wiki

Using the latest online version from VSTS.
Is it somehow possible to use vector graphics in the vsts wiki?
I know I can't upload a .svg as attachment (only png, jpeg and gif) but is there any other approach?
In the end, it is just static file serving. Using markdown, I can use any url to a public .svg and the image gets rendered correctly using the VSTS wiki. But I can't upload the graphic on my own. Also it has to be uploaded inside VSTS, a public file hosting location is not allowed.
My Idea was to upload the vector graphic inside the code section and inside the wiki to reference to the corresponding .svg. But I cannot or simply don't know how to get the full url to the .svg.
Any hints for that?
You can use the markdown for image syntax (![Text](URL)) to show vector graphics on wiki page (but the xml format hass not been supported yet).
While to get the url for a local .svg file, you need to hosted .svg file to a place with http protocol supported. But it seems there has no free site to hosted .svg files. And you can also refer the post free and convenient svg hosting.

word document viewer browser plugin

Is there a browser plugin or an extension that allows the user to view .doc files in browser?
I need to embed in my application, a document viewer. So far, I tried using services like google docs, but this solution doesn't work for our application, because of some security problems.
Do you know about the Office Web Apps? Microsoft developed something similar to Google Docs and you can use the Word Web Application to view Word files. It will pretty much display anything - a lot of editing functions from the offline version are not available though.
If you are just looking for a viewer search for "Word ActiveX Viewer" and you will find plenty (commercial) viewers.
To have IE open the .doc within the browser and not in a separate winword.exe, you need to define the association at client end.
As .doc file is an external resource to HTML, it would download the file into its temp, and then attempt to launch it. It would launch it using the default program that it is associated with.
To control this behavior, please have a look at:
http://www.shaunakelly.com/word/sharing/opendocinie.html
I thought Internet Explorer + Microsoft Office used to do this by default?
I can for sure tell you that other than converting the doc to html you won't get a cross-browser, cross-platform solution.
Since you are saying it's for viewing only, that would seem like the way to go.

Adding an 'paste screenshot' option to Mantis bugtracker

We're using the Mantis bugtracker (version 1.1.8), which is based on PHP. To ease the workflow of adding bugs we'd like to add an option to paste screenshots from the clipboard directly into the 'new bug form'.
Screenshots make bugreports much more valuable for developers, so I'd like to make adding them as easy as possible. Preferably without using an external application, but right in the browser.
I've looked all over for a way to add this, but no luck. How do other people do this? Am I missing something obvious?
edit: The bugtracker is a private one, in a small company, so I'd be willing to accept the security risks that for example Java applets present.
There isn't really a way to do this short of using ActiveX, applet or Flash-type technology on the client. Even then, there are numerous security roadblocks. A browser has no easy way to convert stuff from the clipboard into a suitable format for upload to a website, and even if it did there would be security concerns. For example, malicious code in a page could copy sensitive information from your clipboard and send it to the page's site without you even knowing it was happening.
Update: There is a standalone screen capture utility which claims to work with Mantis (and a whole bunch of other bug-trackers). This is probably your best option.
There is a drag n drop image attacher Java applet for Atlassian Confluence which has the functionality you need. It only supports Confluence but as the sourcecode is freely available under BSD you should be able to customize it to your needs.
Forgot the link:
http://confluence.atlassian.com/display/CONFEXT/Drag+and+Drop+Image+Attacher+Plugin
I've managed to build my own solution that works quite well. It places a Java file upload applet on the pages where you'd want to attach a screenshot. The applet has two buttons:
'paste screenshot', which pastes an image from the clipboard into the applet
'upload screenshot', which uploads the pasted image to the /tmp dir on the Mantis server and uses a javascript callback to place the autogenerated filename of the uploaded image into a form field.
Once the form is submitted, a new function in Mantis uses the filename in the form field to move the image from /tmp to the final location and processes the image just like other attachments. If the form is never submitted the uploaded file remains in /tmp and will eventually be purged by the server.
It works well, but has one drawback that I cannot avoid: I'm using Java to get access to the client's clipboard, but that requires breaking the JVM sandbox. Apparently, this can be done if you digitally sign the applet, which requires a rather expensive yearly payment (something like $500) to a company like Verisign (currently free options like cacert.org are still limited in their usefulness).
Another way to allow Java applets access to the clipboard is to create a file called .java.policy in your home or profile directory. This file should contain the following (Replace the domain with the domain that hosts your Java applet):
grant codeBase "http://bugs.example.com/-" {
permission java.awt.AWTPermission "accessClipboard";
};
Thankfully the solution is cross-browser compatible since the JVM always checks the same file regardless of the browser used. Since my solution requires having this .java.policy file on each client computer I don't consider it ideal, but workable in a controlled company environment.
I looked in to this also. No real easy way, so instead I allowed them to upload an unlimited number of files and those files would then be "attached" to that bug. It actually turned out to be better because they can upload screenshot, spreadsheets, word docs, etc.
Like yours, this is an internal only site so security is light. I did this in ASP.Net, but the general idea is that when they are looking at a page for a bug they have an upload box. When they upload something I pre-append it with the bug id. So ScreenShot.jpg becomes 233_ScreenShot.jpg.
Also on that page is a grid (GridView) that is bound to all of the filenames in my upload directory that start with that bug id.
To see what this looks like click here.
For tech-oriented users, there's always to possibility of using Eclipse + Mylyn + Mylyn-Mantis connector.
Then uploading screeshots is very easy:
Screenshot upload http://img216.imageshack.us/img216/246/screenshotattachments1.png

Resources