MigraDoc Paragraph Text, possible to Truncate? - migradoc

The Paragraph in MigraDoc automatically wraps text and adjust the height automatically. I want to be able to Truncate the text and if possible get it to Shrink to Fit. Has anyone accomplished this or have any idea how to do so?

You can use functions from PDFsharp to query the size of the text - and then reduce font size or shorten the text until it fits.
See also here:
http://forum.pdfsharp.net/viewtopic.php?p=6158#p6158

Related

How to change the font size of line numbers in IntelliJ IDEA?

I want to increase the font size of the line numbers in IntelliJ IDEA Ultimate(2019.3.1) independently from changing the font of the code itself but I can't find the way of doing so.
I shook the whole Internet and didn't find anything up to date either. Actions search didn't help as well.
How do I do that?
The font size of line numbers automatically changes along with the font size of code in the editor. It uses the same font setting(font, font size, etc).
You can try to adjust font.
https://www.jetbrains.com/help/idea/settings-editor-font.html
And as Improbable mentioned, there is a feature request for it: https://youtrack.jetbrains.com/issue/IDEA-92443

Increase font for pdf using Inkscape

I use to produce pdf graphs with R then I like to modify them using inkscape.
Yet when I increase font, letter size increase but letter spacing don't as you can see in example.
I have the same problem when I do the same with pdf from latex.
Thank for your help
Perhaps you have broken the text into individual letters, and are applying the new font size to those, rather than to the entire word? You may need to recreate the Xlabel text/group the letters back together.
Although there is an answer for exactly the same question here, I will duplicate it:
You should select the text you want to resize and then remove manual kerning either before or after the resizing. This can be done by clicking Text -> Remove Manual Kerns.

How to "mask" certain text in a PDF document

I have a PDF document, and I want to mask certain text blocks. The reason why I want to do this, is because I don't want this text to be indexed, nor I want this information to be easily accessible by selecting and copying this text block.
What should be the right way to do this?
I guess turning the text to raster would be bad idea, and I don't know if there is some tool that can make only cartain text parts with special privileges.
You will need a program that can convert a font into a series of shapes.
Illustrator may have the functionality you want: see here and here.

PDF itext TOC generation

I have to merge multiple PDF documents into a single PDF document. Besides this, I have to generate TOC. The original documents will contain text with a specific style (say H1). This special text becomes part of TOC.
Have used iText for merging multiple PDF files. I am unable to find example/API on parsing the document to find all the contents having style H1.
Generating TOC is next challenge.
You don't. PDFs don't have styles. They have "current Graphic State", which includes:
current transformation matrix (CTM).
stroke & fill colors
clipping path
font & size
gobs of other text state stuff (char spacing, word spacing, leading, text render mode...)
Including a separate text transformation matrix which is combined with the CTM.
So first you have to track all this stuff (which iText can mostly do for you). Then you have to determine how big "H1" text is, and latch on to all the text that is in that size screen size, taking the CTM, text matrix, and font size into account (which iText will do for you again, IIRC).
And just to make life more exciting for folks like yourself, it's entirely possible that the text you're looking at isn't text at all. It could be paths, or a bitmap... at which point you need OCR, and I don't think you'll get much in the way of size info with OCR.
You'll need to write a TextRenderListener that determines the final size of a given piece of text (and whether or not its a part of the last piece) and filter out all the stuff that's too small. You'll then build your TOC based on the text you find.

Formatting plain text output for printing?

I have a program that outputs a report into plain text. The report must be plain text for it to load into a third party program. The report also needs to be printable.
When dealing with plain text, what limits should I set on line size and number of lines on a page to get it to print reasonably?
It definitely depends on the font you use when printing, and unless you have control over that you can't guarantee it will print nicely. For example, in Word 2007, creating a blank document and setting the font to Courier New 10pt only fits 77 characters per line and 28 lines per page. Changing the margins and line spacing will modify that. However if you used that and they tried to print from Wordpad it wouldn't work because the default with Courier New 10pt only fits 72 characters per line. In either case, the standard 80 characters doesn't work. Those defaults aren't even global defaults.
The best you can probably do is pick a size and provide instructions on printing the report with several common editors so it will look acceptable. Specify the font, margin, line spacing, etc.
Have you considered other options, like creating two files? One could be plain text for import into the other program. The other could be a format better suited for printing.
its going to depend on your printing font, you want to aim for a fixed width font so that it is consistent, 80 columns is generally safe.... i think....
edit: here is a quick guide I googled - http://dsl.org/cookbook/cookbook_17.html
If you have control over the output format, consider a lightweight WYSIWYG markup language, Such as reStructuredText, AsciiDoc, markdown etc.
This way you can pipe the plane-text format into a converter that will result in postscript, PDF or HTML, that you can then print. This also mostly negates the need to consider the line width for the sake of your printer. The converter will do this for you.