FabricMC Change Text from TextRender.draw - minecraft

I am fairly new to modding in Minecraft however I know a decent amount. What I need help with is rendering text on the screen, I would like to be able to render some text and update what is displayed as the text, here is what I have.
client.textRenderer.draw(matrixStack, Text.literal("Text"), 5, 10, 1);
If you know how I would go about changing the text after rendering, or have a different way of rendering text to make this, please say. Thank you!
I have tried rendering the text as a variable as an int but that didn't allow me to change the text.

Related

How can I set the line height of a multi-line PDF form field, and save it so it doesn't get reset by filling it?

I am having the exact same issue described in this question: Multiline pdf text box
I have a PDF that has some dotted lines that I want to convert into a fillable multi-line field. I tried the solution in the linked question, but my setting is not staying when I try to fill in the field outside of Acrobat.
When I am preparing the form inside Acrobat, I set the line height to 30 and it is lining up fine:
But when I save this PDF and then try to fill in the field outside of Acrobat, the line height setting does not stay. It gets reset every time:
It's super frustrating and I have scoured the internet looking for an answer but I have nothing yet. If someone knows what to do to get the line height looking like the first screenshot, please save my sanity.
I'm using Adobe Acrobat Pro DC 2021.001.20135 on macOS 10.14.6.
Thank you
You can't. Those settings don't "stick" when the field is cleared and there's no way to set them programmatically. It's best to simply remove the lines from the PDF.
As #joelgeraci stated, the settings don't stick.
However, if the form has to be manually fillable, removing the writing lines may not be the best idea. In this situation, it would be better to change the field's background color. When the field has no content, its background color is transparent, otherwise white. And that will cover the writing lines.

iText: why would adding an image cause text to appear fuzzy in PDF?

I'm using iText with Java to create a PDF file. I'm trying to place a paragraph on left, and float an image on right (e.g. next to each other). Using the following code does insert the image, but it also makes the text fuzzy on the entire page (other pages are fine).
// add image
Image img = Image.getInstance(imgPath);
img.setAlignment(Image.RIGHT | Image.TEXTWRAP);
img.scaleToFit(1000, 72f); // 1" height
//img.setSpacingBefore(0f); // does not have any effect
document.add(img);
// add text
Paragraph par = new Paragraph("some text here", styleBody);
par.setSpacingBefore(20f);
document.add(par);
If I remove the image portion of the code, the text looks clean. This is my first attempt at adding an image next to text. Must be doing something obviously wrong. Any idea what could cause this?
I was able to solve this problem. The code above is perfectly fine. The problem was I was using a PNG image with transparency. When I removed the transparency (by re-exporting the image from Illustrator with transparency turned off), I was able to create PDFs with clear text.
I think the transparency forces the PDF page to be written in CMYK color scheme rather than RGB, which perhaps causes this issue.
Hope this helps someone else. I searched everywhere but couldn't find any leads talking about fuzzy text in iText.

Access Report: Wrap Text Not Working

I have a report with unbound textbox's in them. I populate these fields onLoad.
The problem, though, is that the if the text is too long, it will not wrap. I have set Can Grow = Yes but this does not seem to work.
Is it due to the fact I am adding the string to the field OnLoad? If so, how can I overcome this and force the text to wrap? I would want the width to remain constant, but the height to grow.
Figured this out... I right clicked the text box and selected Size > To Fit...
I had the box big enough to accommodate a second line. It wouldn't ever word wrap until I made the change above. Can Grow and Can Shrink did nothing, but I left them selected.
I open report from code in design mode, make changes to control source of the text fields, save and close report and lastly open it in preview mode. The only way I get what I want.
I know this is an old post but I've been running into the same issue and haven't been able to figure out a solution until now.
One of the fields in print preview was getting cut off for me and despite my best efforts to make sure all the formatting settings were correct (i.e. Can Grow/Shrink: On) for both the detail section and the specific field. Again, this issue only happened in print preview, which meant the reports that were getting printed had the text cut off.
Solution:
I ended up realizing that all of the other text fields were set to Plain Text and the text field giving me the issue was set to Rich Text. I changed it to Plain Text and voila! It displayed everything without any issues.
My guess is that if you're having this issue, make sure all of the fields are set to the same property (Rich Text/Plain Text). Not sure why Access has trouble with this but I hope this solution helps someone else out.
The simple solution to this huge problem is listed below.
Convert the property of the textbox from plain text to rich text.
Set the text align property to distribute.
Enable can shrink and can grow property of the text box. (Yes)
Done.
After a lot trial-and-error, the solution seems to be that the text box that you want to scroll must have enough height to show two vertical lines. A textbox that is only one line high will not scroll. (You must also have Can Grow set to 'Yes' for both the textbox and the detail section.)
You also have to have the CAN GROW of the section that the text box is in set to YES as well as the text box.

iText create pushbutton at relative position

I'd like to create a pushbutton on a pdf using iText. However i cannot create it at any fixed/ position. It needs to be done at a relative position. Like say, 5-6 cm. before end of PDF.
Any idea on how to do it?
Another way might be creating an invisible field in acrobat, getting its field position and then creating the button at that position. However i've been unable to retrieve field positions or even view them. Could someone help me with this?
Regards,
Sameer
you should always know the size of your pages, and if you know that you will be able to put it at a relative 5-6cm of the page. some info that might help you is that all the coor and stuff in itext is done in points and there are 72pts in an inch.

How do you create PDF Form Fields that will expand to contain their content?

I have a field on a PDF form that could be too small for the contents it needs to hold. Since it is already nearly the size of the page, I need a way to tell adobe to let that field grow to cover more than a page.
I haven't found any way to do this. LiveCycle seems to act like you can do it, but everything tried so far, does not do anything more than add a scroll bar in the online view, and the fails to print all the content. Acrobat doesn't even act like it is possible.
Any ideas?
If you select the field, go to the Layout Palette (Palettes Menu -> Layout (Shift + F9) ) and select the "Expand to Fit" box next to the width and/or height it will expand when more text is entered.