I am trying to manually install a font with ZPL. I have a TTF file and I believe I have the command. The issue is when I try to print with that font nothing gets printed.
I am able to upload the font to the printer with the following command
~DYE:COMIC.TTF,A,T,63040,,AAEAAA.......
Note I am truncating the data section, but I also believe this is where my issue is coming from.
After that command completes I can validate that the font is there by running
^XA^WDE:*.*^XZ
I see the COMIC.TTF font installed, but when I print a label with
^XA^FO50,50^A#N,50,50,E:COMIC.TTF^FDSAMPLE^FS ^XZ
Nothing is displayed. I believe the issue has to do with the font not being uploaded correctly. Any help would be appreciated.
I would like to thank https://stackoverflow.com/a/64333380/634911 for the big hint on how to do this. Instead of using the ~DY command to upload the font I ended up using the ~DU command. I believe they will do the same thing, but I managed to get it to work with the ~DU command.
The big issue that I was having was the encoding of the TTF font file. using the template from the mentioned stackover answer I wrote a quick demo program that encodes a TTF file saves it to the DRAM and is then able to use that file.
using System;
using System.IO;
namespace Font
{
class Program
{
static void Main(string[] args)
{
var dirPath = #"<path to directory> i.e. C:\user\";
var fontName = "comic.ttf";
var filePath = $#"{dirPath}{fontName}";
var data= BitConverter.ToString(File.ReadAllBytes(filePath)).Replace("-", "");
var fileSize = File.ReadAllBytes(filePath).Length;
var zpl =
$#"^XA^CI~DUR:{fontName.ToUpper()},{fileSize},{data}^FO100,0^A#N,100,50,R:{fontName.ToUpper()}^FDTESTSTRING^FS^XZ";
Console.WriteLine(zpl);
}
}
}
Related
I want to put an image on the Windows clipboard using VBA. I currently do this for text essentially as described here using the DataObject in the MS Forms 2.0 Library.
I want to do the same thing using an image file, putting the image on the clipboard instead of text.
My working code used for text is below, I have tried using the image file path as the variable but just stores the text. Also tried "SetImage" as a method but throws error as below.
Dim DataObj As MSForms.DataObject
Set DataObj = New MSForms.DataObject
DataObj.SetText str1 <--------------- works for string variable
DataObj.SetImage strImageFilePath <----------- Error Method not available
DataObj.PutInClipboard
I am using PDFLib 7 to generate mailing labels. I am having issues displaying French accented characters. For example, Maître Corbeau is displayed as Maître Corbeau. Similarly, SadÖ is displayed as SADÃ.
The simplified code that I am using is like this:
$pdfDoc = new PDFlib();
$pdfDoc->set_info("Creator", "Kits Communications");
// more document info settings
$pdfDoc->begin_page_ext($PageWidth, $PageHeight, "");
$font = $pdfDoc->load_font("Helvetica", "auto", "");
$pdfDoc->setfont($font, 9.0);
// get data in variables
$pdfDoc->show(strtoupper($NameLine1));
$pdfDoc->continue_text($AddressLine1);
If I display the contents on the page with echo, the string is displayed correctly. I believe that perhaps I need to define default character set to PDFLib. Could someone please advise the required command to be used for PDFLib 7?
The text I was writing into a PDFLib document is in UTF-8 format. If I send the text in ANSI format, the mailing labels appear correctly. I added the following command to convert text to the ANSI format.
$NameLine1 = iconv("UTF-8", "Windows-1252",$NameLine1);
This fixed the issue on Windows PC. Not tested on Mac.
I am using restructured text to document something. To use directive "code-block", the code seems always to be contained in a box in the generated document. For example,
.. code-block:: C++
:linenos:
:emphasize-lines: 2
void readIntegerFile(const string& fileName, vector<int>& dest)
throw(invalid_argument, runtime_error)
{
// some code ...
}
The C++ code is alway boxed in generated PDF file. I am wondering if there is a knob to turn off the box. I googled around and can't find it. In fact, I can't even find the full list of knobs of code-block
Thanks
The box seems to be hardcoded, but you can hide it by adding this command to
latex_elements['preamble'] in the conf.py file:
\definecolor{VerbatimBorderColor}{rgb}{1,1,1}
This won't work very well if you don't have plain white background though.
Add the following code to your conf.py file
latex_elements = {
'sphinxsetup': 'verbatimwithframe=false',
}
This will work no matter what your background color is
Am taking a snap and setting that image as background to other scene,but finally that background is showing a question marked image..
FYI the image already exists, i have checked that with File.exists(). and here is the code snippet i have used.
IEnumerator DisplayTexture() {
WWW www = new WWW(SelfiateUtils.SnapImagePath);
yield return www;
BGTexture.mainTexture = www.texture;
//Trace.text="Assaigned successfully";
if (www.error == null) {
}
}
SelfiateUtils.snapImage is the string url where i have saves the file.
can any one help me to fix this.
thanks.. :)
Just to complement the answer in the comments and give it more visibility, as stated by Sharath, one must add "file://" as as prefix to load image files (jpg, jpg) in iOS.
This particularly important to remember when loading streaming assets. This prefix must be added before Application.streamingAssetsPath in iOS and also when running the app in the Unity Editor (Win and MacOS). In Android this prefix should be omitted.
I am trying to convert some html to a png using wkhtmltoimage via nodejs and the node-wkhtml package.
I am able to a pdf without and problem. However, when I try to make a png instead of a pdf, the png is just band of colors instead of what it should be. This reported bug on the project site is very similar to what I am seeing (except I am trying to write a png and the bug is reported for a png).
It seems that the problem should only be present when using stdout on windows. Is there a work around? Is there any way to save the file without using stdout?
var fs = require('fs');
var wkhtml = require('node-wkhtml'),
createWriteStream = require('fs').createWriteStream;
var MyClass = module.exports = function()
{
var png = wkhtml.spawn('png');
png.stdout.pipe(createWriteStream('node_doc.png'));
png.stdin.end('<h1>Hello World</h1>');
}
new MyClass();
I ended up abandoning streams and node-wkhtml in general. I am now just writing a temp html file and calling wkhtmltoimage using spawn. Not ideal to have to make the temp file, but it is working.
child_process.spawn( 'wkhtmltoimage', [ 'temp.html', 'output.png' ] );