PHPExcel: Custom font? - phpexcel

Is there a way to embed a font to the xls and use it with PHPExcel?
I want custom font because I want to use barcode font in the excel.
I tried to embed a barcode image but random dot appears when printing and the barcode scanner cannot read it.

There isn't. Excel relies on the range of fonts that exist on the client PC where the Excel document is opened. Where a font doesn't exist, it will fall back to members of the font family that exist on that client PC. In the case of a font referenced in an xls file where no member of that font family exists on the client PC, it simply cannot be rendered. This is standard MS Excel behaviour, not specific to PHPExcel-generated files.
The only alternative I can suggest is generating an image file of the barcode, and embedding that image in the xls file.

Related

Why does mpdf embed whole glyphs when the pdfa option is enabled?

Today I have found that PDF/A files generated by mpdf are very huge (I am using some CJK fonts), possibly due to inclusion of the complete glyphs. However, those created by commercial pdf applications (e.g. Adobe Acrobat, FoxIt, etc.) do embed subsets of the glyphs (for characters actually used in a document), even though the PDF/A option is enabled. Why does mpdf embed whole glyphs when the PDFA parameter is enabled?

Font of a webpage using custom font to trick scraper

A website I am attempting to scrape information off has decided to use a custom font that means all information in the code is a jumble of letters. For example: "aEfrg9" could look like "Booked" when under the use of the font. How could I scrape such a webpage?
My thoughts:
Download font from page
Somehow translate information I'm looking for into the code message font, eg. I want to find "guitar" in the webpage so my program translates it to "hGke8j" using the font file downloaded.
How would I achieve step 2?
I am using Python 3.X

Qt how to create font from image?

