How to determine/modify the edit-print-page size

That’s strange.

I’m getting output on Windows 10 with Microsoft Print to PDF selected without any changes to the defaults.

This is what I get for the example tree:

Here is an enlarged example of the distorted text:

The amount of distortion seems to depend on how much the tree has to be scaled down.

It’s annoying that there are so many problems with printing on Windows. Sorry about that!

My tests so far have all been done on my Win 11 laptop. I might get time tomorrow to test this new feature on my Win 10 desktop PC.

As someone famously once said, “I’ll be back.”

I can firm that the print problem also occurs on my Win 10 machine. The PDF that is created when I select and print to the ‘Microsoft Print to PDF printer’ is zero byte sized. Consequently my PDF reader (Foxit) says, “Format error: not a PDF or corrupted.”

If I untick the scaling option, the output is a single page PDF with only one person (the one at the extreme left of my tree) on it.

In both cases I made no changes to the (few available) settings of the MS PDF printer, i.e. the paper defaults to Portait A4.

Can you give any more details of your Win 10 setup?

OK, made some progress…

The scaling fails / the output is a zero byte file if the tree gets too wide. Exactly how wide ‘too wide’ is though is unclear, somewhere around 35-40 people wide.

Changing the page orientation to landscape and/or increasing the page size from A4 to A3 doesn’t seem to help either.

2 Likes

Thanks for investigating this further. My guess would be that whatever simplifies the text also simplifies everything else when the tree is scaled down a lot, which leads to all elements eventually being removed for large trees.

To summarize the current state:

  • Windows won’t allow to increase the page size to export the tree at its original size and
  • Windows won’t allow to scale down the tree losslessly to export it on a standard page to scale it up later.

I’m not sure how to proceed here.
If anyone has experience exporting large visualizations/charts from gramps on Windows, I’m open to ideas.

I’ve no idea how your amazing magic is coded so I’ve no idea if this is any help but if there was a way of exporting, as opposed to printing, the tree then an export at 100% in .svg format should be suitable.

There are lots of Windows applications that can open .svg files, and in such an application you should then be able to scale the file to whatever paper size you like. With luck you’ll be able to print it out across so many sheets of A4 you could wallpaper your house with the output :grin:

1 Like

If you are using the scale to fit option in the print dialog and its rounded ratio is approaching zero, maybe turning off the scaling is a good 1st step?

The SVG editing application probably has more robust scaling and page dimension options.

Yes that does prevent the print failing completely / giving you a zero byte PDF but if you don’t scale then the output is also unusable. Without scaling you just get the (tiny) bit of the tree that fits on one page, i.e. you don’t get the whole tree spread across multiple pages.

EDITED TO ADD:
The scaling option is not in the print dialog, it’s on the ‘Interaction’ tab of the FTV configuration dialog. The MS print to PDF printer provides no scaling options in its print dialog

1 Like

Ok. Tthen we have a “work around” and a isolated problematic feature.

Print to SVG, then use the SVG application to print to PDF.

And we can speculate that the print size height/width ratio seems to have a rounding error in landscape orientation.

Umm, sorry but no, the Print dialog in the Windows version of FTV does not offer SVG as an output. It only lists actual printers, be those physical devices or virtual PDF devices.

Which is why I asked:

Have you tried a Windows print driver which offers file formats? There are several options. Like the open source clawPDF for a virtual print server.

The general policy about ‘desktop publishing’ features is that Gramps focuses on generating raw files, rather than finished documents. This approach allows Gramps to focus on its core strengths in genealogical data management, while leveraging the mature and specialized features of established publishing tools, thus avoiding duplication of effort and ensuring that users have access to the best tools for each aspect of their genealogical work.

I’ve just tried clawPDF. Yes, it can generate a .svg but the fundamental problem remains. Regardless of the page size and orientation set, the output is only one page, the top left corner of the tree, the rest of the tree is lost. It appears this is because all that clawPDF is doing (it being a PDF printer) is generating a PDF but then writing it out to disk as a .svg rather than as a PDF.

I accept that generating finished documents is not a core strength of Gramps but the Windows version of FTV does not even produce a usable raw file. If this is not fixable, and @ztlxltl implies he’s out if ideas on how to make it work, then that’s OK, it’s the way it is.

However, given that limitation it would be helpful if the addon gave a warning when you click print along the lines of, "if you’re printing under Windows, you’ll only get useable output if you use the scaling option AND limit the width of the tree’.

