I'm looking for any kind of technology that will let me draw dashed curves in 3D (see attachment) and export it into PDF with a guarantee that dashed lines are still paths in PDF file (not a collection of single little lines!).
I tried Processing, but see no option there to export it correctly.
In theory you can do this if you have the set of Beziers that describe each line and then set set the dash pattern for the line. The dash pattern will be non-uniform and specified to cover the entire length of each path.
The problem I think you will run into is that line thickness cannot vary over the length of a single path, so you can't really get the effect of perspective in the change of line thickness.
How to do this without line thickness change - project the 3D path of each curve onto 2D, measure the projected dash and gap lengths and construct the corresponding PDF path.
Related
[EDIT]
I am working on a path-following problem where the path is described by the geometric path of letters from a font. Bezier curves will solve my problem of a predefined geometric path in terms of an equation, but I can't seem to find a tool that enables me to generate Bezier curves of each letter from a font, with a weight of 0. The figure below illustrates what I want to achieve.
Weighted 'a' to non-weighted 'a':
The path-following problem that I need to solve will be present in a robot with a control system (Constrained Model Predictive Control for non-linear path-following) that will write these letters with a pen. I simply need a tool that could extract a Bezier curve(s) from each letter of an existing font. Fontforge (windows) shows the Bezier curve control points from where an outline of a glyph is constructed. The problem with Fontforge is that fonts are defined to have some sort of "thickness", which in turn results in a need to fill the character. My robot should only write the letters like a human would do (no-filling). A partial solution to this problem will also help.
Note: I am not sure whether this is possible using Fontforge (Windows), and changing the weight attribute of a glyph gives errors.
Reference to a similar robot: Bond│ HANDWRITING│ writing robot.
this is the first I'm working with PDFs on this level. So please be patient with
my noob question. I understand the logical and physical structure of an PDF file
on a basic level.
I have an PDF that contains a dummy ID that needs to be replaced. To check, if there
is way to do this, I used qpdf to expand the PDF using
qpdf --qdf --object-streams=disable orig.pdf expanded.pdf
Using a hex editor I located the dummy ID in expanded.pdf and changed the value by
simply swapping two digits
<001800180017> Tj => <001700170018> Tj
and saved it. Opening expanded.pdf in Acrobat didn't show the modification. The original
ID 443 is still rendered, but searching for "443" doesn't find it. When searching for
"334", the modified content, I get the rendered original ID 443 highlighted.
The PDF consist of text and vector graphic. When I insert additional digits (which obviously
invalidates the offsets in the xref), I get an error message regarding a missing font and
all digits are shown as dots but the vector graphic is still in place. This seems to indicate
that the ID is not part of the graphic.
What did I miss?
EDIT 1:
After mkl's comment, I did a deeper analysis of my PDF and found, that beside the obvious graphic content, all text was rendered by a series of m/l/c commands follwoed by a BT/ET section. Color for stroke and non-stroke was 0,0,0 for both in the BT/ET section.
Is this because of the used embedded non-standard font?
Are PDFs with embedded fonts usually done this way? A graphics part for the visual representation and a transparent (hidden) text part just to get searching and highlighting capabilities?
Looking back I wonder what I did to get the dots when I first modified the
content. I seems impossible and I can't reproduce it either.
Thanks
Tom
First off, the following is merely guesswork as you could not share the pdf in question. Educated guesswork but guesswork nonetheless.
You report that you changed the value by simply swapping two digits in the text drawing instruction argument and now can successfully search for the value with swapped digits but that Acrobat didn't show the modification.
Furthermore you observed that all text was rendered by a series of m/l/c commands followed by a BT/ET section.
The main situation in which one observes text being rendered as arbitrary vector graphics (a series of m/l/c commands), is in pdfs in which the producer didn't want text extraction to be possible and replaced text drawing instructions by arbitrary vector graphics instructions.
This apparently is not the case in your pdf as the text drawing instructions are not replaced but merely supplemented by the vector graphics ones.
Supposing that this construct is used for a reason and not by accident, I can only assume that the pdf producer was not willing or allowed to embed the font in question but wanted the specific font appearance to be displayed without having to count on the font being installed on the computer the pdf is viewed on.
Thus, the text appearance is drawn using arbitrary vector graphics instructions and the following text drawing instructions actually draw nothing but merely make the text searchable and extractable. This way there is no need to embed the apparent font face as font program. (Text drawing instructions can be made to draw nothing either by using a font with all blank glyphs or by using the text rendering mode "invisible".)
If this assumption turns out to be correct, your task to replace the dummy id requires not merely editing the arguments of the text drawing instructions but also replacing the arbitrary vector graphics instructions showing the dummy id appearance by other instructions showing the actual id.
If you happen to have the font in question and are willing and able to embed it, you can actually replace the arbitrary vector graphics instructions by text drawing instructions using the font. Otherwise be prepared to also draw the actual id as arbitrary vector graphics.
I have an excel file containing AutoCAD line data that I wish to map to AnyLogic Path constructs. To do this I am trying to edit the XML file and adding in path objects with the requisite points. The AutoCAD data I have provides a center x,y, start x,y, end x,y, and angle for arc segments, and the standard points for lines. I can't seem to figure out how anylogic draws paths, though. I do not believe they are Bezier Curves, because every path contains 5 points as far as I can tell. For the straight line segments, it's easy enough to map, but for curves I cannot equate my Autocad ARC data with the Anylogic Path construct because I don't actually know how AnyLogic Paths are represented internally.
I tried a Bezier Curve which did not work. Tried adding in the center point of the arc segment as the fourth point but this did not work. Looked at B-Splines, doesn't seem to be this either.
Format examples from AnyLogic
To give more information about thow AnyLogic stores path information internally, here are some examples of the conversion the other way round, from the AnyLogic editor to the AnyLogic XML source file. There are (poly-) lines drawn in the AnyLogic editor and the coordinates of the corresponding end points in the AnyLogic point table and finally the respective XML AnyLogic source file representing the same line.
A simple straight line:
A more complex line:
Another line. The orange arrows show the connection between the visible points and the resulting XML:
I am trying to produce production ready pdf.
I have eps file uploaded by admin and postscript file which I generate dynamically. I include eps with in postscript file
using below script
%%BeginDocument: danske.eps
(".$bgeps_path.") run
%%EndDocument
Now my problem is, there should be 10 mm space around image.
I managed to add 10mm space into pdf via translate.
But when It goes to print, printer cuts two edges, one is with 10mm space and other with image edge.
So what I want is to allow only one edge to cut that is with 10mm space.
I tried to achieve this by playing with BoundingBox but that does help me.
BoundingBox is a comment, nothing more, and as such is usually ignored. If you want to place an EPS then you need to follow the rules for EPS inclusion. You need to set up the Current Transformation Matrix to correctly scale and position the EPS on the canvas at a minimum.
Tech Note 5022 the EPSF sepcification v3.0 has guidelines for importing EPS files on page 13, you really should read this, particularly the co-ordinate system transformation on page 16. The tech note is available here:
http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf
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.