PDFs are imported with reflected embedded pictures

Bug #840625 reported by Bob Harvey
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Alvin Penner
inkscape (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

When importing pdf files that read fine in Adobe there are two problems:

1. Graphics are inverted (see Bug #189495 & Bug #238801 ). I am not sure that the inversion I am seeing is the same as these two bugs, which seem a little confused. I am seeing inversion of graphics already in the pdf files.

2. Even though I have requested text import as text it is imported as graphics, I can find no way to edit the text.. The text is definitely in the pdf as text - I can cut-and-paste it from Adobe. The graphics for the text are not inverted, only the original. I have not found an existing bug for this.

bob@Harvey10:~$ lsb_release -rd
Description: Ubuntu 10.04.3 LTS
Release: 10.04

bob@Harvey10:~$ apt-cache policy inkscape
inkscape:
  Installed: 0.47.0-2ubuntu2
  Candidate: 0.47.0-2ubuntu2
  Version table:
 *** 0.47.0-2ubuntu2 0
        500 http://gb.archive.ubuntu.com/ubuntu/ lucid/main Packages
        100 /var/lib/dpkg/status

Revision history for this message
Alvin Penner (apenner) wrote :

1. Inversion of graphics is confirmed on Windows XP, Inkscape rev 10610

2. Unavailability of text is not confirmed. Attached is a typical text element contained in the svg file

<text
           transform="matrix(1,0,0,-1,71.25,407.5)"
           id="text214"><tspan
             style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:DejaVu Serif Bold;font-variant:normal;font-weight:bold;font-size:9.75;writing-mode:lr;-inkscape-font-specification:DejaVuSerif-Bold"
             x="0 7.995 13.9815 19.97775 26.9685 33.95925 40.95975 45.95175 48.95475 57.954 63.9405 73.944 79.94025 83.93775 86.94075 93.9315 98.9999985 106.0004985 113.0009985 120.0014985 123.9892485 129.9854985"
             y="0"
             sodipodi:role="line"
             id="tspan216">Account Name: brunnian</tspan></text>

In order to get access to this text in the gui you made need to ungroup some objects so you can select individual text elements, or you may need to go into the XML editor in Inkscape, under the Edit menu.

tags: added: importing pdf
Revision history for this message
Bob Harvey (bobharvey) wrote :

I've deleted the attachments - They had too much personal info so were a bad choice.

I will try to find another that exhibits this behaviour

Revision history for this message
mahfiaz (mahfiaz) wrote :

Press F8 to select text tool and double-click on text. If text is not covered by some half-transparent layers, then you should be able to edit it. If it is, you are better off ungrouping or using XML editor, as noted before.

Revision history for this message
su_v (suv-lp) wrote :

> (…) I can find no way to edit the text..

With regard to editing text in imported/opened PDF files:

1) Please read also the 'Text editing tips' from the release notes of 0.46 (applies to current stable and trunk as well): <http://wiki.inkscape.org/wiki/index.php/Release_notes/0.46#PDF_and_AI_import>. This specific issue when editing text originating from PDF files is tracked in bug #188794 'Broken editing of text with absolute kerning'.

2) Also note that the text tool can detect, select and edit text within (deeply nested) groups (like the node tool) - it is not required to ungroup them first or to enter all group levels (with repeated double-clicks or 'Ctrl+Enter') down to the one of the targeted text object.

Changing bug status to 'Incomplete' for now due to missing sample files (PDF).

Changed in inkscape:
status: New → Incomplete
Changed in inkscape (Ubuntu):
status: New → Incomplete
Changed in inkscape:
importance: Undecided → Medium
Changed in inkscape (Ubuntu):
importance: Undecided → Low
Revision history for this message
Bob Harvey (bobharvey) wrote :
Revision history for this message
Bob Harvey (bobharvey) wrote :
Revision history for this message
Bob Harvey (bobharvey) wrote :

OK, that is two new specimen files.

Now I accept that my second point is related to bug #188794, which I had not been able to find previously

But for my first point:
Bug #238801 is about left-to-right inversion, and my example is top-to-bottom
Bug #189495 is about re-importing inkscape's own pdfs, but is otherwise similar

I will leave the triage team to allocate duplicate links as required.

Revision history for this message
Alvin Penner (apenner) wrote :

upside-down image confirmed on Windows XP, using file induction_equivalent.pdf. The problem appears to be related to the structure of the svg file, which can have different forms, depending on the original pdf file.

when Inkscape generates a pdf file, and when you re-import this back into Inkscape, the image will be in a <image> tag which will have an inverting transform element in it as follows:

<image
             width="1"
             height="1"
             transform="matrix(1,0,0,-1,0,1)"
             xlink:href="data:image/png;base64,iVBORw0KGg
             ... JRU5ErkJggg=="
             id="image22" />

the file induction_equivalent.pdf leads to a significantly different structure in Inkscape: the <image> tag is not in the main body of the svg file, it is in the <defs> section, and it is embedded inside a <pattern> tag, and there is no transform element to invert the image. The transform element should probably be present.

Changed in inkscape:
status: Incomplete → Confirmed
Changed in inkscape (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
su_v (suv-lp) wrote :

It seems as if the pattern fills (in the <defs> section) do not consider the transformation (vertical flip) of the top-level layer (which all imported PDF/PS/EPS file have).

This issue seems similar to recent
Bug #806297 “pdfs are imported with reflected embedded pictures”
<https://bugs.launchpad.net/inkscape/+bug/806297>

SInce this issue has seen more recent activity and analysis, I'll link bug #806297 as duplicate to this one.

summary: - inkscape pdf import problems
+ PDFs are imported with reflected embedded pictures
tags: added: pattern
tags: added: transformations
Revision history for this message
Alvin Penner (apenner) wrote :

for inverted images, a fix has been committed to bzr rev 10627.
the code was slightly modified so that all image tags will receive the inverting transform that is required, regardless of where they are located in the svg file.

Changed in inkscape:
status: Confirmed → Fix Committed
su_v (suv-lp)
Changed in inkscape:
assignee: nobody → Alvin Penner (apenner)
milestone: none → 0.49
Changed in inkscape (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
su_v (suv-lp) wrote :

AFAICT this fix could be "easily" backported to the 0.48.x branch (if no regressions are reported with embedded images in other PDF files ;) ).

tags: added: backport-proposed
Revision history for this message
su_v (suv-lp) wrote :

Related:
Bug #823274 “Embedded raster image mirrored on PDF export”
<https://bugs.launchpad.net/inkscape/+bug/823274>

The sample file provided in bug #823274 renders vertically flipped with your patch (r10627) but not in r10626 and stable 0.48.x. Other PDF viewers render the logo vertically flipped too.

It seems that your patch possibly negatively affects how Inkscape renders PDF files round-trip edited in Inkscape (i.e. PDF files, e.g. saved with Firefox from the web (uses cairo as well afaik), and later edited & resaved in Inkscape)?

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Re comment #15 : Probably best not to backport this if there's a chance it will introduce regressions

tags: removed: backport-proposed
Changed in inkscape:
status: Fix Committed → Fix Released
Changed in inkscape (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.