[scribus-dev] importing text from pdf files, technical preview.
NASA Jeff
tallboy258 at gmail.com
Thu May 28 03:45:29 UTC 2020
There are two ways in which the text can be imported but with their
pitfalls but one having higher authenticity and the other ease of editing.
The first option, shown here: https://imgur.com/6n0xPXG imports each
section of the text into a textframe and modifies the charStyle and
paragraphStyle to support the variations to the fonts and text throughout a
particular section. It should be possible to join up textframes in a
logical manner, so they support whatever features Scribus enables through
this. Text matrices and text scaling currently aren't supported so are not
shown. I also intend to try and make this version line by line authentic
with the original pdf document even if the layout varies slightly from it
(e.g. text justification). This will mean any page/line lookups of text in
an index will still be valid.
The second option, shown here: https://imgur.com/hjL3HBe is to of
overlay a number of textframes each with their own text configurations, all
linked together by scribuses ability to link textframes. Scaling can be
used to ensure that the text in the textframes starts and finishes in the
correct place to link up with the other text frames that have coordinates
hardcoded from the pdf file. This version should keep the document as close
to the authentic pdf file as possible, but is obviously not so practical to
edit.
you can find the code here:
https://github.com/olivetthered/scribus
<https://github.com/olivetthered/scribus?fbclid=IwAR0SIzZ-u4K0nAcDzkNNx9gBAi_5cPlKv9AVgHf9TnJlQZrQT-aYAJ_8Gs4>
and you can switch between the two different versions by commenting out
_flushText(state); on line 3610 of slaoutput.cpp
There's currently a minor problem with verticle alignment of the text
because the bottom margin isn't being taken into account, but that's an
easy fix.
Hopefully, it shouldn't take much longer to get this into a usable state
for wider testing and feature requests. To my knowledge, it will make
Scribus the only freely available WYSIWYG text editor to support editing of
pdf documents text. Inkscape supports text from pdf but isn't really a
practical text editor.
I'm going to take a little break from development for just now while you
all have a play around and I familiarize myself with branching in git a bit
more.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scribus.net/pipermail/scribus-dev/attachments/20200528/84d80ae8/attachment-0001.htm>
More information about the scribus-dev
mailing list