WMF: EMRLINETO records from a particular file are not drawn - wmf

Attached WMF file contains four LineTo records (with preceding MoveTo's), but programs that can read/show WMF files (I tried Paint, AutoCAD, Metafile Explorer) don't draw them. Three records use NULL pen, ok. But the 4th one uses a non-NUll pen, so at least it should be drawn.
The problem is that I try to parse the file myself for converting to another format and don't see a reason why the line should not be drawn.
More details: coordinates are within header's bounds rectangle, no clipping is used.
The file: https://drive.google.com/file/d/1UIjslJK_6BGlrZ1tv6tBa5i9qvhuFSCc/view?usp=sharing

Related

Why are my table border look weird in PDF viewers?

I generated a table with iText7 (C#):
var cell = new Cell().Add(new Paragraph(headers[c]).SetFont(font).SetFontColor(ColorConstants.WHITE).SetFontSize(size).SetBold());
cell.SetBackgroundColor(color);
cell.SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER);
cell.SetPadding(0);
cell.SetBorder(new SolidBorder(1));
table.AddCell(cell);
Document has the table, but on certain scalings, it looks weird on the edges:
Taking a closer look on the image above:
If however I change the zoom in the viewer directly, it looks OK:
How do I get rid of these unnecessary parts from the border?
I'm attaching here the resulted PDF for reference:
Download sample PDF
I also noticed that on iText KB pages, there is this kind of behavior:
https://kb.itextpdf.com/home/it7kb/faq/how-do-i-change-the-border-color-of-a-pdfpcell
See the red and blue bars' left edges:
This behaviour is not uncommon in PDF or other print drivers where vectors are printed rather than plotter definitions (often called "Dangles". It would be worse if the definition was rounded or square, rather than butt, and join as "mitre" cannot apply, see below). The overlap is intentional (to ensure both lines are inclusive). In a laser drum print that may be desirable overkill, but disastrous for any inkjet or screen. It looks like the cell is not bordered by a box, but using common straight vectors. Again this is often desirable optimisation but not when the weight is not honoured. Thus it depends if the viewer is using the correct thickness.
All desktop PDF viewers (icluding Chrome and FireFox) I tested showed the lines correctly as clean overlap without "Dangles". Acrobat has a reputation for undesirably thickening or thinning its standard defined lines depending on its user settings.

Trying to get rid of remnant white space after hiding images

I have multiple images in the column portion of a matrix that displays the image if there is one. If there is not an image defined for the image number, the report correctly hides the image (as the BorderColor = Black is not shown) but the white space still remains.
I have tried every possible combination (except the correct one obviously) to no avail.
My objective is to only have the width of the 8 images be 2
Any Ideas?...And splitting the images into individual lines is not an option as it negates the whole premise of using the Matrix.
I have tried placing the hidden code in every possible Hidden field in the report. All postings found all refer to a SINGLE image and not MULTIPLE images.

Putting A Box Round A Text Run - For Powerpoint

I would like to put a box around a text run in Powerpoint. Specifically a border. For example, a word might have a light green background (done by highlighting) and a thin black border line.
I've solved the "highlighting with a light green background" part - using a RGB value. That's fine.
Is it feasible to draw a box boundary line round a run?
I'm specifically looking for an example XML fragment - if this is feasible. (I use python-pptx and augment it with my own XML confection.)
I don't believe so Martin. A run is not a shape, so it doesn't have a border that can be turned on or off or given a color. You can find an excerpt of the XML schema showing what elements and attributes can go in a run-properties element (<w:rPr>) here: https://python-pptx.readthedocs.io/en/latest/dev/analysis/txt-font-underline.html?highlight=CT_TextCharacterProperties#related-schema-definitions
It can have a ln child element, which corresponds to a pptx.dml.line.LineFormat object, but that's going to set the format of the font "outline", like if you want the interior of each letter to be a different color than its outline. You could create a LineFormat object for a run if you wanted to experiment with it using line = LineFormat(run.font._element).
The other test would be whether you can do such a thing from the PowerPoint application UI. If you can't do it on Windows PowerPoint, it's very unusual that you can do it from the XML (although there are a few cases). Mac PowerPoint can't do everything Windows PowerPoint can, so that's less of a compelling "proof".

Displaying labels of polygons of a kml file in google earth

I want to have the names of the polygons of kml file, displayed in google earth.
I converted the kml file from a shapefile in qgis. The kml file is loaded normally, i can see the name and the description in the list on the google earth panel. I cannot see it on the map though. How can I visualize the names?
I know that i can create a second kml file with points and have those displayed but I need to have one single file for all.
How could I do that?
Thank you
If you don't want to use a 2nd KML file for the centroid points + labels, then you can take your original KML file, wrap each polygon in a MultiGeometry tag, and add the polygon's centroid Point feature into each MuiltiGeometry. Then you can have the labels on those points, and have them be part of the same file as the polygons. Unfortunately I don't know of any easy way to create such a thing in QGIS, so you're probably left with hand-editing or programatically generating the KML.

iTextSharp stamper wraps text

I'm using iTextSharp to fill in some stamper AcroFields.
stamper.AcroFields.SetField("Title", "Lipsum");
I created the pdf in illustrator and the form fields with Adobe Acrobat X Pro. The problem is that although the text fields are the width of the page, in the saved pdf the text wraps at about 1 third of the width.
Another question would be if it's possible the have the textfield autoSize in height, or a way to handle the overflow of the text.
1) I'd like to see that PDF. I suspect the fields aren't as wide as you think they are.
2) You can set a field's font size to zero to enable "auto sizing", which works both within Reader and iText. However, it sizes to the actual field size, not what you think it might be.
I'm guessing you drew a spiffy form field background in Illustrator, then put a field over it in Acrobat Pro, but didn't size the field width to match the spiffy illustrator background. Could be wrong, but that's my hunch.
That's the flattened PDF. Can I see the original with the form field still intact? Sorry I wasn't more specific. None the less, I can learn a little from reading this PDF:
Looking at the bounding boxes for the flattened field XObject and it's internal clipping rectangle, it looks like it should be using most of the page:
The page is ~600 points wide by ~850 tall.
The flattened field XObject is ~560 points wide by ~100 tall.
I wonder if there's some non-standard carriage return characters in your text that iText picks up on by Acrobat does not...
Anyway, I'd like to see the unflattened PDF. Filled in is good, but not flattened.
Okay, looked at the template. I don't see anything that would cause the line breaking you're seeing... which makes me think my second guess was right: new line characters.
Looking at the text layout code might give me a hint. Each of your lines of text goes like this (for example):
1 0 0 1 2 88.24 Tm 0 g (Die Semmerrolle der l{e4}nge nach zu einer grossen Roulade)Tj
n n n n n n Tm: text matrix
g: gray (0 g: black)
(...)Tj: show text
That's consistent with the code path when you set a text field value in the trunk of iText (and the most recent release[s]). That code (ColumnText) is quite good at breaking text properly, and used all over the place. The bounding box is correct (as shown in a couple places of the flattened PDF).
Check your input.

Resources