FPDF Cell Right Alignment not working - fpdf

I have been trying to find out why my FPDF cell alignment isn't working. Below is the code I am using. This is the result of the below code. When the below code outputs the pdf, the text is written outside the right side of the cell. I have a similar program (on the same system and using the same FPDF files) using the same logic and it works fine. I have looked online for other people having this issue but wasn't able to produce any useful results.
function ShowPDF()
{
require_once('FPDF/fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetAutoPageBreak(false);
$pdf->SetFontSize(11);
$pdf->SetTextColor(0,0,0);
$TOTALWITH = 400000;
$pdf->Cell(135,15,"Test",1,1,"R",false);
$pdf->Output("Alignment.pdf", 'I');
}
Does anyone know of anything that might cause or fix this issue?
Thank you,
Ernie
Edit: Image displaying output.

Related

Publish in Matlab truncates part of my text

I am using publish in Matlab to create html and pdfs. however, part of my text gets truncated. Wondering what's work around on that?
Thanks.
report.m is...
disp([runDate]);
disp([categorical(COMPANY)]);
disp([TICKER, CUSIP]);
disp(categorical([SECTOR, SUBIND]));
Then to publish...
publishList = {'report.m'};
publish(publishList{1}, options);
Output looks like... but "Production" is cut off at the end...

Create a Hyperlink in Word using Matlab activeX

Currently I am trying to write some Text to Word using ActiveX and Matlab. This file: http://www.mathworks.com/matlabcentral/fileexchange/9112-writetowordfrommatlab
helped me a lot. But I can't figure out how to insert an Hyperlink to Word.
e.g. I want to add the the word "test" connected with "www.test.de".
I've tried this:
ActXWord = actxserver('Word.Application');
ActXWord.Visible = true;
trace(ActXWord.Visible);
word_handle = invoke(ActXWord.Documents,'Add');
ActXWord.ActiveDocument.Hyperlinks.Add('test','www.test.de');
and also some other combinations with the
ActXWord.ActiveDocument.Hyperlinks.Add
method. But Matlab doesn't know the .Add method. I found some Excel examples which are working like this, but for Word it doesn't work. Somebody has an idea whats the problem could be?
Your issue is not really related to MATLAB. You are not calling the Add method of the ActiveX component correctly.
This should work:
link = 'www.test.de';
ActXWord.ActiveDocument.Content.InsertAfter(link);
ActXWord.ActiveDocument.Hyperlinks.Add(word_handle.Range(0, length(link)), link);
Anyway, this is not related to MATLAB; for more information you should refer to MS Word VBA reference.

Anyone have any idea how TabStop works in iText 5.5.0

I'm still trying to learn iText and have a few of the concepts down. However I can't figure out what TabStop is or how to use it. My particular problem is that I want to fill the end of all paragraphs with a bunch of dashes. I believe this is called a TabStop and I see the class in the itext jar but I have no clue on how to use it. I must be searching the wrong thing on google, but I've come up with nothing. The iText in Action book also doesnt seem to even know of the existance of this class so any help is much appreciated!
Please take a look at the ChunkTest class in iText's test suite. It contains several use cases of the tab stop functionality. For instance:
java.util.List<TabStop> tabStopsList = new ArrayList<TabStop>();
tabStopsList.add(new TabStop(100, new DottedLineSeparator()));
tabStopsList.add(new TabStop(200, new LineSeparator(), TabStop.Alignment.CENTER));
tabStopsList.add(new TabStop(300, new DottedLineSeparator(), TabStop.Alignment.RIGHT));
p = new Paragraph(new Chunk("Hello world", f));
p.setTabSettings(new TabSettings(tabStopsList, 50));
addTabs(p, f, 0, "la|la");
ct.addElement(p);
The TabStop functionality was introduced after the iText in Action books were written. They'll be documented in one of the new books.
For another example, see http://developers.itextpdf.com/examples/itext-building-blocks/tabbing-examples

How to Convert IPicture to Image - .NET 4.5 TagLib Sharp

I am wanting to display the album artwork of a song (accessed via the taglib-sharp library) within a Windows Forms picture box. The problem I'm running into is that the taglib-library returns an image of type TagLib.IPicture whereas the picture box requires an object of type System.Drawing.Image.
I have scoured the internet for many hours now, looking for a way to convert from an IPicture to Image, but to no avail. The best lead I have is this: http://msdn.microsoft.com/en-us/library/system.windows.forms.axhost.getpicturefromipicture.aspx, but I have yet to see a successful example of how to implement this.
Any help as to how to convert between these two types would be much appreciated. Note: IPicture is not analogous to IPictureDisp in this case.
I've done the opposite before - turning an existing .jpg into an IPicture for embedding in an .mp3 file. I just tried reversing that operation and, after tweaking and testing, came up with this:
TagLib.File tagFile = TagLib.File.Create(mp3FilePath);
MemoryStream ms = new MemoryStream(tagFile.Tag.Pictures[0].Data.Data);
System.Drawing.Image image = System.Drawing.Image.FromStream(ms);
Thanks for the question - I already know how I'm going to use this myself!
Update: Here's the other way (.jpg to IPicture that I've done before):
tagFile.Tag.Pictures = new TagLib.IPicture[]
{
new TagLib.Picture(new TagLib.ByteVector((byte[])new System.Drawing.ImageConverter().ConvertTo(System.Drawing.Image.FromFile(jpgFilePath), typeof(byte[]))))
};

Matlab editor issue, a bug?

I am having this problem that when I run the below written code in the main screen matlab does'nt give me a problem.
However if i write it in the editor then it complains that it is invalid syntax.
Can you tell me what am i doing wrong or is it a bug?
Ques1 = { #(data) mean(data) #(data) std(data) };
mean = Ques1 {1} (data(:,1)) # runs perfectly on the main compiler screen
On my editor page the compilers complains on the = sign that a possible bracket is missing. However I do not understand why it works on the matlab line by line compiler !!
Those two lines of code are absolutely correct. Somewhere in you code you have forgotten an open left bracket e.g. [ , { , (
EDIT Now I understand what g24l was saying! Yes, that is likely the culprit of your problem.
Not sure what version of matlab you're using but when I run a very simple script:
data = kron(1:25,transpose(1:25)); % very simple 2D matrix of data;
Ques1 = { #(data) mean(data) #(data) std(data) };
mean1 = Ques1 {1} (data(:,1)) % runs perfectly on the main compiler screen
It works perfectly on R2007B and R2009B, are you using an older or newer version? I suspect there is some other issue creeping up in your script. Also, as a matter of following Mathworks recommended programming procedures, I would encourage you not to name a variable or function the same name as another variable or function. In this instance I'm referring to mean = .... It's easy to get this stuff mixed up and then have nasty problems. If you need more help, please feel free to post more of your script. Hope this helps!
I don't have access to Matlab at the moment so I can't test this out, but your syntax doesn't look right to me. Try this:
Ques1 = {#(data)mean, #(data)std};
mean = Ques1{1}(data(:,1))
If you run it your way in your debugger, how many elements does it say are in your cell array?