Inkscape.org
Beginners' Questions PDF import results in too many paths
  1. #1
    Peter1 Peter1 @Peter1

    Hi all,

    I have a pdf document which I want to convert to svg.

    The pdf contains a set of rectangles and circles. See circle-rectangle.png for one pair.

    As you can see, the circle is no a clear circle, the rectangle has rounded corners.

    I import the pdf into inkscape, without changing the default settings. The imported drawing looks identical to the original.

    Then I select all objects and ungroup the objects.

    This will result in the rectangle getting a sharp corner, instead of having all rounded corners. See circle-rectangle_after-import-ungroup.png.

    When selecting the paths of the rectangle it will show 3 paths instead of 1. See rectangle-paths.png

    How can I get inscape to retain the rectangle in 1 path only, describing the rounded rectangle?

    Ideally, I would also like to know how I can get the circle into an actual circle shape and thus removing the corners.

    Thanks

    Circle Rectangle After Import Ungroup
    Rectangle Paths
    Circle Rectangle
  2. #2
    Polygon Polygon @Polygon🌶
    *

    Have you tried both PDF import options already?

    And check View->Display mode->Outline to see what you have there actually.

  3. #3
    Peter1 Peter1 @Peter1

    Yes, I tried both import options and both give the same result. Also, increasing the precision will result in the same.

    I set the display mode to outline, as you suggested. See circle-rectangle_outline-view.png

    Circle Rectangle Outline View
  4. #4
    Polygon Polygon @Polygon🌶

    The Circle can be repaired with Path effect: Circle from points

    And for the rectangular shape I´d reduce the stroke width and see how this will come out. But curves are not involved from what  see.

    That these simple parts look "smooth" in the originally PDF escapes me. Never came across such degeneration with PDF.

    If you´re allowed upload an example PDF file for further inspection please.

  5. #5
    Peter1 Peter1 @Peter1

    Circle from points does the trick. Thanks. Is it possible to do this for multiple circles at once?

    I reduced the stroke width, see attached. In fact I can solve my issue with the rectangle by doing a union of paths.

    This doesn't result in actual rectangles, but I can work with it.

    Unfortunately, I'm not allowed to share the pdf file.

    Circle Rectangle Reduced Stroke Width
  6. #6
    Polygon Polygon @Polygon🌶

    Try if grouping the circles will work with the Path-effect. If not select them go Path->Union and try the effect on the result. Otherwise the Path effect can be pasted on object with the shortcut: "&"

  7. #7
    Tyler Durden Tyler Durden @TylerDurden
    *
    Polygon

    That these simple parts look "smooth" in the originally PDF escapes me. Never came across such degeneration with PDF.

    These designs appear to be very small and originating from cad or similar. 

    If you prefer to share the file privately, DM Poly or myself. NDA is fine with me.

  8. #8
    Peter1 Peter1 @Peter1

    Correct, the pdf originates from a cad pcb drawing.

    Since the document is property of a customer, I cannot share it, even with NDA. This would required 3 party NDA.

     

    Using the tips from Polygon, I was able to get an acceptable result. Thanks a lot!

  9. #9
    Paddy_CAD Paddy_CAD @Paddy_CAD

    I believe the loss of accuracy comes from round-off errors.  

    When Inkscape imports grouped shapes from a pdf file, the node coordinates within the group are preserved in the resulting svg file.  Ungrouping the shapes forces Inkscape to recalculate those coordinates in relation to the page or parent group, discarding any digits beyond the specified decimal position.  You can improve the accuracy by changing the values in [Preferences > Input/Output > SVG Output > Numeric Precision].

    This is especially noticeable when there are fine details defined with real-word units. In your case the PCB probably has sub-milimetre features requiring node precision at fractions of a millimetre.  The original CAD file might use metres as the native measurement unit leading to 0.025mm stored as 0.000025m rounded off to 0.00003px in Inscape. 

    Another solution is to scale up the imported drawing (try 100x) before ungrouping.  Or, if you have the original CAD file, you could scale up the drawing before exporting to pdf.

Inkscape Inkscape.org Inkscape Forum Beginners' Questions PDF import results in too many paths