1 Like

@stuck
Thanks for your idea.
I just checked to see if this was possible, and apparently it is. I was able to generate an svg from the canvas itself without the detour of printing it and messing around with (virtual) printer drivers. I still have to implement the interface to access this function, select a directory/filename to save the svg to, output the correct svg image/page size, etc. As soon as this is done, I’ll let you know in this thread.

That sounds reasonable. I’ll put this on my list.

@stuck
I just packaged version 0.1.57, which adds an option to export the tree as SVG. You can find it in the Edit menu (or next to the printer icon, unfortunately there is no export icon on windows).

It seems to work fine. I can open the result in Inkscale and everything seems to be in full quality. Note that the svg page size is not ideal: some expanders may be outside the page, and the stroke of the boxes at the edge of the page is partly outside the page.

There is one more thing you should know: If you choose a path where the file cannot be saved (e.g. due to missing permissions), a Gramps error dialog will appear. In this case, the file may not be created or completed. I tried several things to catch the error and prevent it from propagating to Gramps, but none of them were able to prevent the error dialog.

If everything worked fine, you will get a popup telling you so.

1 Like

@ztlxltl
Hi. I want to thank you for a great addon!
But I get an error in the last update.
Windows 11, 24H2, 26100.2605 .
GRAMPS 5.2.4.
FTV 0.1.57.

When going to Charts:

46668: ERROR: grampsapp.py: line 188: Unhandled exception
Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-5.2.4\gramps\gui\viewmanager.py", line 968, in view_changed
    self.__change_page(page_num)
  File "C:\Program Files\GrampsAIO64-5.2.4\gramps\gui\viewmanager.py", line 984, in __change_page
    self.active_page.set_active()
  File "C:\Program Files\GrampsAIO64-5.2.4\gramps\gui\views\navigationview.py", line 151, in set_active
    PageView.set_active(self)
  File "C:\Program Files\GrampsAIO64-5.2.4\gramps\gui\views\pageview.py", line 353, in set_active
    self.sidebar.set_active()
  File "C:\Program Files\GrampsAIO64-5.2.4\gramps\gui\widgets\grampletbar.py", line 313, in set_active
    gramplet.pui.update()
  File "C:\Program Files\GrampsAIO64-5.2.4\gramps\gen\plug\_gramplet.py", line 312, in update
    self._generator = self.main()
                      ^^^^^^^^^^^
  File "C:\Users\koval\AppData\Roaming\gramps\gramps52\plugins\FamilyTreeView\family_tree_view_panel_gramplet.py", line 70, in main
    self.try_to_get_ftv()
  File "C:\Users\koval\AppData\Roaming\gramps\gramps52\plugins\FamilyTreeView\family_tree_view_panel_gramplet.py", line 51, in try_to_get_ftv
    self.panel_manager.open_person_panel(active_person_handle)
  File "C:\Users\koval\AppData\Roaming\gramps\gramps52\plugins\FamilyTreeView\family_tree_view_panel_manager.py", line 86, in open_person_panel
    image = self.create_image_widget(person)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\koval\AppData\Roaming\gramps\gramps52\plugins\FamilyTreeView\family_tree_view_info_widget_manager.py", line 99, in create_image_widget
    return self.create_image_from_image_spec(image_spec, img_width, img_height, color=color)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\koval\AppData\Roaming\gramps\gramps52\plugins\FamilyTreeView\family_tree_view_info_widget_manager.py", line 111, in create_image_from_image_spec
    img_width / pixbuf.get_width(),
                ^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_width'

This is known (see here) and seems to be unrelated to printing. I just woke up and will look into it soon.

2 Likes

@Kovalyov
Pushed a fix and packaged a new version. Can you please try v0.1.58?
If it doesn’t work for you, please let us continue the discussion here.

2 Likes

@ztlxltl
Everything is OK, no error.
Saving to SVG works correctly too.
Thanks!

2 Likes

Oooo! Yes! That works! To those of us who can’t code, you are a magician!** and we thank you immensely. This addon just gets better and better .

**“Any sufficiently advanced technology is indistinguishable from magic.” - Arthur C Clarke

3 Likes

If you could make the (Windows) default location for the SVG export be:
C:\Users%userprofile%\Documents
that would be another big help, and save users having always to navigate away from the (protected) Gramps installation folder (C:\Program Files\GrampsAIO64-5.2.4), which is where the SVG export dialog currently defaults to.

1 Like