I need to use some custom font for numbers in my Qt app, but company ask me to use image as font, font file is not allowed(For example: ttf).
the font image like this:
So i wonder is possible to converting the font image to QFont?
like a Qt font generator.
Or any other solution?
There is nothing out of the box that supports what you are looking for. You would need to get around this company rule by building your own TrueTypeFont data programmatically from your image, keeping it in memory only and load that into your application with addApplicationFontFromData(const QByteArray & fontData).
Unfortunately I cannot find a single library that does this, and the TTF format appears dauntingly complex. I would suggest looking into this open source project for font creation. Perhaps you can use this as a starting point? http://fontforge.github.io/en-US/
You may want to find out the reason your company is telling you that you cannot use a custom font. (I just remembered reading that QT has difficulties storing a font as a "resource". If it's not due to copyright issues, then you could suggest not using an image, but storing the entire file in the source code in a text format like base-64. Then convert it back into binary at startup, then load it up as a new font from a QByteArray.
I guess it's about copyright issues ? There are lots of ttf fonts available for completely free commercial use. E.G. have a look at Droid Sans Mono : https://www.google.com/fonts/specimen/Droid+Sans+Mono
Otherwise it would be good to know the reason why ttf is not allowed.
It is possible to create a font from a vector graphic.
If you have resonable high resolution images of every letter (if not already vector graphics) you can try to convert them to vector graphics (SVG).
Afterwards you can use tools to convert SVG to a font. This would be most likely a ttf font which can be used with QFont.

How to Convert data:font to .ttf Font Format in CSS Font Face

I have a css font family like below(I have shorten it because of displaying limit otherwise it is much much bigger than what I have present here)
now can you please let me know that if there is a way to convert the url()content inti .ttf font formats or other standard font formatS ?
#font-face{font-family:'web_font';
src:url('data:font/opentype;base64,d09GRk9UVE8AAHUkAA0AAAAAvnQAAhOIAAAAAAAAAAAAAAAAAAAAAAAAAABDRkYgAAABMAAAXwMAAIcHbRkIAEZGVE0AAGA0AAAAGgAAABxoptAkR0RFRgAAYFAAAACWAAAA3hpVGOlHUE9TAABg6AAABf8AABkwdgAPiEdTVUIAAGboAAAGngAADSIYX0AXT1MvMgAAbYgAAABXAAAAYI8WBFNjbWFwAABt4AAAAZYAAAKquYd/vWhlYWQAAG94AAAAMwAAADYIcsC0aGhlYQAAb6wAAAAhAAAAJAuVB6xobXR4AABv0AAAA0cAAAaQAUI5cG1heHAAAHMYAAAABgAAAAYBpFAAbmFtZQAAcyAAAAHuAAAFH7QO6sRwb3N0AAB1EAAAABMAAAAg/h4AHnictLoHXFRH1zjMvbC7V9S1cRcFXVDBggTpxRbFrigWpCq997pUkY4w9N5BepMuoGI3WGNsURMTY0wsURITU2Zx8Hm+uQsui/F58/zf9/eBF2fOOXPanDnnzN0lpGRkpAiCmBLq4mjl4uXga+HiKEWQUoTUGuF0qeHTxPAZcvgpQ+');}
1) First of all you need to save the base64 string as a file.
Some of the online service is restricted to how much you can enter, so simple do this locally by just opening the base64 string in your browser and you will be promoted with save as dialog, choose any name you want
Alternative (if the browser don't allow you to enter such a long url) create a download link open the page in any supported browser that supports download attribute (chrome, firefox, opera)
download web_font
2) Then you need to figure out what file extension it's
With just the small amount of base64 string you provided me i was able to recognize it as a woff file, by looking at it with a hex/text editor. I uploaded the saved file to https://hexed.it and could read in the beginning that it said woff
So now you have your web_font.woff file!
3) Convert it to TTF with the right tool for the woff - format
I can google that for you and found for example fontforge that dose this and some free online service as well.
onlinefontconverter.com makes a good job at converting unknown formats by looking at the magic number instead of the file extension so you can have your ttf file directly. And you don't have to install any program either. But it doesn't tell you what the original file extension is.
Don't do this? If you have an actual font file, like a .ttf file, just use that in your CSS.
#font-face {
font-family: WhateverNameYouNeed;
src: url('location/to/your/file.ttf') format('truetype')
}
aaaaaand we're done. For universal acceptance, wrap it as a WOFF and then use that instead of the ttf OpenType font file, so that every modern browser supports it.
NOTE: you can't just blatantly convert your fonts, though. If you do not own the rights to the font, or the font does not come with a license that says derivatives are allowed, you are not allowed to convert this font.

Using PDF In .Net App

Can someone point me to some code/tutorial on how to upload pdf files and store them, then moreover how to use a pdf reader to display the file as read only in an asp.net application.
Is there a PDF reader already in the visual studio toolbox?
The approach I would use in this situation is to upload the PDF as you would any other file, then use a tool like GhostScript to convert the PDF pages into image files that you can show in ASP .Net.
Here's a tutorial doing that in C# http://www.codeproject.com/KB/cs/GhostScriptUseWithCSharp.aspx
Adobe provides (on acrobat.com) a free service which provides you with the ability to upload pdf (and also other types like doc...) and then embed a nice flash interface for displaying the files on your page.
It's pretty helpful as you can store some 5 gigs of files here.
But if you want to let the users upload their own files then this won't help you.
PDF is a final format file, ie its is read-only for the most part and can be embedded into the page via the <object> tag, except if you mean downloadable by the user.
Displaying PDF is generally done by rasterising to an image format for display (ie as an image on the page or via a richer interface (with zooming etc) through flash/silverlight etc.
You can use [GhostScript][1] to interpret PDF files and convert them to an image.
[1]: http://www.GhostScript .com
Uploading a PDF is just like any other file. Use the ASP.NET file uploader control:
http://www.codeproject.com/KB/aspnet/fileupload.aspx
In order to view the PDF in an ASP.NET application, you could either depend on Acrobat being there or use a PDF Viewer control.
The company I work for, Atalasoft, sells a PDF Reader add-on to our web viewer controls. You can learn more here: http://www.atalasoft.com/products/dotimage/pdf-reader

Resources