Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF annotation data only correct on first record on a page #232

Open
garydale opened this issue Jul 29, 2024 · 2 comments
Open

PDF annotation data only correct on first record on a page #232

garydale opened this issue Jul 29, 2024 · 2 comments
Assignees

Comments

@garydale
Copy link

garydale commented Jul 29, 2024

I have a two-line repeating format that pulls data from a .csv file. There are 19 repeating sections. The regular text frames contain the correct data, but the PDF annotations only contain the correct information for the first line. All subsequent annotations contain the data from the last record on the page. I'm not sure if that is a coincidence or is an artifact of how I copied the sections.

The information in the text frames is:
Position, Incumbent, e-mail address, telephone

The information in the PDF annotations is:
e-mail address, telephone.

The annotation information uses the same fields as the text data. The annotations sit on top of the text frames so a click or tap should trigger them. The annotation fields for the e-mail link are named "Text5", "Copy of Text5", "Copy of Text5 (2)" .... by scribus while the telephone links are named "Text6", "Text26", Text29" ...

I use the same technique for other templates that don't use so many repeating formats on a page and they work.

I use this to generate different sections of a larger document, using a command line script. The active line is:

/usr/bin/python3 ~/.scribus/scripts/ScribusGenerator-master/ScribusGeneratorCLI.py ~/.scribus/templates/${1}.sla -c ./Directory/${1}.csv -o ./Directory/ -n ${2}-$((${2}+1))\ ${1} -m

where $1 is the section I am generating, which also specifies the template file and .csv file. $2 is the current year.

I had been using an older version of the generator that used -python3 as the main folder but just downloaded the latest version that uses -master as the main folder. The problem is similar in both of them, but the -python3 version picked up a different e-mail address than the -master version. Both selected the same telephone number.

To repeat, the first instance works while all subsequent instances have the same incorrect pdf annotations that seem to be from much further down in the .csv file.

I am creating a single .sla file.

@berteh
Copy link
Owner

berteh commented Jul 30, 2024

Hello Gary.

If I understand correctly, your issue seems to me to be related to the location of the pdfannotations bits (XML Element) in the SLA template.. like they would all be located at the end of the source file after the last NEXT-RECORD tag.

Do you mind attaching your (template) sla here so I can have a look?

Did you create all the annotations after duplicating the repeat sections, or were they already defined on the first section and then duplicated along with it?

A priori, changing the location of the pdfannotations XML Element in the SLA, before their respective NEXT-RECORD tag, should solve the issue. But I don't know a sure way to do it in Scribus : last tried with 'grouping' to no avail, maybe 'select and send backwards' would work. I'd do it with an external text/XML editor. In a copy of the template just to be sure :)

Good luck.
Berteh

@berteh
Copy link
Owner

berteh commented Aug 8, 2024

no problem on my end, as in the attached files.

The way I created my template is as suggested in the https://github.com/berteh/ScribusGenerator/wiki/How-to-use-%25SG_NEXT-RECORD%25 :

  • create one item fully laidout
  • add %SG_NEXT-RECORD% before the first element of this item, make it smaller to makes it a different (ITEXT) element entirely, that will be cleaned entirely by the script
  • group all elements of item (ctrl+g) - make sure to include the annotation frames in this group
  • Menu item > mutliple duplicate to duplicate as much as needed (7 rows in this case)
  • ungroup first element of page (ctrl+shif+g) to remove it's SG_NEXT-RECORD marker, as leaving it would skip the first record (of each page).

annotations.zip
annotations__single.pdf

@berteh berteh self-assigned this Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants